Fix: Checkstyle

This commit is contained in:
Laurent Destailleur 2012-07-23 10:46:09 +02:00
parent f07c416f76
commit ea93e62e91
4 changed files with 65 additions and 53 deletions

View File

@ -303,6 +303,8 @@ class Propal extends CommonObject
* @param int $rang Position of line * @param int $rang Position of line
* @param int $special_code Special code * @param int $special_code Special code
* @param int $fk_parent_line Id of parent line * @param int $fk_parent_line Id of parent line
* @param int $fk_fournprice Id supplier price
* @param int $pa_ht Buying price without tax
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
* *
* @see add_product * @see add_product
@ -456,13 +458,15 @@ class Propal extends CommonObject
* @param int $special_code Set special code ('' = we don't change it) * @param int $special_code Set special code ('' = we don't change it)
* @param int $fk_parent_line Id of line parent * @param int $fk_parent_line Id of line parent
* @param int $skip_update_total Skip update total * @param int $skip_update_total Skip update total
* @param int $fk_fournprice Id supplier price
* @param int $pa_ht Buying price without tax
* @return int 0 if OK, <0 if KO * @return int 0 if OK, <0 if KO
*/ */
function updateline($rowid, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht = 0) function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0)
{ {
global $conf,$user,$langs; global $conf,$user,$langs;
dol_syslog("Propal::UpdateLine $rowid, $pu, $qty, $remise_percent, $txtva, $desc, $price_base_type, $info_bits"); dol_syslog(get_class($this)."::updateLine $rowid, $pu, $qty, $remise_percent, $txtva, $desc, $price_base_type, $info_bits");
include_once(DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'); include_once(DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php');
// Clean parameters // Clean parameters
@ -750,8 +754,8 @@ class Propal extends CommonObject
$this->lines[$i]->rang, $this->lines[$i]->rang,
$this->lines[$i]->special_code, $this->lines[$i]->special_code,
$fk_parent_line, $fk_parent_line,
$this->lines[$i]->fk_fournprice, $this->lines[$i]->fk_fournprice,
$this->lines[$i]->pa_ht $this->lines[$i]->pa_ht
); );
if ($result < 0) if ($result < 0)

View File

