diff --git a/build/perl/virtualmin/dolibarr.pl b/build/perl/virtualmin/dolibarr.pl
index f105a89bc4d..31578905202 100644
--- a/build/perl/virtualmin/dolibarr.pl
+++ b/build/perl/virtualmin/dolibarr.pl
@@ -242,7 +242,7 @@ if ($upgrade) {
[ "versionfrom", $upgrade->{'version'} ],
[ "versionto", $ver ],
);
- local $err = &call_dolibarr_wizard_page(\@params, "etape5", $d, $opts);
+ local $err = &call_dolibarr_wizard_page(\@params, "step5", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory.
@@ -268,12 +268,12 @@ else {
[ "usealternaterootdir", "1" ],
[ "main_alt_dir_name", "custom" ],
);
- local $err = &call_dolibarr_wizard_page(\@params, "etape1", $d, $opts);
+ local $err = &call_dolibarr_wizard_page(\@params, "step1", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Second page (Populate database)
local @params = ( [ "action", "set" ] );
- local $err = &call_dolibarr_wizard_page(\@params, "etape2", $d, $opts);
+ local $err = &call_dolibarr_wizard_page(\@params, "step2", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Third page (Add administrator account)
@@ -282,7 +282,7 @@ else {
[ "pass", $dompass ],
[ "pass_verif", $dompass ],
);
- local $err = &call_dolibarr_wizard_page(\@params, "etape5", $d, $opts);
+ local $err = &call_dolibarr_wizard_page(\@params, "step5", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory and protect config file.
diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php
index 7c207e9877b..7eebdee8bcd 100644
--- a/dev/skeletons/modMyModule.class.php
+++ b/dev/skeletons/modMyModule.class.php
@@ -34,11 +34,11 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
class modMyModule extends DolibarrModules
{
/**
- * Constructor. Define names, constants, directories, boxes, permissions
+ * Constructor. Define names, constants, directories, boxes, permissions
*
- * @param DoliDB $db Database handler
+ * @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $langs,$conf;
@@ -249,24 +249,24 @@ class modMyModule extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options='')
+ public function init($options='')
{
$sql = array();
- $result=$this->_load_tables('/mymodule/sql/');
+ //$this->_load_tables('/mymodule/sql/');
return $this->_init($sql, $options);
}
/**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
+ * Function called when module is disabled.
+ * Remove from database constants, boxes and permissions from Dolibarr database.
+ * Data directories are not deleted
*
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
*/
- function remove($options='')
+ public function remove($options = '')
{
$sql = array();
diff --git a/dev/test/testdiv.php b/dev/test/testdiv.php
index 2f1bd9182ae..5b57f0a3667 100644
--- a/dev/test/testdiv.php
+++ b/dev/test/testdiv.php
@@ -9,10 +9,10 @@
Login Dolibarr 3.4.0-alpha
-
+
-
+
diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php
index afa33e6b38f..ffa97b5b87b 100644
--- a/htdocs/admin/system/perf.php
+++ b/htdocs/admin/system/perf.php
@@ -172,7 +172,7 @@ jQuery(document).ready(function() {
var compcssstring;
getcssurl = $.ajax({
type: "GET",
- url: \''.DOL_URL_ROOT.'/includes/jquery/css/smoothness/jquery-ui-latest.custom.css\',
+ url: \''.DOL_URL_ROOT.'/includes/jquery/css/smoothness/jquery-ui.custom.css\',
cache: false,
/* async: false, */
/*crossDomain: true, */
diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php
index b81bd2f9578..ca851961857 100644
--- a/htdocs/core/boxes/box_graph_product_distribution.php
+++ b/htdocs/core/boxes/box_graph_product_distribution.php
@@ -180,6 +180,7 @@ class box_graph_product_distribution extends ModeleBoxes
//$px1->mode='depth';
$px1->SetType(array('pie'));
$px1->SetTitle($langs->trans("BoxProductDistributionFor",$paramtitle,$langs->transnoentitiesnoconv("Invoices")));
+ $px1->combine = 0.05;
$px1->draw($filenamenb,$fileurlnb);
}
@@ -238,6 +239,7 @@ class box_graph_product_distribution extends ModeleBoxes
//$px2->mode='depth';
$px2->SetType(array('pie'));
$px2->SetTitle($langs->trans("BoxProductDistributionFor",$paramtitle,$langs->transnoentitiesnoconv("Proposals")));
+ $px2->combine = 0.05;
$px2->draw($filenamenb,$fileurlnb);
}
@@ -297,6 +299,8 @@ class box_graph_product_distribution extends ModeleBoxes
//$px3->mode='depth';
$px3->SetType(array('pie'));
$px3->SetTitle($langs->trans("BoxProductDistributionFor",$paramtitle,$langs->transnoentitiesnoconv("Orders")));
+ $px3->combine = 0.05;
+
$px3->draw($filenamenb,$fileurlnb);
}
}
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index daad3e51e16..d9f8daa9882 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -41,6 +41,11 @@ abstract class CommonObject
*/
public $db;
+ /**
+ * @var int The object identifier
+ */
+ public $id;
+
/**
* @var string Error string
* @deprecated Use instead the array of error strings
@@ -92,33 +97,245 @@ abstract class CommonObject
*/
public $canvas;
-
- public $name;
- public $lastname;
- public $firstname;
- public $civility_id;
/**
- * @deprecated
- * @see thirdparty
+ * @var Project The related project
+ * @see fetch_projet()
*/
- public $client;
+ public $project;
/**
- * @var Societe
+ * @var int The related project ID
+ * @see setProject(), project
*/
- public $thirdparty;
+ public $fk_project;
/**
* @deprecated
* @see project
*/
public $projet;
+
/**
- * @var Project
+ * @var Contact a related contact
+ * @see fetch_contact()
*/
- public $project;
+ public $contact;
+ /**
+ * @var int The related contact ID
+ * @see fetch_contact()
+ */
+ public $contact_id;
+
+ /**
+ * @var Societe A related thirdparty
+ * @see fetch_thirdparty()
+ */
+ public $thirdparty;
+ /**
+ * @deprecated
+ * @see thirdparty
+ */
+ public $client;
+
+ /**
+ * @var User A related user
+ * @see fetch_user()
+ */
+ public $user;
+
+ /**
+ * @var CommonObject An originating object?
+ * @see fetch_origin()
+ */
+ public $origin;
+ /**
+ * @var int The originating object?
+ * @see fetch_origin(), origin
+ */
+ public $origin_id;
+
+ /**
+ * @var string The object's reference
+ */
+ public $ref;
+ /**
+ * @var string The object's previous reference
+ */
+ public $ref_previous;
+ /**
+ * @var string The object's next reference
+ */
+ public $ref_next;
+ /**
+ * @var string An external reference for the object
+ */
+ public $ref_ext;
+
+ /**
+ * @var string
+ */
+ public $element;
+ /**
+ * @var string
+ */
+ public $table_element;
+ /**
+ * @var
+ */
+ public $table_element_line;
+
+ /**
+ * @var int The object's status
+ * @see setStatut()
+ */
+ public $statut;
+
+ /**
+ * @var string
+ * @see getFullAddress()
+ */
+ public $country;
+ /**
+ * @var int
+ * @see getFullAddress(), country
+ */
+ public $country_id;
+ /**
+ * @var string
+ * @see getFullAddress(), isInEEC(), country
+ */
+ public $country_code;
+
+ /**
+ * @var int
+ * @see fetch_barcode()
+ */
+ public $barcode_type;
+ /**
+ * @var string
+ * @see fetch_barcode(), barcode_type
+ */
+ public $barcode_type_code;
+ /**
+ * @var string
+ * @see fetch_barcode(), barcode_type
+ */
+ public $barcode_type_label;
+ /**
+ * @var string
+ * @see fetch_barcode(), barcode_type
+ */
+ public $barcode_type_coder;
+
+ /**
+ * @var int Payment method ID?
+ * @see setPaymentMethods()
+ */
+ public $mode_reglement_id;
+
+ /**
+ * @var string Payment terms ID
+ * @see setPaymentTerms()
+ */
+ public $cond_reglement_id;
+ /**
+ * @deprecated
+ * @see cond_reglement_id;
+ */
+ public $cond_reglement;
+
+ /**
+ * @var int Delivery address ID
+ * @see setDeliveryAddress()
+ */
+ public $fk_delivery_address;
+
+ /**
+ * @var int Shipping method ID
+ * @see setShippingMethod()
+ */
+ public $shipping_method_id;
+
+ /**
+ * @var string
+ * @see SetDocModel()
+ */
+ public $modelpdf;
+
+ /**
+ * @var int Bank account ID
+ * @see SetBankAccount()
+ */
+ public $fk_account;
+
+ /**
+ * @var string Public note
+ * @see update_note()
+ */
+ public $note_public;
+ /**
+ * @var string Private note
+ * @see update_note()
+ */
+ public $note_private;
+ /**
+ * @deprecated
+ * @see note_public
+ */
+ public $note;
+
+ /**
+ * @var float
+ * @see update_price()
+ */
+ public $total_ht;
+ /**
+ * @var float
+ * @see update_price()
+ */
+ public $total_tva;
+ /**
+ * @var float
+ * @see update_price()
+ */
+ public $total_localtax1;
+ /**
+ * @var float
+ * @see update_price()
+ */
+ public $total_localtax2;
+ /**
+ * @var float
+ * @see update_price()
+ */
+ public $total_ttc;
+
+ /**
+ * @var CommonObjectLine[]
+ */
+ public $lines;
+
+ /**
+ * @var int
+ * @see setIncoterms()
+ */
+ public $fk_incoterms;
+ /**
+ * @var string
+ * @see SetIncoterms()
+ */
+ public $libelle_incoterms;
+ /**
+ * @var string
+ * @see display_incoterms()
+ */
+ public $location_incoterms;
+
+ public $name;
+ public $lastname;
+ public $firstname;
+ public $civility_id;
// No constructor as it is an abstract class
-
/**
* Check an object id/ref exists
* If you don't need/want to instantiate object and just need to know if object exists, use this method instead of fetch
@@ -178,8 +395,6 @@ abstract class CommonObject
*/
function getFullName($langs,$option=0,$nameorder=-1,$maxlen=0)
{
- global $conf;
-
//print "lastname=".$this->lastname." name=".$this->name." nom=".$this->nom." \n";
$lastname=$this->lastname;
$firstname=$this->firstname;
@@ -223,13 +438,13 @@ abstract class CommonObject
*
* @param int $fk_socpeople Id of thirdparty contact (if source = 'external') or id of user (if souce = 'internal') to link
* @param int $type_contact Type of contact (code or id). Must be if or code found into table llx_c_type_contact. For example: SALESREPFOLL
- * @param int $source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user)
+ * @param string $source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user)
* @param int $notrigger Disable all triggers
* @return int <0 if KO, >0 if OK
*/
function add_contact($fk_socpeople, $type_contact, $source='external',$notrigger=0)
{
- global $user,$conf,$langs;
+ global $user,$langs;
dol_syslog(get_class($this)."::add_contact $fk_socpeople, $type_contact, $source");
@@ -321,8 +536,6 @@ abstract class CommonObject
*/
function copy_linked_contact($objFrom, $source='internal')
{
- global $user,$langs,$conf;
-
$contacts = $objFrom->liste_contact(-1, $source);
foreach($contacts as $contact)
{
@@ -373,7 +586,7 @@ abstract class CommonObject
*/
function delete_contact($rowid, $notrigger=0)
{
- global $user,$langs,$conf;
+ global $user;
$this->db->begin();
@@ -545,7 +758,7 @@ abstract class CommonObject
* Return array with list of possible values for type of contacts
*
* @param string $source 'internal', 'external' or 'all'
- * @param string $order Sort order by 'code' or 'rowid'
+ * @param string $order Sort order by : 'code' or 'rowid'
* @param int $option 0=Return array id->label, 1=Return array code->label
* @param int $activeonly 0=all status of contact, 1=only the active
* @param string $code Type of contact (Example: 'CUSTOMER', 'SERVICE')
@@ -769,7 +982,7 @@ abstract class CommonObject
}
}
}
- else return 0;
+ return 0;
}
/**
@@ -891,10 +1104,8 @@ abstract class CommonObject
* @param User|string $user Update last update fields also if user object provided
* @return int <0 if KO, >0 if OK
*/
- function setValueFrom($field, $value, $table='', $id='', $format='', $id_field='', $user='')
+ function setValueFrom($field, $value, $table='', $id=null, $format='', $id_field='', $user='')
{
- global $conf;
-
if (empty($table)) $table=$this->table_element;
if (empty($id)) $id=$this->id;
if (empty($format)) $format='text';
@@ -933,7 +1144,7 @@ abstract class CommonObject
*/
function load_previous_next_ref($filter,$fieldid,$nodbprefix=0)
{
- global $conf, $user;
+ global $user;
if (! $this->table_element)
{
@@ -1253,6 +1464,8 @@ abstract class CommonObject
}
}
+ // TODO: Move line related operations to CommonObjectLine?
+
/**
* Save a new position (field rang) for details lines.
* You can choose to set position for lines with already a position or lines without any position defined.
@@ -1918,7 +2131,7 @@ abstract class CommonObject
* @return void
* @see add_object_linked, updateObjectLinked, deleteObjectLinked
*/
- function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR',$alsosametype=1)
+ function fetchObjectLinked($sourceid=null,$sourcetype='',$targetid=null,$targettype='',$clause='OR',$alsosametype=1)
{
global $conf;
@@ -1948,7 +2161,7 @@ abstract class CommonObject
if (empty($sourceid) && empty($targetid))
{
- dol_syslog('Bad usage of function. No source nor target id defined (nor as parameter nor as object id)', LOG_ERROR);
+ dol_syslog('Bad usage of function. No source nor target id defined (nor as parameter nor as object id)', LOG_ERR);
return -1;
}
@@ -2082,7 +2295,7 @@ abstract class CommonObject
* @return int >0 if OK, <0 if KO
* @see add_object_linked, fetObjectLinked, deleteObjectLinked
*/
- function updateObjectLinked($sourceid='', $sourcetype='', $targetid='', $targettype='')
+ function updateObjectLinked($sourceid=null, $sourcetype='', $targetid=null, $targettype='')
{
$updatesource=false;
$updatetarget=false;
@@ -2128,7 +2341,7 @@ abstract class CommonObject
* @return int >0 if OK, <0 if KO
* @see add_object_linked, updateObjectLinked, fetchObjectLinked
*/
- function deleteObjectLinked($sourceid='', $sourcetype='', $targetid='', $targettype='')
+ function deleteObjectLinked($sourceid=null, $sourcetype='', $targetid=null, $targettype='')
{
$deletesource=false;
$deletetarget=false;
@@ -2180,7 +2393,7 @@ abstract class CommonObject
* @param string $elementType Type of element to force (use this->table_element by default)
* @return int <0 if KO, >0 if OK
*/
- function setStatut($status,$elementId='',$elementType='')
+ function setStatut($status,$elementId=null,$elementType='')
{
global $user,$langs,$conf;
@@ -2324,7 +2537,6 @@ abstract class CommonObject
foreach($this->childtables as $table)
{
// Check if third party can be deleted
- $nb=0;
$sql = "SELECT COUNT(*) as nb from ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE ".$this->fk_element." = ".$id;
$resql=$this->db->query($sql);
@@ -2398,10 +2610,9 @@ abstract class CommonObject
$pu_ht = $obj->pu_ht;
$qty= $obj->qty;
- $discount_percent_line = $obj->remise_percent;
$total_ht = $obj->total_ht;
- $total_discount_line = price2num(($pu_ht * $qty) - $total_ht, 'MT');
+ $total_discount_line = floatval(price2num(($pu_ht * $qty) - $total_ht, 'MT'));
$total_discount += $total_discount_line;
$i++;
@@ -2451,7 +2662,7 @@ abstract class CommonObject
function display_incoterms()
{
$out = '';
- $this->incoterms_libelle = '';
+ $this->libelle_incoterms = '';
if (!empty($this->fk_incoterms))
{
$sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms;
@@ -2640,8 +2851,8 @@ abstract class CommonObject
* But for the moment we don't know if it'st possible as we keep a method available on overloaded objects.
*
* @param string $action Action code
- * @param Societe $seller Object of seller third party
- * @param Societe $buyer Object of buyer third party
+ * @param string $seller Object of seller third party
+ * @param string $buyer Object of buyer third party
* @param int $selected Object line selected
* @param int $dateSelector 1=Show also date range input fields
* @return void
@@ -2734,12 +2945,12 @@ abstract class CommonObject
if (empty($line->fk_parent_line))
{
$parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline);
- $reshook=$hookmanager->executeHooks('printObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
+ $hookmanager->executeHooks('printObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
}
else
{
$parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline);
- $reshook=$hookmanager->executeHooks('printObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
+ $hookmanager->executeHooks('printObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
}
}
else
@@ -2755,16 +2966,16 @@ abstract class CommonObject
* Return HTML content of a detail line
* TODO Move this into an output class file (htmlline.class.php)
*
- * @param string $action GET/POST action
- * @param CommonObjectLine $line Selected object line to output
- * @param string $var Is it a an odd line (true)
- * @param int $num Number of line (0)
- * @param int $i I
- * @param int $dateSelector 1=Show also date range input fields
- * @param Societe $seller Object of seller third party
- * @param Societe $buyer Object of buyer third party
- * @param int $selected Object line selected
- * @param object $extrafieldsline Object of extrafield line attribute
+ * @param string $action GET/POST action
+ * @param CommonObjectLine $line Selected object line to output
+ * @param string $var Is it a an odd line (true)
+ * @param int $num Number of line (0)
+ * @param int $i I
+ * @param int $dateSelector 1=Show also date range input fields
+ * @param string $seller Object of seller third party
+ * @param string $buyer Object of buyer third party
+ * @param int $selected Object line selected
+ * @param int $extrafieldsline Object of extrafield line attribute
* @return void
*/
function printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected=0,$extrafieldsline=0)
@@ -2895,7 +3106,6 @@ abstract class CommonObject
}
print '
'.$langs->trans('ReductionShort').'
';
- $num = count($this->lines);
$var = true;
$i = 0;
@@ -2909,7 +3119,7 @@ abstract class CommonObject
{
$parameters=array('line'=>$line,'var'=>$var,'i'=>$i);
$action='';
- $reshook=$hookmanager->executeHooks('printOriginObjectLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
+ $hookmanager->executeHooks('printOriginObjectLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
}
}
else
@@ -2927,13 +3137,13 @@ abstract class CommonObject
* If lines are into a template, title must also be into a template
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
*
- * @param array $line Line
- * @param string $var Var
+ * @param CommonObjectLine $line Line
+ * @param string $var Var
* @return void
*/
function printOriginLine($line,$var)
{
- global $conf,$langs,$bc, $conf;
+ global $langs, $conf;
//var_dump($line);
if (!empty($line->date_start))
@@ -3042,7 +3252,7 @@ abstract class CommonObject
/**
* Show the array with all margin infos
*
- * @param boolean $force_price Force price
+ * @param bool $force_price Force price
* @return void
* @deprecated 3.8 Load FormMargin class and make a direct call to displayMarginInfos
*/
@@ -3108,7 +3318,7 @@ abstract class CommonObject
*/
function delete_resource($rowid, $element, $notrigger=0)
{
- global $user,$langs,$conf;
+ global $user;
$this->db->begin();
@@ -3150,7 +3360,7 @@ abstract class CommonObject
$nboflines=count($this->lines);
for($i=0; $i < $nboflines; $i++)
{
- $this->lines[$i] = dol_clone($this->lines[$i]);
+ $this->lines[$i] = clone $this->lines[$i];
}
}
}
@@ -3306,11 +3516,11 @@ abstract class CommonObject
{
// Create small thumbs for company (Ratio is near 16/9)
// Used on logon for example
- $imgThumbSmall = vignette($file_osencoded, $maxwidthsmall, $maxheightsmall, '_small', $quality);
+ vignette($file_osencoded, $maxwidthsmall, $maxheightsmall, '_small', $quality);
// Create mini thumbs for company (Ratio is near 16/9)
// Used on menu or for setup page for example
- $imgThumbMini = vignette($file_osencoded, $maxwidthmini, $maxheightmini, '_mini', $quality);
+ vignette($file_osencoded, $maxwidthmini, $maxheightmini, '_mini', $quality);
}
}
@@ -3365,7 +3575,7 @@ abstract class CommonObject
* @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label()
* @return int <0 if error, 0 if no optionals to find nor found, 1 if a line is found and optional loaded
*/
- function fetch_optionals($rowid='',$optionsArray='')
+ function fetch_optionals($rowid=null,$optionsArray=null)
{
if (empty($rowid)) $rowid=$this->id;
@@ -3429,10 +3639,6 @@ abstract class CommonObject
*/
function deleteExtraFields()
{
- global $langs;
-
- $error=0;
-
$this->db->begin();
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id;
@@ -3472,13 +3678,12 @@ abstract class CommonObject
$langs->load('admin');
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
- $optionsArray = $extrafields->fetch_name_optionals_label($this->table_element);
+ $extrafields->fetch_name_optionals_label($this->table_element);
foreach($this->array_options as $key => $value)
{
$attributeKey = substr($key,8); // Remove 'options_' prefix
$attributeType = $extrafields->attribute_type[$attributeKey];
- //$attributeSize = $extrafields->attribute_size[$attributeKey]; Not required to insert an extrafield value. Only used for definition.
$attributeLabel = $extrafields->attribute_label[$attributeKey];
$attributeParam = $extrafields->attribute_param[$attributeKey];
switch ($attributeType)
@@ -3486,7 +3691,7 @@ abstract class CommonObject
case 'int':
if (!is_numeric($value) && $value!='')
{
- $error++; $this->errors[]=$langs->trans("ExtraFieldHasWrongValue",$attributeLabel);
+ $this->errors[]=$langs->trans("ExtraFieldHasWrongValue",$attributeLabel);
return -1;
}
elseif ($value=='')
diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php
index b65c5c8ede4..0b713de80ff 100644
--- a/htdocs/core/class/dolgraph.class.php
+++ b/htdocs/core/class/dolgraph.class.php
@@ -1,6 +1,6 @@
- * Copyright (c) 2004-2013 Laurent Destailleur
+ * Copyright (c) 2004-2015 Laurent Destailleur
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -56,7 +56,7 @@ class DolGraph
var $showlegend=1;
var $showpointvalue=1;
var $showpercent=0;
-
+ var $combine=0; // 0.05 if you want to combine records < 5% into "other"
var $graph; // Objet Graph (Artichow, Phplot...)
var $error;
@@ -875,39 +875,43 @@ class DolGraph
function plotWithOptions_'.$tag.'() {
$.plot($("#placeholder_'.$tag.'"), d0,
{
- series: {
- pie: {
- show: true,
- radius: 3/4,
- label: {
- show: true,
- radius: 3/4,
- formatter: function(label, series) {
- var percent=Math.round(series.percent);
- var number=series.data[0][1];
- return \'';
- $this->stringtoshow.='
';
print $tab[$x]['entry'];
// And now we search all its sons of lower level
tree_recur($tab,$tab[$x],$rang+1);
@@ -153,7 +153,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree')
elseif (! empty($tab[$x]['rowid']) && $tab[$x]['fk_menu'] == -1 && $tab[$x]['fk_mainmenu'] == $pere['mainmenu'] && $tab[$x]['fk_leftmenu'] == $pere['leftmenu'])
{
if (empty($ulprinted) && ! empty($pere['rowid'])) { print '
'; $ulprinted++; }
- print "\n".'
';
+ print "\n".'
';
print $tab[$x]['entry'];
// And now we search all its sons of lower level
tree_recur($tab,$tab[$x],$rang+1);
diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php
index 341edac8271..eee8dd50287 100644
--- a/htdocs/core/modules/DolibarrModules.class.php
+++ b/htdocs/core/modules/DolibarrModules.class.php
@@ -194,6 +194,13 @@ abstract class DolibarrModules
*/
public $core_enabled;
+ /**
+ * Constructor. Define names, constants, directories, boxes, permissions
+ *
+ * @param DoliDB $db Database handler
+ */
+ abstract public function __construct($db);
+
/**
* Enables a module.
* Inserts all informations into database
@@ -1672,4 +1679,30 @@ print $sql;
return $err;
}
+ /**
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories
+ *
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
+ */
+ public function init($options = '')
+ {
+ return $this->_init(array(), $options);
+ }
+
+ /**
+ * Function called when module is disabled.
+ * Remove from database constants, boxes and permissions from Dolibarr database.
+ * Data directories are not deleted
+ *
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
+ */
+ public function remove($options = '')
+ {
+ return $this->_remove(array(), $options);
+ }
+
}
diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php
index 84e18048e84..7b7a9dd4517 100644
--- a/htdocs/core/modules/modAccounting.class.php
+++ b/htdocs/core/modules/modAccounting.class.php
@@ -272,35 +272,4 @@ class modAccounting extends DolibarrModules
$this->menus = array();
$r = 0;
}
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
-
- $sql = array();
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
}
diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php
index c897be729ec..1090e8b6939 100644
--- a/htdocs/core/modules/modAdherent.class.php
+++ b/htdocs/core/modules/modAdherent.class.php
@@ -230,37 +230,4 @@ class modAdherent extends DolibarrModules
$this->import_regex_array[$r]=array('a.civility'=>'code@'.MAIN_DB_PREFIX.'c_civility','a.fk_adherent_type'=>'rowid@'.MAIN_DB_PREFIX.'adherent_type','a.morphy'=>'(phy|mor)','a.statut'=>'^[0|1]','a.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','a.datefin'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
$this->import_examplevalues_array[$r]=array('a.civility'=>"MR",'a.lastname'=>'Smith','a.firstname'=>'John','a.login'=>'jsmith','a.pass'=>'passofjsmith','a.fk_adherent_type'=>'1','a.morphy'=>'"mor" or "phy"','a.societe'=>'JS company','a.address'=>'21 jump street','a.zip'=>'55000','a.town'=>'New York','a.country'=>'1','a.email'=>'jsmith@example.com','a.birth'=>'1972-10-10','a.statut'=>"0 or 1",'a.note_public'=>"This is a public comment on member",'a.note_private'=>"This is private comment on member",'a.datec'=>dol_print_date($now,'%Y-%m-%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'),'%Y-%m-%d'));
}
-
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
-
- $sql = array();
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php
index c6492ab5161..3119553f677 100644
--- a/htdocs/core/modules/modAgenda.class.php
+++ b/htdocs/core/modules/modAgenda.class.php
@@ -399,39 +399,4 @@ class modAgenda extends DolibarrModules
$this->export_sql_end[$r] .=' ORDER BY ac.datep';
}
-
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- // Prevent pb of modules not correctly disabled
- //$this->remove($options);
-
- $sql = array();
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modApi.class.php b/htdocs/core/modules/modApi.class.php
index 2bdcbe03c54..5e0e825d1e0 100644
--- a/htdocs/core/modules/modApi.class.php
+++ b/htdocs/core/modules/modApi.class.php
@@ -232,21 +232,5 @@ class modApi extends DolibarrModules
return $this->_init($sql, $options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql, $options);
- }
-
}
diff --git a/htdocs/core/modules/modAskPriceSupplier.class.php b/htdocs/core/modules/modAskPriceSupplier.class.php
index 371f2c9f214..23d4fb20f42 100644
--- a/htdocs/core/modules/modAskPriceSupplier.class.php
+++ b/htdocs/core/modules/modAskPriceSupplier.class.php
@@ -221,20 +221,4 @@ class modAskPriceSupplier extends DolibarrModules
return $this->_init($sql, $options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
\ No newline at end of file
diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php
index df698b26a90..9222a38ff26 100644
--- a/htdocs/core/modules/modBanque.class.php
+++ b/htdocs/core/modules/modBanque.class.php
@@ -209,20 +209,4 @@ class modBanque extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modBarcode.class.php b/htdocs/core/modules/modBarcode.class.php
index 0d06c1657c2..4ee6084aaf6 100644
--- a/htdocs/core/modules/modBarcode.class.php
+++ b/htdocs/core/modules/modBarcode.class.php
@@ -146,20 +146,4 @@ class modBarcode extends DolibarrModules
return $this->_init($sql, $options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql, $options);
- }
-
}
diff --git a/htdocs/core/modules/modBookmark.class.php b/htdocs/core/modules/modBookmark.class.php
index 587429aa830..a6585e14d54 100644
--- a/htdocs/core/modules/modBookmark.class.php
+++ b/htdocs/core/modules/modBookmark.class.php
@@ -99,35 +99,4 @@ class modBookmark extends DolibarrModules
$this->rights[$r][4] = 'supprimer';
}
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories.
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- $sql = array();
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modCashDesk.class.php b/htdocs/core/modules/modCashDesk.class.php
index d6deb4ab51f..9b256162597 100644
--- a/htdocs/core/modules/modCashDesk.class.php
+++ b/htdocs/core/modules/modCashDesk.class.php
@@ -139,20 +139,4 @@ class modCashDesk extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted.
- *
- * @param string $options Options
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php
index b64c9671a99..e9efbcbe732 100644
--- a/htdocs/core/modules/modCategorie.class.php
+++ b/htdocs/core/modules/modCategorie.class.php
@@ -363,20 +363,4 @@ class modCategorie extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modClickToDial.class.php b/htdocs/core/modules/modClickToDial.class.php
index 872700c1817..518cafa35a4 100644
--- a/htdocs/core/modules/modClickToDial.class.php
+++ b/htdocs/core/modules/modClickToDial.class.php
@@ -74,37 +74,4 @@ class modClickToDial extends DolibarrModules
$this->rights = array();
$this->rights_class = 'clicktodial';
}
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- global $conf;
-
- $sql = array();
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php
index 03b1a6d964b..4289bd54932 100644
--- a/htdocs/core/modules/modCommande.class.php
+++ b/htdocs/core/modules/modCommande.class.php
@@ -237,21 +237,4 @@ class modCommande extends DolibarrModules
return $this->_init($sql,$options);
}
-
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modComptabilite.class.php b/htdocs/core/modules/modComptabilite.class.php
index 74002f0065f..e23a04ce548 100644
--- a/htdocs/core/modules/modComptabilite.class.php
+++ b/htdocs/core/modules/modComptabilite.class.php
@@ -115,20 +115,4 @@ class modComptabilite extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modContrat.class.php b/htdocs/core/modules/modContrat.class.php
index dedfc4efff0..c1bcc9fd914 100644
--- a/htdocs/core/modules/modContrat.class.php
+++ b/htdocs/core/modules/modContrat.class.php
@@ -199,20 +199,4 @@ class modContrat extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modCron.class.php b/htdocs/core/modules/modCron.class.php
index fafec485b60..90d17882672 100644
--- a/htdocs/core/modules/modCron.class.php
+++ b/htdocs/core/modules/modCron.class.php
@@ -137,39 +137,4 @@ class modCron extends DolibarrModules
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
$r++;
}
-
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- $sql = array();
-
- // Prevent pb of modules not correctly disabled
- //$this->remove($options);
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modDeplacement.class.php b/htdocs/core/modules/modDeplacement.class.php
index 47642e5195d..08f21ae6c63 100644
--- a/htdocs/core/modules/modDeplacement.class.php
+++ b/htdocs/core/modules/modDeplacement.class.php
@@ -145,20 +145,4 @@ class modDeplacement extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modDocumentGeneration.class.php b/htdocs/core/modules/modDocumentGeneration.class.php
index ea40750a161..c312cc37b5a 100644
--- a/htdocs/core/modules/modDocumentGeneration.class.php
+++ b/htdocs/core/modules/modDocumentGeneration.class.php
@@ -114,21 +114,4 @@ class modDocumentGeneration extends DolibarrModules
return $this->_init($sql,$options);
}
-
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modDon.class.php b/htdocs/core/modules/modDon.class.php
index c546292c2b4..1d279b85148 100644
--- a/htdocs/core/modules/modDon.class.php
+++ b/htdocs/core/modules/modDon.class.php
@@ -158,20 +158,4 @@ class modDon extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
\ No newline at end of file
diff --git a/htdocs/core/modules/modDynamicPrices.class.php b/htdocs/core/modules/modDynamicPrices.class.php
index 1b2fb712a8b..78f56a76ab4 100644
--- a/htdocs/core/modules/modDynamicPrices.class.php
+++ b/htdocs/core/modules/modDynamicPrices.class.php
@@ -84,39 +84,4 @@ class modDynamicPrices extends DolibarrModules
$this->rights_class = 'dynamicprices';
$r=0;
}
-
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- // Prevent pb of modules not correctly disabled
- //$this->remove($options);
-
- $sql = array();
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modECM.class.php b/htdocs/core/modules/modECM.class.php
index 60d76f2e995..2bf3542186a 100644
--- a/htdocs/core/modules/modECM.class.php
+++ b/htdocs/core/modules/modECM.class.php
@@ -179,36 +179,5 @@ class modECM extends DolibarrModules
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
$r++;
}
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- $sql = array();
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php
index 2f4b7a88be8..6e019849ae2 100644
--- a/htdocs/core/modules/modExpedition.class.php
+++ b/htdocs/core/modules/modExpedition.class.php
@@ -277,20 +277,4 @@ class modExpedition extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modExpenseReport.class.php b/htdocs/core/modules/modExpenseReport.class.php
index 851ddb39d02..690ca7ba87e 100644
--- a/htdocs/core/modules/modExpenseReport.class.php
+++ b/htdocs/core/modules/modExpenseReport.class.php
@@ -345,19 +345,4 @@ class modExpenseReport extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted.
- *
- * @param string $options Options
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
}
\ No newline at end of file
diff --git a/htdocs/core/modules/modExport.class.php b/htdocs/core/modules/modExport.class.php
index ad2da537436..634306ea4db 100644
--- a/htdocs/core/modules/modExport.class.php
+++ b/htdocs/core/modules/modExport.class.php
@@ -89,35 +89,4 @@ class modExport extends DolibarrModules
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'creer';
}
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- $sql = array();
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modExternalSite.class.php b/htdocs/core/modules/modExternalSite.class.php
index 61eebe77f80..620fc53b53f 100644
--- a/htdocs/core/modules/modExternalSite.class.php
+++ b/htdocs/core/modules/modExternalSite.class.php
@@ -117,36 +117,5 @@ class modExternalSite extends DolibarrModules
$r++;
}
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- $sql = array();
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modFTP.class.php b/htdocs/core/modules/modFTP.class.php
index 38b16127c90..e7388faaedf 100644
--- a/htdocs/core/modules/modFTP.class.php
+++ b/htdocs/core/modules/modFTP.class.php
@@ -126,36 +126,5 @@ class modFTP extends DolibarrModules
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
$r++;
}
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- $sql = array();
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php
index 1e0725659a0..54363bc9d80 100644
--- a/htdocs/core/modules/modFacture.class.php
+++ b/htdocs/core/modules/modFacture.class.php
@@ -342,20 +342,4 @@ class modFacture extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modFckeditor.class.php b/htdocs/core/modules/modFckeditor.class.php
index 8f81bf74f7b..6a5932cca5a 100644
--- a/htdocs/core/modules/modFckeditor.class.php
+++ b/htdocs/core/modules/modFckeditor.class.php
@@ -82,37 +82,4 @@ class modFckeditor extends DolibarrModules
$this->rights = array();
$this->rights_class = 'fckeditor';
}
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- global $conf;
-
- $sql = array();
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modFicheinter.class.php b/htdocs/core/modules/modFicheinter.class.php
index b41b291711a..91a672fb669 100644
--- a/htdocs/core/modules/modFicheinter.class.php
+++ b/htdocs/core/modules/modFicheinter.class.php
@@ -175,20 +175,4 @@ class modFicheinter extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php
index d43535dd4e1..0db347f0df2 100644
--- a/htdocs/core/modules/modFournisseur.class.php
+++ b/htdocs/core/modules/modFournisseur.class.php
@@ -564,20 +564,4 @@ class modFournisseur extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modGeoIPMaxmind.class.php b/htdocs/core/modules/modGeoIPMaxmind.class.php
index cfe7acbdfa6..164d89243b8 100644
--- a/htdocs/core/modules/modGeoIPMaxmind.class.php
+++ b/htdocs/core/modules/modGeoIPMaxmind.class.php
@@ -85,35 +85,4 @@ class modGeoIPMaxmind extends DolibarrModules
$this->rights_class = 'geoipmaxmind';
$r=0;
}
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- $sql = array();
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modGravatar.class.php b/htdocs/core/modules/modGravatar.class.php
index aae38ae391b..241cca18dbb 100644
--- a/htdocs/core/modules/modGravatar.class.php
+++ b/htdocs/core/modules/modGravatar.class.php
@@ -183,38 +183,5 @@ class modGravatar extends DolibarrModules
// $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
// $r++;
}
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- $sql = array();
-
- //$result=$this->_load_tables('');
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php
index 91dde16ed08..be075f2d57a 100644
--- a/htdocs/core/modules/modHoliday.class.php
+++ b/htdocs/core/modules/modHoliday.class.php
@@ -278,36 +278,5 @@ class modHoliday extends DolibarrModules
// $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
// $r++;
}
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories.
- *
- * @return int 1 if OK, 0 if KO
- */
- function init()
- {
- $sql = array();
-
- //$result=$this->_load_tables('');
-
- return $this->_init($sql);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted.
- *
- * @return int 1 if OK, 0 if KO
- */
- function remove()
- {
- $sql = array();
-
- return $this->_remove($sql);
- }
-
}
diff --git a/htdocs/core/modules/modImport.class.php b/htdocs/core/modules/modImport.class.php
index 3a371ecf2e7..5ac3b8928db 100644
--- a/htdocs/core/modules/modImport.class.php
+++ b/htdocs/core/modules/modImport.class.php
@@ -85,35 +85,4 @@ class modImport extends DolibarrModules
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'run';
}
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- $sql = array();
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modIncoterm.class.php b/htdocs/core/modules/modIncoterm.class.php
index 2ae30951c8c..cae4f9ec28f 100644
--- a/htdocs/core/modules/modIncoterm.class.php
+++ b/htdocs/core/modules/modIncoterm.class.php
@@ -109,34 +109,4 @@ class modIncoterm extends DolibarrModules
$this->menus = array(); // List of menus to add
$r=0;
}
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- $sql = array();
-
- return $this->_init($sql, $options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql, $options);
- }
}
diff --git a/htdocs/core/modules/modLabel.class.php b/htdocs/core/modules/modLabel.class.php
index 9519c63fb95..3292e2269fb 100644
--- a/htdocs/core/modules/modLabel.class.php
+++ b/htdocs/core/modules/modLabel.class.php
@@ -89,7 +89,6 @@ class modLabel extends DolibarrModules
}
-
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
@@ -107,20 +106,4 @@ class modLabel extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modLdap.class.php b/htdocs/core/modules/modLdap.class.php
index f7362ceefdd..cb2ad24fef4 100644
--- a/htdocs/core/modules/modLdap.class.php
+++ b/htdocs/core/modules/modLdap.class.php
@@ -90,35 +90,4 @@ class modLdap extends DolibarrModules
$this->rights = array();
$this->rights_class = 'ldap';
}
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- $sql = array();
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modLoan.class.php b/htdocs/core/modules/modLoan.class.php
index 21ae96eba26..ab2ca7f33c2 100644
--- a/htdocs/core/modules/modLoan.class.php
+++ b/htdocs/core/modules/modLoan.class.php
@@ -162,20 +162,4 @@ class modLoan extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modMailing.class.php b/htdocs/core/modules/modMailing.class.php
index 045f857b574..9930168a218 100644
--- a/htdocs/core/modules/modMailing.class.php
+++ b/htdocs/core/modules/modMailing.class.php
@@ -147,20 +147,4 @@ class modMailing extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modMailmanSpip.class.php b/htdocs/core/modules/modMailmanSpip.class.php
index 1b5bbab61c6..4d96b4e8cd1 100644
--- a/htdocs/core/modules/modMailmanSpip.class.php
+++ b/htdocs/core/modules/modMailmanSpip.class.php
@@ -77,37 +77,4 @@ class modMailmanSpip extends DolibarrModules
$this->rights = array();
$this->rights_class = 'clicktodial';
}
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- global $conf;
-
- $sql = array();
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modMargin.class.php b/htdocs/core/modules/modMargin.class.php
index 1f0a95ea001..65396126585 100644
--- a/htdocs/core/modules/modMargin.class.php
+++ b/htdocs/core/modules/modMargin.class.php
@@ -139,36 +139,5 @@ class modMargin extends DolibarrModules
$this->rights[$r][4] = 'read';
$this->rights[$r][5] = 'all';
}
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories.
- *
- * @return int 1 if OK, 0 if KO
- */
- function init()
- {
- $sql = array();
-
- //$result=$this->_load_tables();
-
- return $this->_init($sql);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted.
- *
- * @return int 1 if OK, 0 if KO
- */
- function remove()
- {
- $sql = array();
-
- return $this->_remove($sql);
- }
-
}
diff --git a/htdocs/core/modules/modNotification.class.php b/htdocs/core/modules/modNotification.class.php
index 78e939f4048..74d7e6dfbcc 100644
--- a/htdocs/core/modules/modNotification.class.php
+++ b/htdocs/core/modules/modNotification.class.php
@@ -90,20 +90,4 @@ class modNotification extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modOpenSurvey.class.php b/htdocs/core/modules/modOpenSurvey.class.php
index 44b9f928694..db93cae5220 100644
--- a/htdocs/core/modules/modOpenSurvey.class.php
+++ b/htdocs/core/modules/modOpenSurvey.class.php
@@ -195,20 +195,5 @@ class modOpenSurvey extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
}
diff --git a/htdocs/core/modules/modPaybox.class.php b/htdocs/core/modules/modPaybox.class.php
index 820bc1d19c1..d77d2dfc3f4 100644
--- a/htdocs/core/modules/modPaybox.class.php
+++ b/htdocs/core/modules/modPaybox.class.php
@@ -172,38 +172,5 @@ class modPayBox extends DolibarrModules
// $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
// $r++;
}
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- $sql = array();
-
- //$result=$this->_load_tables('');
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modPaypal.class.php b/htdocs/core/modules/modPaypal.class.php
index 8c1e0fe4797..227540e825e 100644
--- a/htdocs/core/modules/modPaypal.class.php
+++ b/htdocs/core/modules/modPaypal.class.php
@@ -164,38 +164,5 @@ class modPaypal extends DolibarrModules
// $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
// $r++;
}
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- $sql = array();
-
- //$result=$this->_load_tables('');
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modPrelevement.class.php b/htdocs/core/modules/modPrelevement.class.php
index 7bb5e748037..84bd19712df 100644
--- a/htdocs/core/modules/modPrelevement.class.php
+++ b/htdocs/core/modules/modPrelevement.class.php
@@ -141,20 +141,4 @@ class modPrelevement extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modPrinting.class.php b/htdocs/core/modules/modPrinting.class.php
index bb18d7d022c..e14a2efd63e 100644
--- a/htdocs/core/modules/modPrinting.class.php
+++ b/htdocs/core/modules/modPrinting.class.php
@@ -120,35 +120,4 @@ class modPrinting extends DolibarrModules
}
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- $sql = array();
-
- return $this->_init($sql, $options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql, $options);
- }
-
}
diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php
index 691cfe7d72d..f5e366bc3ad 100644
--- a/htdocs/core/modules/modProduct.class.php
+++ b/htdocs/core/modules/modProduct.class.php
@@ -343,20 +343,4 @@ class modProduct extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modProductBatch.class.php b/htdocs/core/modules/modProductBatch.class.php
index bf77943ea6c..b55dba2945a 100644
--- a/htdocs/core/modules/modProductBatch.class.php
+++ b/htdocs/core/modules/modProductBatch.class.php
@@ -124,21 +124,5 @@ class modProductBatch extends DolibarrModules
return $this->_init($sql, $options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql, $options);
- }
-
}
diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php
index 1174c47d831..ca66e861862 100644
--- a/htdocs/core/modules/modProjet.class.php
+++ b/htdocs/core/modules/modProjet.class.php
@@ -361,20 +361,4 @@ class modProjet extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php
index 6a8dc7254d4..cb297f87a61 100644
--- a/htdocs/core/modules/modPropale.class.php
+++ b/htdocs/core/modules/modPropale.class.php
@@ -231,20 +231,4 @@ class modPropale extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php
index 1f7a92f47b7..94a4b56427a 100644
--- a/htdocs/core/modules/modResource.class.php
+++ b/htdocs/core/modules/modResource.class.php
@@ -360,21 +360,6 @@ class modResource extends DolibarrModules
return $this->_init($sql, $options);
}
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- public function remove($options = '')
- {
- $sql = array();
-
- return $this->_remove($sql, $options);
- }
-
/**
* Create tables, keys and data required by module
* Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
diff --git a/htdocs/core/modules/modSalaries.class.php b/htdocs/core/modules/modSalaries.class.php
index fa8a0ebd811..1708c7a8ed0 100644
--- a/htdocs/core/modules/modSalaries.class.php
+++ b/htdocs/core/modules/modSalaries.class.php
@@ -168,20 +168,4 @@ class modSalaries extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php
index b8040e41c7c..85ab2b03e7d 100644
--- a/htdocs/core/modules/modService.class.php
+++ b/htdocs/core/modules/modService.class.php
@@ -327,20 +327,4 @@ class modService extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modSkype.class.php b/htdocs/core/modules/modSkype.class.php
index f010f3b769e..a55f979db8c 100644
--- a/htdocs/core/modules/modSkype.class.php
+++ b/htdocs/core/modules/modSkype.class.php
@@ -87,39 +87,4 @@ class modSkype extends DolibarrModules
//------------------
$this->menu = array();
}
-
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- $sql = array();
-
- // Prevent pb of modules not correctly disabled
- //$this->remove($options);
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php
index 6de689e792c..1d7848f5f46 100644
--- a/htdocs/core/modules/modSociete.class.php
+++ b/htdocs/core/modules/modSociete.class.php
@@ -505,20 +505,4 @@ class modSociete extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php
index 63613862550..2b8e983372e 100644
--- a/htdocs/core/modules/modStock.class.php
+++ b/htdocs/core/modules/modStock.class.php
@@ -198,35 +198,4 @@ class modStock extends DolibarrModules
);
}
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- $sql = array();
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modSyncSupplierWebServices.class.php b/htdocs/core/modules/modSyncSupplierWebServices.class.php
index 37366270a57..b87d7d9ecd5 100644
--- a/htdocs/core/modules/modSyncSupplierWebServices.class.php
+++ b/htdocs/core/modules/modSyncSupplierWebServices.class.php
@@ -83,39 +83,4 @@ class modSyncSupplierWebServices extends DolibarrModules
$this->rights_class = 'syncsupplierwebservices';
$r=0;
}
-
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- // Prevent pb of modules not correctly disabled
- //$this->remove($options);
-
- $sql = array();
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modSyslog.class.php b/htdocs/core/modules/modSyslog.class.php
index f2b5f80ff32..a635e8f2fdc 100644
--- a/htdocs/core/modules/modSyslog.class.php
+++ b/htdocs/core/modules/modSyslog.class.php
@@ -80,37 +80,4 @@ class modSyslog extends DolibarrModules
$this->rights = array();
$this->rights_class = 'syslog';
}
-
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- $sql = array();
-
- return $this->_init($sql,$options);
-
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modTax.class.php b/htdocs/core/modules/modTax.class.php
index 6f47d66f5a9..9e8ee7908d7 100644
--- a/htdocs/core/modules/modTax.class.php
+++ b/htdocs/core/modules/modTax.class.php
@@ -156,20 +156,4 @@ class modTax extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modUser.class.php b/htdocs/core/modules/modUser.class.php
index 04d4b81039a..41598f51106 100644
--- a/htdocs/core/modules/modUser.class.php
+++ b/htdocs/core/modules/modUser.class.php
@@ -242,20 +242,4 @@ class modUser extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modWebServices.class.php b/htdocs/core/modules/modWebServices.class.php
index 9211d2749d0..a22e5a5be64 100644
--- a/htdocs/core/modules/modWebServices.class.php
+++ b/htdocs/core/modules/modWebServices.class.php
@@ -83,39 +83,4 @@ class modWebServices extends DolibarrModules
$this->rights_class = 'webservices';
$r=0;
}
-
-
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options='')
- {
- // Prevent pb of modules not correctly disabled
- //$this->remove($options);
-
- $sql = array();
-
- return $this->_init($sql,$options);
- }
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/core/modules/modWorkflow.class.php b/htdocs/core/modules/modWorkflow.class.php
index ed0f66e6455..0eb447306b4 100644
--- a/htdocs/core/modules/modWorkflow.class.php
+++ b/htdocs/core/modules/modWorkflow.class.php
@@ -148,20 +148,4 @@ class modWorkflow extends DolibarrModules
return $this->_init($sql,$options);
}
-
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options='')
- {
- $sql = array();
-
- return $this->_remove($sql,$options);
- }
-
}
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index e36040743ad..04f5628a224 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -417,22 +417,22 @@ class ExpenseReport extends CommonObject
global $langs;
if ($mode == 0)
- return $langs->trans($this->statuts[$status]);
+ return $langs->transnoentities($this->statuts[$status]);
if ($mode == 1)
- return $langs->trans($this->statuts_short[$status]);
+ return $langs->transnoentities($this->statuts_short[$status]);
if ($mode == 2)
- return img_picto($langs->trans($this->statuts_short[$status]), $this->statuts_logo[$status]).' '.$langs->trans($this->statuts_short[$status]);
+ return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]).' '.$langs->transnoentities($this->statuts_short[$status]);
if ($mode == 3)
- return img_picto($langs->trans($this->statuts_short[$status]), $this->statuts_logo[$status]);
+ return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]);
if ($mode == 4)
- return img_picto($langs->trans($this->statuts_short[$status]),$this->statuts_logo[$status]).' '.$langs->trans($this->statuts[$status]);
+ return img_picto($langs->transnoentities($this->statuts_short[$status]),$this->statuts_logo[$status]).' '.$langs->transnoentities($this->statuts[$status]);
if ($mode == 5)
- return ''.$langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),$this->statuts_logo[$status]);
+ return ''.$langs->transnoentities($this->statuts_short[$status]).' '.img_picto($langs->transnoentities($this->statuts_short[$status]),$this->statuts_logo[$status]);
}
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index b623c7daa1f..1bf286ff5aa 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -1283,82 +1283,44 @@ class FactureFournisseur extends CommonInvoice
$product_type = $type;
}
- $this->db->begin();
+ $line = new SupplierInvoiceLine($this->db);
- $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET";
- $sql.= " description ='".$this->db->escape($desc)."'";
- $sql.= ", pu_ht = ".price2num($pu_ht);
- $sql.= ", pu_ttc = ".price2num($pu_ttc);
- $sql.= ", qty = ".price2num($qty);
- $sql.= ", remise_percent = ".price2num($remise_percent);
- $sql.= ", tva_tx = ".price2num($vatrate);
- $sql.= ", localtax1_tx = ".price2num($txlocaltax1);
- $sql.= ", localtax2_tx = ".price2num($txlocaltax2);
- $sql.= ", localtax1_type = '".$localtaxes_type[0]."'";
- $sql.= ", localtax2_type = '".$localtaxes_type[2]."'";
- $sql.= ", total_ht = ".price2num($total_ht);
- $sql.= ", tva= ".price2num($total_tva);
- $sql.= ", total_localtax1= ".price2num($total_localtax1);
- $sql.= ", total_localtax2= ".price2num($total_localtax2);
- $sql.= ", total_ttc = ".price2num($total_ttc);
- if ($idproduct) $sql.= ", fk_product = ".$idproduct;
- else $sql.= ", fk_product = null";
- $sql.= ", product_type = ".$product_type;
- $sql.= ", info_bits = ".$info_bits;
- $sql.= ", fk_unit = ".($fk_unit ? "'".$this->db->escape($fk_unit)."'":"null");
- $sql.= " WHERE rowid = ".$id;
+ if ($line->fetch($id) < 1) {
+ return -1;
+ }
- dol_syslog(get_class($this)."::updateline", LOG_DEBUG);
- $resql=$this->db->query($sql);
- if ($resql)
- {
- $this->rowid = $id;
+ $line->description = $desc;
+ $line->subprice = $pu_ht;
+ $line->pu_ht = $pu_ht;
+ $line->pu_ttc = $pu_ttc;
+ $line->qty = $qty;
+ $line->remise_percent = $remise_percent;
+ $line->tva_tx = $vatrate;
+ $line->localtax1_tx = $txlocaltax1;
+ $line->localtax2_tx = $txlocaltax2;
+ $line->localtax1_type = $localtaxes_type[0];
+ $line->localtax2_type = $localtaxes_type[2];
+ $line->total_ht = $total_ht;
+ $line->total_tva = $total_tva;
+ $line->total_localtax1 = $total_localtax1;
+ $line->total_localtax2 = $total_localtax2;
+ $line->total_ttc = $total_ttc;
+ $line->fk_product = $idproduct;
+ $line->product_type = $product_type;
+ $line->info_bits = $info_bits;
+ $line->fk_unit = $fk_unit;
+ $line->array_options = $array_options;
- if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
- {
- $linetmp = new SupplierInvoiceLine($this->db);
- $linetmp->id=$this->rowid;
- $linetmp->array_options = $array_options;
- $result=$linetmp->insertExtraFields();
- if ($result < 0)
- {
- $error++;
- }
- }
+ $res = $line->update($notrigger);
- if (! $error && ! $notrigger)
- {
- global $conf, $langs, $user;
- // Call trigger
- $result=$this->call_trigger('LINEBILL_SUPPLIER_UPDATE',$user);
- if ($result < 0)
- {
- $this->db->rollback();
- return -1;
- }
- // End call triggers
- }
+ if ($res < 1) {
+ $this->errors[] = $line->error;
+ } else {
+ // Update total price into invoice record
+ $res = $this->update_price('','auto');
+ }
- // Update total price into invoice record
- $result=$this->update_price('','auto');
-
- if (! $error)
- {
- $this->db->commit();
- return $result;
- }
- else
- {
- $this->db->rollback();
- return -1;
- }
- }
- else
- {
- $this->db->rollback();
- $this->error=$this->db->lasterror();
- return -1;
- }
+ return $res;
}
/**
@@ -1972,6 +1934,8 @@ class SupplierInvoiceLine extends CommonObjectLine
public $fk_parent_line;
public $special_code;
public $rang;
+ public $localtax1_type;
+ public $localtax2_type;
/**
@@ -1993,12 +1957,12 @@ class SupplierInvoiceLine extends CommonObjectLine
public function fetch($rowid)
{
$sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx';
- $sql.= ', f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 ';
+ $sql.= ', f.localtax1_type, f.localtax2_type, f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 ';
$sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit';
$sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid';
- $sql.= ' WHERE rowid = '.$rowid;
+ $sql.= ' WHERE f.rowid = '.$rowid;
$sql.= ' ORDER BY f.rang, f.rowid';
$query = $this->db->query($sql);
@@ -2029,6 +1993,8 @@ class SupplierInvoiceLine extends CommonObjectLine
$this->tva_tx = $obj->tva_tx;
$this->localtax1_tx = $obj->localtax1_tx;
$this->localtax2_tx = $obj->localtax2_tx;
+ $this->localtax1_type = $obj->localtax1_type;
+ $this->localtax2_type = $obj->localtax2_type;
$this->qty = $obj->qty;
$this->remise_percent = $obj->remise_percent;
$this->tva = $obj->total_tva;
@@ -2095,5 +2061,113 @@ class SupplierInvoiceLine extends CommonObjectLine
}
}
+ /**
+ * Update a supplier invoice line
+ *
+ * @param int $notrigger Disable triggers
+ * @return int <0 if KO, >0 if OK
+ */
+ public function update($notrigger = 0)
+ {
+ global $conf;
+
+ $pu = price2num($this->pu_ht);
+ $qty = price2num($this->qty);
+
+ // Check parameters
+ if (! is_numeric($pu) || ! is_numeric($qty)) {
+ return -1;
+ }
+
+ if ($this->product_type < 0) {
+ return -1;
+ }
+
+ // Clean parameters
+ if (empty($this->tva_tx)) {
+ $this->tva_tx = 0;
+ }
+ if (empty($this->localtax1_tx)) {
+ $this->localtax1_tx = 0;
+ }
+ if (empty($this->localtax2_tx)) {
+ $this->localtax2_tx = 0;
+ }
+
+ $this->db->begin();
+
+ if ($this->fk_product) {
+ $fk_product = "null";
+ } else {
+ $fk_product = $this->fk_product;
+ }
+
+ if ($this->fk_unit) {
+ $fk_unit = "'".$this->db->escape($this->fk_unit)."'";
+ } else {
+ $fk_unit = "null";
+ }
+
+ $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET";
+ $sql.= " description ='".$this->db->escape($this->description)."'";
+ $sql.= ", pu_ht = ".price2num($this->pu_ht);
+ $sql.= ", pu_ttc = ".price2num($this->pu_ttc);
+ $sql.= ", qty = ".price2num($this->qty);
+ $sql.= ", remise_percent = ".price2num($this->remise_percent);
+ $sql.= ", tva_tx = ".price2num($this->tva_tx);
+ $sql.= ", localtax1_tx = ".price2num($this->localtax1_tx);
+ $sql.= ", localtax2_tx = ".price2num($this->localtax2_tx);
+ $sql.= ", localtax1_type = '".$this->localtax1_type."'";
+ $sql.= ", localtax2_type = '".$this->localtax2_type."'";
+ $sql.= ", total_ht = ".price2num($this->total_ht);
+ $sql.= ", tva= ".price2num($this->total_tva);
+ $sql.= ", total_localtax1= ".price2num($this->total_localtax1);
+ $sql.= ", total_localtax2= ".price2num($this->total_localtax2);
+ $sql.= ", total_ttc = ".price2num($this->total_ttc);
+ $sql.= ", fk_product = ".$fk_product;
+ $sql.= ", product_type = ".$this->product_type;
+ $sql.= ", info_bits = ".$this->info_bits;
+ $sql.= ", fk_unit = ".$fk_unit;
+ $sql.= " WHERE rowid = ".$this->id;
+
+ dol_syslog(get_class($this)."::update", LOG_DEBUG);
+ $resql = $this->db->query($sql);
+
+ if (!$resql) {
+ $this->db->rollback();
+ $this->error = $this->db->lasterror();
+ return -1;
+ }
+
+ $this->rowid = $this->id;
+ $error = 0;
+
+ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
+ {
+ if ($this->insertExtraFields() < 0) {
+ $error++;
+ }
+ }
+
+ if (! $error && ! $notrigger)
+ {
+ global $langs, $user;
+
+ // Call trigger
+ if ($this->call_trigger('LINEBILL_SUPPLIER_UPDATE',$user) < 0) {
+ $this->db->rollback();
+ return -1;
+ }
+ // End call triggers
+ }
+
+ if ($error) {
+ $this->db->rollback();
+ return -1;
+ }
+
+ $this->db->commit();
+ return 1;
+ }
}
diff --git a/htdocs/install/check.php b/htdocs/install/check.php
index 4149691302e..0b9b08f3b68 100644
--- a/htdocs/install/check.php
+++ b/htdocs/install/check.php
@@ -5,6 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2013-2014 Juanjo Menent
* Copyright (C) 2014 Marcos García
+ * Copyright (C) 2015 Raphaël Doursenaud
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -43,8 +44,7 @@ $forcedfile="./install.forced.php";
if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php";
if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once $forcedfile; }
-dolibarr_install_syslog("Dolibarr install/upgrade process started");
-
+dolibarr_install_syslog("--- check: Dolibarr install/upgrade process started");
/*
@@ -167,11 +167,11 @@ if ($memmaxorig != '')
}
-// If config file presente and filled
+// If config file present and filled
clearstatcache();
if (is_readable($conffile) && filesize($conffile) > 8)
{
- dolibarr_install_syslog("conf file '$conffile' already defined");
+ dolibarr_install_syslog("check: conf file '" . $conffile . "' already defined");
$confexists=1;
include_once $conffile;
@@ -189,19 +189,19 @@ if (is_readable($conffile) && filesize($conffile) > 8)
else
{
// If not, we create it
- dolibarr_install_syslog("we try to create conf file '$conffile'");
+ dolibarr_install_syslog("check: we try to create conf file '" . $conffile . "'");
$confexists=0;
// First we try by copying example
if (@copy($conffile.".example", $conffile))
{
// Success
- dolibarr_install_syslog("copied file ".$conffile.".example into ".$conffile." done successfully.");
+ dolibarr_install_syslog("check: successfully copied file " . $conffile . ".example into " . $conffile);
}
else
{
// If failed, we try to create an empty file
- dolibarr_install_syslog("failed to copy file ".$conffile.".example into ".$conffile.". We try to create it.", LOG_WARNING);
+ dolibarr_install_syslog("check: failed to copy file " . $conffile . ".example into " . $conffile . ". We try to create it.", LOG_WARNING);
$fp = @fopen($conffile, "w");
if ($fp)
@@ -210,7 +210,7 @@ else
@fputs($fp,"\n");
fclose($fp);
}
- else dolibarr_install_syslog("failed to create a new file ".$conffile." into current dir ".getcwd().". Check permission.", LOG_ERR);
+ else dolibarr_install_syslog("check: failed to create a new file " . $conffile . " into current dir " . getcwd() . ". Please check permissions.", LOG_ERR);
}
// First install, we can't upgrade
@@ -282,7 +282,7 @@ else
if (! file_exists($dolibarr_main_document_root."/core/lib/admin.lib.php"))
{
print 'A '.$conffiletoshow.' file exists with a dolibarr_main_document_root to '.$dolibarr_main_document_root.' that seems wrong. Try to fix or remove the '.$conffiletoshow.' file. '."\n";
- dol_syslog("A '.$conffiletoshow.' file exists with a dolibarr_main_document_root to ".$dolibarr_main_document_root." that seems wrong. Try to fix or remove the '.$conffiletoshow.' file.", LOG_WARNING);
+ dol_syslog("A '" . $conffiletoshow . "' file exists with a dolibarr_main_document_root to " . $dolibarr_main_document_root . " that seems wrong. Try to fix or remove the '" . $conffiletoshow . "' file.", LOG_WARNING);
}
else
{
@@ -531,5 +531,6 @@ $(".runupgrade").click(function() {
';
+dolibarr_install_syslog("--- check: end");
pFooter(true); // Never display next button
diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php
index 04f8a3caf4c..92d2fc963a8 100644
--- a/htdocs/install/fileconf.php
+++ b/htdocs/install/fileconf.php
@@ -36,7 +36,7 @@ $langs->setDefaultLang($setuplang);
$langs->load("install");
$langs->load("errors");
-dolibarr_install_syslog("Fileconf: Entering fileconf.php page");
+dolibarr_install_syslog("--- fileconf: entering fileconf.php page");
// You can force preselected values of the config step of Dolibarr by adding a file
// install.forced.php into directory htdocs/install (This is the case with some wizard
@@ -71,12 +71,14 @@ if (@file_exists($forcedfile)) {
session_start(); // To be able to keep info into session (used for not loosing pass during navigation. pass must not transit throug parmaeters)
-pHeader($langs->trans("ConfigurationFile"),"etape1","set","",(empty($force_dolibarr_js_JQUERY)?'':$force_dolibarr_js_JQUERY.'/'));
+pHeader($langs->trans("ConfigurationFile"),"step1","set","",(empty($force_dolibarr_js_JQUERY)?'':$force_dolibarr_js_JQUERY.'/'));
// Test if we can run a first install process
if (! is_writable($conffile))
{
- print $langs->trans("ConfFileIsNotWritable",$conffiletoshow);
+ print $langs->trans("ConfFileIsNotWritable", $conffiletoshow);
+ dolibarr_install_syslog("fileconf: config file is not writable", LOG_WARNING);
+ dolibarr_install_syslog("--- fileconf: end");
pFooter(1,$setuplang,'jscheckparam');
exit;
}
@@ -584,4 +586,5 @@ function jscheckparam()
// $db->close(); Not database connexion yet
+dolibarr_install_syslog("--- fileconf: end");
pFooter($err,$setuplang,'jscheckparam');
diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php
index bac0ffe6eda..36d12421055 100644
--- a/htdocs/install/inc.php
+++ b/htdocs/install/inc.php
@@ -375,13 +375,13 @@ function pHeader($subtitle,$next,$action='set',$param='',$forcejqueryurl='')
print ''."\n";
if ($jQueryUiCustomPath) print ''."\n"; // JQuery
- else print ''."\n"; // JQuery
+ else print ''."\n"; // JQuery
print ''."\n";
if ($jQueryCustomPath) print ''."\n";
- else print ''."\n";
+ else print ''."\n";
if ($jQueryUiCustomPath) print ''."\n";
- else print ''."\n";
+ else print ''."\n";
print ''.$langs->trans("DolibarrSetup").''."\n";
print ''."\n";
diff --git a/htdocs/install/index.php b/htdocs/install/index.php
index 4508a266b08..9b0ac71931b 100644
--- a/htdocs/install/index.php
+++ b/htdocs/install/index.php
@@ -28,8 +28,7 @@ include_once '../core/class/html.formadmin.class.php';
$err = 0;
-// Si fichier conf existe deja et rempli, on est pas sur une premiere install,
-// on ne passe donc pas par la page de choix de langue
+// If the config file exists and is filled, we're not on first install so we skip the language selection page
if (file_exists($conffile) && isset($dolibarr_main_url_root))
{
header("Location: check.php?testget=ok");
@@ -45,7 +44,7 @@ $langs->load("admin");
$formadmin=new FormAdmin(''); // Note: $db does not exist yet but we don't need it, so we put ''.
-pHeader("", "check"); // Etape suivante = check
+pHeader("", "check"); // Next step = check
// Ask installation language
@@ -62,6 +61,6 @@ print '
';
print '
'.$langs->trans("SomeTranslationAreUncomplete");
-// Si pas d'erreur, on affiche le bouton pour passer a l'etape suivante
+// If there's no error, we display the next step button
if ($err == 0) pFooter(0);
diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php
index 786a8efb430..c8a77e9d8e7 100644
--- a/htdocs/install/repair.php
+++ b/htdocs/install/repair.php
@@ -2,6 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville
* Copyright (C) 2004-2012 Laurent Destailleur
* Copyright (C) 2005-2012 Regis Houssin
+ * Copyright (C) 2015 Raphaël Doursenaud
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,7 +19,7 @@
*/
/**
- * \file htdocs/install/repair.php
+ * \file htdocs/install/repair.php
* \brief Run repair script
*/
@@ -29,7 +30,7 @@ require_once $dolibarr_main_document_root.'/core/class/extrafields.class.php';
require_once 'lib/repair.lib.php';
$grant_query='';
-$etape = 2;
+$step = 2;
$ok = 0;
@@ -54,8 +55,8 @@ if ($dolibarr_main_db_type == "pgsql") $choix=2;
if ($dolibarr_main_db_type == "mssql") $choix=3;
-dolibarr_install_syslog("repair: Entering upgrade.php page");
-if (! is_object($conf)) dolibarr_install_syslog("repair: conf file not initialized",LOG_ERR);
+dolibarr_install_syslog("--- repair: entering upgrade.php page");
+if (! is_object($conf)) dolibarr_install_syslog("repair: conf file not initialized", LOG_ERR);
/*
@@ -105,13 +106,13 @@ if ($db->connected)
{
print '
';
print $langs->trans("UserCreation").' : ';
print $dolibarr_main_db_user;
@@ -569,7 +571,7 @@ if (! $error && $db->connected && $action == "set")
// If database creation is asked, we create it
if (! $error && (isset($_POST["db_create_database"]) && $_POST["db_create_database"] == "on"))
{
- dolibarr_install_syslog("etape1: Create database : ".$dolibarr_main_db_name." ".$dolibarr_main_db_character_set." ".$dolibarr_main_db_collation." ".$dolibarr_main_db_user, LOG_DEBUG);
+ dolibarr_install_syslog("step1: create database: " . $dolibarr_main_db_name . " " . $dolibarr_main_db_character_set . " " . $dolibarr_main_db_collation . " " . $dolibarr_main_db_user);
$newdb=getDoliDBInstance($conf->db->type,$conf->db->host,$userroot,$passroot,'',$conf->db->port);
//print 'eee'.$conf->db->type." ".$conf->db->host." ".$userroot." ".$passroot." ".$conf->db->port." ".$newdb->connected." ".$newdb->forcecharset;exit;
@@ -587,11 +589,11 @@ if (! $error && $db->connected && $action == "set")
$check1=$newdb->getDefaultCharacterSetDatabase();
$check2=$newdb->getDefaultCollationDatabase();
- dolibarr_install_syslog('etape1: Note that default server was charset='.$check1.' collation='.$check2, LOG_DEBUG);
+ dolibarr_install_syslog('step1: note that default server was charset=' . $check1 . ' collation=' . $check2);
// If values differs, we save conf file again
- //if ($check1 != $dolibarr_main_db_character_set) dolibarr_install_syslog('etape1: Value for character_set is not the one asked for database creation', LOG_WARNING);
- //if ($check2 != $dolibarr_main_db_collation) dolibarr_install_syslog('etape1: Value for collation is not the one asked for database creation', LOG_WARNING);
+ //if ($check1 != $dolibarr_main_db_character_set) dolibarr_install_syslog('step1: value for character_set is not the one asked for database creation', LOG_WARNING);
+ //if ($check2 != $dolibarr_main_db_collation) dolibarr_install_syslog('step1: value for collation is not the one asked for database creation', LOG_WARNING);
}
else
{
@@ -603,7 +605,7 @@ if (! $error && $db->connected && $action == "set")
print ' ';
print '
';
- dolibarr_install_syslog('etape1: Failed to create database '.$dolibarr_main_db_name.' '.$newdb->lasterrno().' '.$newdb->lasterror(), LOG_ERR);
+ dolibarr_install_syslog('step1: failed to create database ' . $dolibarr_main_db_name . ' ' . $newdb->lasterrno() . ' ' . $newdb->lasterror(), LOG_ERR);
$error++;
}
$newdb->close();
@@ -632,14 +634,14 @@ if (! $error && $db->connected && $action == "set")
// We test access with dolibarr database user (not admin)
if (! $error)
{
- dolibarr_install_syslog("etape1: connexion de type=".$conf->db->type." sur host=".$conf->db->host." port=".$conf->db->port." user=".$conf->db->user." name=".$conf->db->name, LOG_DEBUG);
+ dolibarr_install_syslog("step1: connection type=" . $conf->db->type . " on host=" . $conf->db->host . " port=" . $conf->db->port . " user=" . $conf->db->user . " name=" . $conf->db->name);
//print "connexion de type=".$conf->db->type." sur host=".$conf->db->host." port=".$conf->db->port." user=".$conf->db->user." name=".$conf->db->name;
$db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port);
if ($db->connected)
{
- dolibarr_install_syslog("etape1: connexion to server by user ".$conf->db->user." is ok", LOG_DEBUG);
+ dolibarr_install_syslog("step1: connection to server by user " . $conf->db->user . " ok");
print "
";
print $langs->trans("ServerConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
print $dolibarr_main_db_host;
@@ -650,7 +652,7 @@ if (! $error && $db->connected && $action == "set")
// si acces serveur ok et acces base ok, tout est ok, on ne va pas plus loin, on a meme pas utilise le compte root.
if ($db->database_selected)
{
- dolibarr_install_syslog("etape1: connexion to database : ".$conf->db->name.", by user : ".$conf->db->user." is ok", LOG_DEBUG);
+ dolibarr_install_syslog("step1: connection to database " . $conf->db->name . " by user " . $conf->db->user . " ok");
print "
";
print $langs->trans("DatabaseConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
print $dolibarr_main_db_name;
@@ -662,7 +664,7 @@ if (! $error && $db->connected && $action == "set")
}
else
{
- dolibarr_install_syslog("etape1: connexion to database ".$conf->db->name.", by user : ".$conf->db->user." has failed", LOG_ERR);
+ dolibarr_install_syslog("step1: connection to database " . $conf->db->name . " by user " . $conf->db->user . " failed", LOG_ERR);
print "
";
print $langs->trans("DatabaseConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
print $dolibarr_main_db_name;
@@ -682,7 +684,7 @@ if (! $error && $db->connected && $action == "set")
}
else
{
- dolibarr_install_syslog("etape1: la connexion au serveur par le user ".$conf->db->user." est rate");
+ dolibarr_install_syslog("step1: connection to server by user " . $conf->db->user . " failed", LOG_ERR);
print "
";
print $langs->trans("ServerConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
print $dolibarr_main_db_host;
@@ -723,7 +725,7 @@ function jsinfo()
');
fclose($fp);
}
}
@@ -766,7 +767,6 @@ function write_master_file($masterfile,$main_dir)
fputs($fp, '');
fclose($fp);
}
}
@@ -928,7 +928,6 @@ function write_conf_file($conffile)
fputs($fp, '$dolibarr_font_DOL_DEFAULT_TTF_BOLD=\''.$force_dolibarr_font_DOL_DEFAULT_TTF_BOLD.'\';');
fputs($fp,"\n");
- fputs($fp, '?>');
fclose($fp);
if (file_exists("$conffile"))
diff --git a/htdocs/install/etape2.php b/htdocs/install/step2.php
similarity index 91%
rename from htdocs/install/etape2.php
rename to htdocs/install/step2.php
index 8de44812222..8f27aa53767 100644
--- a/htdocs/install/etape2.php
+++ b/htdocs/install/step2.php
@@ -1,7 +1,8 @@
* Copyright (C) 2004-2010 Laurent Destailleur
- * Copyright (C) 2015 Cedric GROSS
+ * Copyright (C) 2015 Cedric GROSS
+ * Copyright (C) 2015 Raphaël Doursenaud
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,8 +19,8 @@
*/
/**
- * \file htdocs/install/etape2.php
- * \ingroup install
+ * \file htdocs/install/step2.php
+ * \ingroup install
* \brief Create tables, primary keys, foreign keys, indexes and functions into database and then load reference data
*/
@@ -27,7 +28,7 @@ include 'inc.php';
require_once $dolibarr_main_document_root.'/core/class/conf.class.php';
require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php';
-$etape = 2;
+$step = 2;
$ok = 0;
@@ -54,7 +55,7 @@ if ($dolibarr_main_db_type == "mssql") $choix=3;
if ($dolibarr_main_db_type == "sqlite") $choix=4;
if ($dolibarr_main_db_type == "sqlite3") $choix=5;
-//if (empty($choix)) dol_print_error('','Database type '.$dolibarr_main_db_type.' not supported into etape2.php page');
+//if (empty($choix)) dol_print_error('','Database type '.$dolibarr_main_db_type.' not supported into step2.php page');
// Now we load forced value from install.forced.php file.
$useforcedwizard=false;
@@ -62,14 +63,14 @@ $forcedfile="./install.forced.php";
if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php";
if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once $forcedfile; }
-dolibarr_install_syslog("--- etape2: Entering etape2.php page");
+dolibarr_install_syslog("--- step2: entering step2.php page");
/*
* View
*/
-pHeader($langs->trans("CreateDatabaseObjects"),"etape4");
+pHeader($langs->trans("CreateDatabaseObjects"),"step4");
// Test if we can run a first install process
if (! is_writable($conffile))
@@ -103,11 +104,11 @@ if ($action == "set")
{
if($db->database_selected)
{
- dolibarr_install_syslog("etape2: Connexion successful to database : ".$conf->db->name);
+ dolibarr_install_syslog("step2: successful connection to database: " . $conf->db->name);
}
else
{
- dolibarr_install_syslog("etape2: Connexion failed to database : ".$conf->db->name);
+ dolibarr_install_syslog("step2: failed connection to database :" . $conf->db->name, LOG_ERR);
print "
Failed to select database ".$conf->db->name.'
';
$ok = 0 ;
}
@@ -131,7 +132,7 @@ if ($action == "set")
$requestnb=0;
// To disable some code, so you can call step2 with url like
- // http://localhost/dolibarrnew/install/etape2.php?action=set&createtables=0&createkeys=0&createfunctions=0&createdata=llx_20_c_departements
+ // http://localhost/dolibarrnew/install/step2.php?action=set&createtables=0&createkeys=0&createfunctions=0&createdata=llx_20_c_departements
$createtables=isset($_GET['createtables'])?GETPOST('createtables'):1;
$createkeys=isset($_GET['createkeys'])?GETPOST('createkeys'):1;
$createfunctions=isset($_GET['createfunctions'])?GETPOST('createfunction'):1;
@@ -155,7 +156,7 @@ if ($action == "set")
$ok = 0;
$handle=opendir($dir);
- dolibarr_install_syslog("Open tables directory ".$dir." handle=".$handle,LOG_DEBUG);
+ dolibarr_install_syslog("step2: open tables directory " . $dir . " handle=" . $handle);
$tablefound = 0;
$tabledata=array();
if (is_resource($handle))
@@ -211,7 +212,7 @@ if ($action == "set")
//print "
Creation de la table $name/td>";
$requestnb++;
- dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG);
+ dolibarr_install_syslog("step2: request: " . $buffer);
$resql=$db->query($buffer,0,'dml');
if ($resql)
{
@@ -241,7 +242,7 @@ if ($action == "set")
print "
";
print '
'.$langs->trans("Error").' Failed to open file '.$dir.$file.'
';
$error++;
- dolibarr_install_syslog("Failed to open file ".$dir.$file,LOG_ERR);
+ dolibarr_install_syslog("step2: failed to open file " . $dir . $file, LOG_ERR);
}
}
@@ -257,7 +258,7 @@ if ($action == "set")
else
{
print '