@ -697,8 +697,8 @@ class Commande extends CommonOrder
$this->lines[$i]->rang, $this->lines[$i]->rang,
$this->lines[$i]->special_code, $this->lines[$i]->special_code,
$fk_parent_line, $fk_parent_line,
$this->lines[$i]->fk_fournprice, $this->lines[$i]->fk_fournprice,
$this->lines[$i]->pa_ht $this->lines[$i]->pa_ht
); );
if ($result < 0) if ($result < 0)
{ {
@ -996,6 +996,8 @@ class Commande extends CommonOrder
* @param int $rang Position of line * @param int $rang Position of line
* @param int $special_code Special code * @param int $special_code Special code
* @param int $fk_parent_line Parent line * @param int $fk_parent_line Parent line
* @param int $fk_fournprice Id supplier price
* @param int $pa_ht Buying price (without tax)
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
* *
* @see add_product * @see add_product
@ -1005,7 +1007,7 @@ class Commande extends CommonOrder
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit) * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit)
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
*/ */
function addline($commandeid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht = 0) function addline($commandeid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0)
{ {
dol_syslog("Commande::addline commandeid=$commandeid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type", LOG_DEBUG); dol_syslog("Commande::addline commandeid=$commandeid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type", LOG_DEBUG);
@ -2151,9 +2153,11 @@ class Commande extends CommonOrder
* @param int $type Type of line (0=product, 1=service) * @param int $type Type of line (0=product, 1=service)
* @param int $fk_parent_line Parent line id * @param int $fk_parent_line Parent line id
* @param int $skip_update_total Skip update of total * @param int $skip_update_total Skip update of total
* @param int $fk_fournprice Id supplier price
* @param int $pa_ht Buying price (without tax)
* @return int < 0 if KO, > 0 if OK * @return int < 0 if KO, > 0 if OK
*/ */
function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht = 0) function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0)
{ {
global $conf; global $conf;

View File

@ -21,17 +21,17 @@
* \file /marges/lib/commissions.lib.php * \file /marges/lib/commissions.lib.php
* \ingroup marges * \ingroup marges
* \brief Library for common commissions functions * \brief Library for common commissions functions
* \version $Id:$
*/ */
/** /**
* Define head array for tabs of marges tools setup pages * Define head array for tabs of marges tools setup pages
*
* @return Array of head * @return Array of head
*/ */
function commissions_admin_prepare_head() function commissions_admin_prepare_head()
{ {
global $langs, $conf; global $langs, $conf;
$h = 0; $h = 0;
$head = array(); $head = array();
@ -39,7 +39,7 @@ function commissions_admin_prepare_head()
$head[$h][1] = $langs->trans("Parameters"); $head[$h][1] = $langs->trans("Parameters");
$head[$h][2] = 'parameters'; $head[$h][2] = 'parameters';
$h++; $h++;
// Show more tabs from modules // Show more tabs from modules
// Entries must be declared in modules descriptor with line // Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab

View File

@ -36,67 +36,68 @@ include_once(DOL_DOCUMENT_ROOT ."/core/modules/DolibarrModules.class.php");
class modCommissions extends DolibarrModules class modCommissions extends DolibarrModules
{ {
/** /**
* \brief Constructor. Define names, constants, directories, boxes, permissions * Constructor. Define names, constants, directories, boxes, permissions
* \param DB Database handler *
*/ * @param DoliDB $db Database handler
function modCommissions($DB) */
function modCommissions($db)
{ {
$this->db = $DB; $this->db = $db;
// Id for module (must be unique). // Id for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
$this->numero = 60000; $this->numero = 60000;
// Key text used to identify module (for permissions, menus, etc...) // Key text used to identify module (for permissions, menus, etc...)
$this->rights_class = 'Commissions'; $this->rights_class = 'Commissions';
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page // It is used to group modules in module setup page
$this->family = "financial"; $this->family = "financial";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = mb_ereg_replace('^mod','',get_class($this), "i"); $this->name = mb_ereg_replace('^mod','',get_class($this), "i");
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
$this->description = "Gestion des commissions"; $this->description = "Gestion des commissions";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = '1.0'; $this->version = '1.0';
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Where to store the module in setup page (0=common,1=interface,2=other) // Where to store the module in setup page (0=common,1=interface,2=other)
$this->special = 0; $this->special = 0;
// Name of png file (without png) used for this module. // Name of png file (without png) used for this module.
// Png file must be in theme/yourtheme/img directory under name object_pictovalue.png. // Png file must be in theme/yourtheme/img directory under name object_pictovalue.png.
$this->picto='commissions@commissions'; $this->picto='commissions@commissions';
// Data directories to create when module is enabled. // Data directories to create when module is enabled.
$this->dirs = array(); $this->dirs = array();
//$this->dirs[0] = DOL_DATA_ROOT.'/Marges'; //$this->dirs[0] = DOL_DATA_ROOT.'/Marges';
//$this->dirs[1] = DOL_DATA_ROOT.'/mymodule/temp; //$this->dirs[1] = DOL_DATA_ROOT.'/mymodule/temp;
// Relative path to module style sheet if exists. Example: '/mymodule/mycss.css'. // Relative path to module style sheet if exists. Example: '/mymodule/mycss.css'.
$this->style_sheet = '/commissions/css/commissions.css'; $this->style_sheet = '/commissions/css/commissions.css';
// Config pages. Put here list of php page names stored in admmin directory used to setup module. // Config pages. Put here list of php page names stored in admmin directory used to setup module.
$this->config_page_url = array("commissions.php"); $this->config_page_url = array("commissions.php");
// Dependencies // Dependencies
$this->depends = array("modFacture", "modMarges"); // List of modules id that must be enabled if this module is enabled $this->depends = array("modFacture", "modMarges"); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled $this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->phpmin = array(4,1); // Minimum version of PHP required by module $this->phpmin = array(4,1); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(3,1); // Minimum version of Dolibarr required by module $this->need_dolibarr_version = array(3,1); // Minimum version of Dolibarr required by module
$this->langfiles = array("commissions"); $this->langfiles = array("commissions");
// Constants // Constants
$this->const = array(); // List of particular constants to add when module is enabled $this->const = array(); // List of particular constants to add when module is enabled
//$this->const = array( 0=>array('MAIN_MODULE_MARGES_HOOKS', 'chaine', 'propalcard', 'Hooks list for displaying Marges data on entity lists', 0, 'current', 1) ); //$this->const = array( 0=>array('MAIN_MODULE_MARGES_HOOKS', 'chaine', 'propalcard', 'Hooks list for displaying Marges data on entity lists', 0, 'current', 1) );
// New pages on tabs // New pages on tabs
$this->tabs = array( $this->tabs = array(
); );
// Boxes // Boxes
$this->boxes = array(); // List of boxes $this->boxes = array(); // List of boxes
$r=0; $r=0;
// Add here list of php file(s) stored in includes/boxes that contains class to show a box. // Add here list of php file(s) stored in includes/boxes that contains class to show a box.
// Example: // Example:
//$this->boxes[$r][1] = "myboxa.php"; //$this->boxes[$r][1] = "myboxa.php";
@ -104,11 +105,11 @@ class modCommissions extends DolibarrModules
//$this->boxes[$r][1] = "myboxb.php"; //$this->boxes[$r][1] = "myboxb.php";
//$r++; //$r++;
// Permissions // Permissions
$this->rights = array(); // Permission array used by this module $this->rights = array(); // Permission array used by this module
$r=0; $r=0;
// Add here list of permission defined by an id, a label, a boolean and two constant strings. // Add here list of permission defined by an id, a label, a boolean and two constant strings.
// Example: // Example:
// $this->rights[$r][0] = 2000; // Permission id (must not be already used) // $this->rights[$r][0] = 2000; // Permission id (must not be already used)
@ -118,7 +119,7 @@ class modCommissions extends DolibarrModules
// $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
// $r++; // $r++;
// Main menu entries // Main menu entries
$this->menu = array(); // List of menus to add $this->menu = array(); // List of menus to add
$r = 0; $r = 0;
@ -141,25 +142,27 @@ class modCommissions extends DolibarrModules
} }
/** /**
* \brief Function called when module is enabled. * Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories. * It also creates data directories.
* \return int 1 if OK, 0 if KO *
* @return int 1 if OK, 0 if KO
*/ */
function init() function init()
{ {
$sql = array(); $sql = array();
$result=$this->load_tables(); $result=$this->load_tables();
return $this->_init($sql); return $this->_init($sql);
} }
/** /**
* \brief Function called when module is disabled. * Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database. * Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted. * Data directories are not deleted.
* \return int 1 if OK, 0 if KO *
* @return int 1 if OK, 0 if KO
*/ */
function remove() function remove()
{ {
@ -168,14 +171,15 @@ class modCommissions extends DolibarrModules
return $this->_remove($sql); return $this->_remove($sql);
} }
/** /**
* \brief Create tables and keys required by module * Create tables and keys required by module
* Files mymodule.sql and mymodule.key.sql with create table and create keys * Files mymodule.sql and mymodule.key.sql with create table and create keys
* commands must be stored in directory /mymodule/sql/ * commands must be stored in directory /mymodule/sql/
* This function is called by this->init. * This function is called by this->init.
* \return int <=0 if KO, >0 if OK *
*/ * @return int <=0 if KO, >0 if OK
*/
function load_tables() function load_tables()
{ {
return; return;