Merge pull request #9376 from frederic34/functionCommentMissing

function Comment Missing
This commit is contained in:
Laurent Destailleur 2018-09-01 12:59:32 +02:00 committed by GitHub
commit 5604f3b0c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 392 additions and 128 deletions

View File

@ -238,9 +238,9 @@
<!--<rule ref="PEAR.Commenting.FunctionComment.MissingReturn">
<severity>0</severity>
</rule>-->
<rule ref="PEAR.Commenting.FunctionComment.Missing">
<!--<rule ref="PEAR.Commenting.FunctionComment.Missing">
<severity>0</severity>
</rule>
</rule>-->
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamType" />

View File

@ -19,7 +19,7 @@
*/
/**
* \file htdocs/adherents/admin/public.php
* \file htdocs/adherents/admin/website.php
* \ingroup member
* \brief File of main public page for member module
* \author Laurent Destailleur

View File

@ -20,9 +20,9 @@ if (!defined('REQUIRE_JQUERY_BLOCKUI')) define('REQUIRE_JQUERY_BLOCKUI', 1);
/**
* \file htdocs/admin/dolistore/ajax.php
* \file htdocs/admin/dolistore/ajax/image.php
* \ingroup admin
* \brief Page des informations dolistore
* \brief Page des informations dolistore
*/
require "../../../main.inc.php";
@ -56,4 +56,3 @@ try {
else if ($trace[0]['args'][0] == 401) die('Bad auth key');
else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV);
}

View File

@ -25,9 +25,18 @@ include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class
*/
class Dolistore
{
// params
public $start; // beginning of pagination
public $end; // end of pagination
/**
* beginning of pagination
* @var int
*/
public $start;
/**
* end of pagination
* @var int
*/
public $end;
public $per_page; // pagination: display per page
public $categorie; // the current categorie
public $search; // the search keywords
@ -282,16 +291,33 @@ class Dolistore
return $html;
}
/**
* get previous link
*
* @param string $text symbol previous
* @return string html previous link
*/
function get_previous_link($text = '<<')
{
return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>';
}
/**
* get next link
*
* @param string $text symbol next
* @return string html next link
*/
function get_next_link($text = '>>')
{
return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>';
}
/**
* get previous url
*
* @return string previous url
*/
function get_previous_url()
{
$param_array = array();
@ -309,6 +335,11 @@ class Dolistore
return $this->url."&".$param;
}
/**
* get next url
*
* @return string next url
*/
function get_next_url()
{
$param_array = array();
@ -326,6 +357,13 @@ class Dolistore
return $this->url."&".$param;
}
/**
* version compare
*
* @param string $v1 version 1
* @param string $v2 version 2
* @return int result of compare
*/
function version_compare($v1, $v2)
{
$v1 = explode('.', $v1);
@ -355,4 +393,3 @@ class Dolistore
return $ret;
}
}

View File

@ -17,7 +17,7 @@
*/
/**
* \file htdocs/admin/oauthlogintoken.php
* \file htdocs/admin/oauthlogintokens.php
* \ingroup oauth
* \brief Setup page to configure oauth access to login information
*/

View File

@ -52,6 +52,12 @@ if (!$mode) $mode='config';
// used in library escpos maybe useful if php doesn't support gzdecode
if (!function_exists('gzdecode')) {
/**
* Gzdecode
*
* @param string $data data to deflate
* @return string data deflated
*/
function gzdecode($data)
{
return gzinflate(substr($data,10,-8));
@ -450,4 +456,3 @@ if ($mode == 'template' && $user->admin)
// End of page
llxFooter();
$db->close();

View File

@ -16,9 +16,9 @@
*/
/**
* \file ticket/admin/ticket_extrafields.php
* \ingroup ticket
* \brief Page to setup extra fields of ticket
* \file admin/ticket_extrafields.php
* \ingroup ticket
* \brief Page to setup extra fields of ticket
*/
require '../main.inc.php';

View File

@ -26,6 +26,9 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
class Login
{
/**
* Constructor of the class
*/
function __construct()
{
global $db;

View File

@ -17,7 +17,7 @@
*/
/**
* \file card.php
* \file htdocs/asset/card.php
* \ingroup asset
* \brief Page to create/edit/view asset
*/

View File

@ -17,7 +17,7 @@
*/
/**
* \file document.php
* \file htdocs/asset/document.php
* \ingroup asset
* \brief Tab for documents linked to Assets
*/

View File

@ -16,7 +16,7 @@
*/
/**
* \file info.php
* \file htdocs/asset/info.php
* \ingroup asset
* \brief Page to show an asset information
*/

View File

@ -18,7 +18,7 @@
*/
/**
* \file list.php
* \file htdocs/asset/list.php
* \ingroup asset
* \brief List page for asset
*/

View File

@ -17,7 +17,7 @@
*/
/**
* \file note.php
* \file htdocs/asset/note.php
* \ingroup asset
* \brief Card with notes on Asset
*/

View File

@ -1574,7 +1574,7 @@ class Propal extends CommonObject
$sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,';
$sql.= ' d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,';
$sql.= ' d.fk_unit,';
$sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tobach as product_batch,';
$sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tobatch as product_batch,';
$sql.= ' p.weight, p.weight_units, p.volume, p.volume_units,';
$sql.= ' d.date_start, d.date_end,';
$sql.= ' d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc';
@ -4237,4 +4237,3 @@ class PropaleLigne extends CommonObjectLine
}
}
}

View File

@ -16,7 +16,7 @@
*/
/**
* \file htdocs/core/class/fiscalyear.php
* \file htdocs/core/class/fiscalyear.class.php
* \ingroup fiscal year
* \brief File of class to manage fiscal years
*/
@ -32,12 +32,12 @@ class Fiscalyear extends CommonObject
* @var string ID to identify managed object
*/
public $element='fiscalyear';
/**
* @var string Name of table without prefix where object is stored
*/
public $table_element='accounting_fiscalyear';
public $table_element_line = '';
public $fk_element = '';
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
@ -48,7 +48,7 @@ class Fiscalyear extends CommonObject
* @var string proper name for given parameter
*/
public $label;
var $date_start;
var $date_end;
var $datec;

View File

@ -16,7 +16,7 @@
*/
/**
* \file core/lib/assets.lib.php
* \file htdocs/core/lib/asset.lib.php
* \ingroup asset
* \brief Library files with common functions for Assets
*/
@ -24,7 +24,7 @@
/**
* Prepare admin pages header
*
* @return array
* @return array head array with tabs
*/
function AssetsAdminPrepareHead()
{
@ -65,6 +65,11 @@ function AssetsAdminPrepareHead()
return $head;
}
/**
* Prepare admin pages header
*
* @return array head array with tabs
*/
function AssetsPrepareHead()
{
global $langs, $conf;

View File

@ -163,6 +163,12 @@ function fichinter_admin_prepare_head()
return $head;
}
/**
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to show
*/
function fichinter_rec_prepare_head($object)
{
global $langs, $conf; //, $user;

View File

@ -607,19 +607,19 @@ function GETPOST($paramname, $check='none', $method=0, $filter=null, $options=nu
}
/**
* Return a prefix to use for this Dolibarr instance, for session/cookie names or email id.
* This prefix is valid in a web context only and is unique for instance and avoid conflict
* between multi-instances, even when having two instances with one root dir or two instances
* in virtual servers.
*
* @param string $mode '' (prefix for session name) or 'email' (prefix for email id)
* @return string A calculated prefix
*/
if (! function_exists('dol_getprefix'))
{
function dol_getprefix($mode='')
{
/**
* Return a prefix to use for this Dolibarr instance, for session/cookie names or email id.
* This prefix is valid in a web context only and is unique for instance and avoid conflict
* between multi-instances, even when having two instances with one root dir or two instances
* in virtual servers.
*
* @param string $mode '' (prefix for session name) or 'email' (prefix for email id)
* @return string A calculated prefix
*/
function dol_getprefix($mode='')
{
global $conf;
// If MAIL_PREFIX_FOR_EMAIL_ID is set and prefix is for email

View File

@ -1167,6 +1167,14 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
return $numFinal;
}
/**
* Get string between
*
* @param string $string String to test
* @param int $start Value for start
* @param int $end Value for end
* @return string Return part of string
*/
function get_string_between($string, $start, $end)
{
$string = " ".$string;

View File

@ -169,6 +169,12 @@ function invoice_admin_prepare_head()
}
/**
* Return array head with list of tabs to view object informations.
*
* @param Facture $object Invoice object
* @return array head array with tabs
*/
function invoice_rec_prepare_head($object)
{
global $db, $langs, $conf;

View File

@ -87,6 +87,11 @@ function resource_prepare_head($object)
return $head;
}
/**
* Prepare head for admin tabs
*
* @return array Array of head entries
*/
function resource_admin_prepare_head()
{

View File

@ -103,12 +103,12 @@ function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmod
}
else
{
dol_syslog("Authentification ko - failed to load file '".$authfile."'",LOG_ERR);
dol_syslog("Authentification ko - failed to load file '".$authfile."'", LOG_ERR);
sleep(1);
$langs->load('main');
$langs->load('other');
$langs->load('errors');
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode",$mode);
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode", $mode);
}
}
}
@ -118,18 +118,18 @@ function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmod
}
/**
* Show Dolibarr default login page.
* Part of this code is also duplicated into main.inc.php::top_htmlhead
*
* @param Translate $langs Lang object (must be initialized by a new).
* @param Conf $conf Conf object
* @param Societe $mysoc Company object
* @return void
*/
if (! function_exists('dol_loginfunction'))
{
function dol_loginfunction($langs,$conf,$mysoc)
/**
* Show Dolibarr default login page.
* Part of this code is also duplicated into main.inc.php::top_htmlhead
*
* @param Translate $langs Lang object (must be initialized by a new).
* @param Conf $conf Conf object
* @param Societe $mysoc Company object
* @return void
*/
function dol_loginfunction($langs,$conf,$mysoc)
{
global $dolibarr_main_demo,$db;
global $smartphone,$hookmanager;
@ -510,4 +510,3 @@ function getRandomPassword($generic=false)
return $generated_password;
}

View File

@ -38,7 +38,7 @@ class html_cerfafr extends ModeleDon
/**
* Constructor
*
* @param DoliDb $db Database handler
* @param DoliDb $db Database handler
*/
function __construct($db)
{
@ -167,7 +167,7 @@ class html_cerfafr extends ModeleDon
$form = str_replace('__DATE__',dol_print_date($don->date,'day',false,$outputlangs),$form);
//$form = str_replace('__IP__',$user->ip,$form); // TODO $user->ip not exist
$form = str_replace('__AMOUNT__', price($don->amount), $form);
$form = str_replace('__AMOUNTLETTERS__',chiffre_en_lettre($don->amount),$form);
$form = str_replace('__AMOUNTLETTERS__',amountToLetters($don->amount),$form);
$form = str_replace('__CURRENCY__',$outputlangs->transnoentitiesnoconv("Currency".$currency),$form);
$form = str_replace('__CURRENCYCODE__',$conf->currency,$form);
$form = str_replace('__MAIN_INFO_SOCIETE_NOM__',$mysoc->name,$form);
@ -278,7 +278,15 @@ class html_cerfafr extends ModeleDon
}
}
function chiffre_en_lettre($montant, $devise1='', $devise2='')
/**
* numbers to letters
*
* @param mixed $montant amount
* @param mixed $devise1 devise 1 ex: euro
* @param mixed $devise2 devise 2 ex: centimes
* @return string amount in letters
*/
function amountToLetters($montant, $devise1='', $devise2='')
{
if(empty($devise1)) $dev1='euros';
else $dev1=$devise1;

View File

@ -22,9 +22,8 @@
/**
* \defgroup produit Module product variants
* \brief Module to manage product combinations based on product attributes
* \file htdocs/core/modules/modAttributes.class.php
* \file htdocs/core/modules/modVariants.class.php
* \ingroup produit
* \brief File to describe module to manage catalog of predefined products
*/
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
@ -110,4 +109,3 @@ class modVariants extends DolibarrModules
$this->rights = array(); // Permission array used by this module
}
}

View File

@ -422,6 +422,14 @@ class doc_generic_user_odt extends ModelePDFUser
return -1;
}
/**
* get substitution array for object
*
* @param User $object user
* @param Translation $outputlangs translation object
* @param string $array_key key for array
* @return array array of substitutions
*/
function get_substitutionarray_object($object,$outputlangs,$array_key='object')
{
$array_other=array();

View File

@ -34,11 +34,18 @@ class CdavLib
private $langs;
/**
* Constructor
*
* @param User $user user
* @param DoliDB $db Database handler
* @param Translation $langs translation
*/
function __construct($user, $db, $langs)
{
$this->user = $user;
$this->db = $db;
$this->langs = $langs;
$this->user = $user;
$this->db = $db;
$this->langs = $langs;
}
/**

View File

@ -33,12 +33,12 @@ class ExpenseReportIk extends CoreObject
* @var string ID to identify managed object
*/
public $element='expenseik';
/**
* @var string Name of table without prefix where object is stored
*/
public $table_element='expensereport_ik';
public $fk_element='fk_expense_ik';
/**
@ -128,8 +128,15 @@ class ExpenseReportIk extends CoreObject
return $categories;
}
public static function getRangeByUser(User $userauthor, $fk_c_exp_tax_cat)
{
/**
* Return an array of ranges for a user
*
* @param User $userauthor user author id
* @param int $fk_c_exp_tax_cat category
* @return boolean|array
*/
public static function getRangeByUser(User $userauthor, $fk_c_exp_tax_cat)
{
$default_range = (int) $userauthor->default_range; // if not defined, then 0
$ranges = self::getRangesByCategory($fk_c_exp_tax_cat);

View File

@ -190,37 +190,35 @@ class LoanSchedule extends CommonObject
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql);
if ($resql) {
if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->fk_loan = $obj->fk_loan;
$this->datec = $this->db->jdate($obj->datec);
$this->tms = $this->db->jdate($obj->tms);
$this->datep = $this->db->jdate($obj->datep);
$this->amount_capital = $obj->amount_capital;
$this->amount_insurance = $obj->amount_insurance;
$this->amount_interest = $obj->amount_interest;
$this->fk_typepayment = $obj->fk_typepayment;
$this->num_payment = $obj->num_payment;
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
$this->fk_bank = $obj->fk_bank;
$this->fk_user_creat = $obj->fk_user_creat;
$this->fk_user_modif = $obj->fk_user_modif;
$this->fk_loan = $obj->fk_loan;
$this->datec = $this->db->jdate($obj->datec);
$this->tms = $this->db->jdate($obj->tms);
$this->datep = $this->db->jdate($obj->datep);
$this->amount_capital = $obj->amount_capital;
$this->amount_insurance = $obj->amount_insurance;
$this->amount_interest = $obj->amount_interest;
$this->fk_typepayment = $obj->fk_typepayment;
$this->num_payment = $obj->num_payment;
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
$this->fk_bank = $obj->fk_bank;
$this->fk_user_creat = $obj->fk_user_creat;
$this->fk_user_modif = $obj->fk_user_modif;
$this->type_code = $obj->type_code;
$this->type_libelle = $obj->type_libelle;
$this->type_code = $obj->type_code;
$this->type_libelle = $obj->type_libelle;
$this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank;
}
$this->db->free($resql);
$this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank;
}
$this->db->free($resql);
return 1;
}
@ -374,13 +372,20 @@ class LoanSchedule extends CommonObject
}
}
function calc_mens($capital,$rate,$nbterm)
/**
* Calculate mensuality
*
* @param double $capital Capital
* @param double $rate rate
* @param int $nbterm nb term
* @return double mensuality
*/
function calc_mens($capital, $rate, $nbterm)
{
$result='';
if (!empty($capital)&&!empty($rate)&&!empty($nbterm))
{
$result=($capital*($rate/12))/(1-pow((1+($rate/12)),($nbterm*-1)));
if (!empty($capital) && !empty($rate) && !empty($nbterm)) {
$result = ($capital*($rate/12))/(1-pow((1+($rate/12)),($nbterm*-1)));
}
return $result;

View File

@ -654,6 +654,9 @@ class PropalmergepdfproductLine
var $tms='';
var $import_key;
/**
* Constructor
*/
function __construct()
{
return 1;

View File

@ -25,7 +25,7 @@
/**
* Define head array for tabs of inventory tools setup pages
*
* @return Array of head
* @return array Array of head
*/
function inventoryAdminPrepareHead()
{
@ -40,7 +40,7 @@ function inventoryAdminPrepareHead()
$head[$h][1] = $langs->trans("Parameters");
$head[$h][2] = 'settings';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
@ -55,10 +55,19 @@ function inventoryAdminPrepareHead()
return $head;
}
/**
* Define head array for tabs of inventory tools setup pages
*
* @param Inventory $inventory Object inventory
* @param string $title parameter
* @param string $get parameter
*
* @return array Array of head
*/
function inventoryPrepareHead(&$inventory, $title='Inventory', $get='')
{
global $langs;
return array(
array(dol_buildpath('/product/inventory/card.php?id='.$inventory->id.$get, 1), $langs->trans($title),'inventory')
);
@ -66,26 +75,33 @@ function inventoryPrepareHead(&$inventory, $title='Inventory', $get='')
/**
* Define head array for tabs of inventory tools setup pages
*
* @param Inventory $inventory Object inventory
*
* @return string html of products
*/
function inventorySelectProducts(&$inventory)
{
global $conf,$db,$langs;
$except_product_id = array();
foreach ($inventory->Inventorydet as $Inventorydet)
{
$except_product_id[] = $Inventorydet->fk_product;
}
ob_start();
$form = new Form($db);
$form->select_produits(-1, 'fk_product');
$TChildWarehouses = array($inventory->fk_warehouse);
$e = new Entrepot($db);
$e->fetch($inventory->fk_warehouse);
if(method_exists($e, 'get_children_warehouses')) $e->get_children_warehouses($e->id, $TChildWarehouses);
$Tab = array();
$sql = 'SELECT rowid, label
FROM '.MAIN_DB_PREFIX.'entrepot WHERE rowid IN('.implode(', ', $TChildWarehouses).')';
@ -96,9 +112,8 @@ function inventorySelectProducts(&$inventory)
}
print '&nbsp;&nbsp;&nbsp;';
print $langs->trans('Warehouse').' : '.$form::selectarray('fk_warehouse', $Tab);
$select_html = ob_get_clean();
return $select_html;
}

View File

@ -29,7 +29,12 @@ class ProjectStats extends Stats
public $socid;
public $year;
function __construct($db)
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
global $conf, $user;

View File

@ -29,6 +29,11 @@ class TaskStats extends Stats
public $socid;
public $year;
/**
* Constructor of the class
*
* @param DoliDb $db Database handler
*/
function __construct($db)
{
global $conf, $user;

View File

@ -1025,7 +1025,12 @@ class Ticket extends CommonObject
$this->tms = '';
}
/**
* print selected status
*
* @param string $selected selected status
* @return void
*/
public function printSelectStatus($selected = "")
{
print Form::selectarray('search_fk_statut', $this->statuts_short, $selected, $show_empty = 1, $key_in_label = 0, $value_as_key = 0, $option = '', $translate = 1, $maxlen = 0, $disabled = 0, $sort = '', $morecss = '');

View File

@ -44,12 +44,12 @@ class User extends CommonObject
* @var string ID to identify managed object
*/
public $element='user';
/**
* @var string Name of table without prefix where object is stored
*/
public $table_element='user';
public $fk_element='fk_user';
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
@ -146,14 +146,14 @@ class User extends CommonObject
public $default_c_exp_tax_cat;
public $default_range;
public $fields=array(
'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
'lastname'=>array('type'=>'varchar(50)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1, 'comment'=>'Reference of object'),
'firstname'=>array('type'=>'varchar(50)', 'label'=>'Name','enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
);
public $fields = array(
'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
'lastname'=>array('type'=>'varchar(50)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1, 'comment'=>'Reference of object'),
'firstname'=>array('type'=>'varchar(50)', 'label'=>'Name','enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
);
/**
* Constructor de la classe
* Constructor of the class
*
* @param DoliDb $db Database handler
*/
@ -1538,7 +1538,7 @@ class User extends CommonObject
$adh->zip=$this->zip;
$adh->state_id=$this->state_id;
$adh->country_id=$this->country_id;
$adh->email=$this->email;
$adh->skype=$this->skype;
$adh->phone=$this->office_phone;

View File

@ -53,6 +53,11 @@ class ProductAttribute
*/
public $rang;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct(DoliDB $db)
{
global $conf;

View File

@ -52,8 +52,13 @@ class ProductAttributeValue
*/
public $value;
public function __construct(DoliDB $db)
{
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct(DoliDB $db)
{
global $conf;
$this->db = $db;

View File

@ -70,7 +70,12 @@ class ProductCombination
*/
public $entity;
public function __construct(DoliDB $db)
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct(DoliDB $db)
{
global $conf;

View File

@ -52,10 +52,15 @@ class ProductCombination2ValuePair
*/
public $fk_prod_attr_val;
public function __construct(DoliDB $db)
{
$this->db = $db;
}
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct(DoliDB $db)
{
$this->db = $db;
}
/**
* Translates this class to a human-readable string

View File

@ -239,6 +239,13 @@ exit(0);
/**
* script cron usage
*
* @param string $path path
* @param string $script_file filename
* @return void
*/
function usage($path,$script_file)
{
global $conf;
@ -252,4 +259,3 @@ function usage($path,$script_file)
print "For example, to run pending tasks every 5mn, you can add this line:\n";
print "*/5 * * * * ".$path.$script_file." securitykey userlogin > ".DOL_DATA_ROOT."/".$script_file.".log\n";
}

View File

@ -74,14 +74,24 @@ class BonPrelevementTest extends PHPUnit_Framework_TestCase
print "\n";
}
// Static methods
public static function setUpBeforeClass()
/**
* setUpBeforeClass
*
* @return void
*/
public static function setUpBeforeClass()
{
global $conf,$user,$langs,$db;
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
print __METHOD__."\n";
}
/**
* tearDownAfterClass
*
* @return void
*/
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;

View File

@ -173,6 +173,11 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase
$this->assertEquals(1, $object['statut']);
}
/**
* testRestCreateUser
*
* @return void
*/
public function testRestCreateUser()
{

View File

@ -91,6 +91,11 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
print "\n";
}
/**
* setUpBeforeClass
*
* @return void
*/
public static function setUpBeforeClass()
{
global $conf,$user,$langs,$db;
@ -131,6 +136,11 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
/**
* tearDownAfterClass
*
* @return void
*/
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;

View File

@ -42,6 +42,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
)
);
/**
* setUpBeforeClass
*
* @return void
*/
public static function setUpBeforeClass()
{
// Make sure we backup and remove the configuration file to force new install.
@ -54,12 +59,22 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
self::shareSession(true);
}
/**
* dropTestDatabase
*
* @return void
*/
protected static function dropTestDatabase()
{
$mysqli = new mysqli(self::$db_host, self::$db_admin_user, self::$db_admin_pass);
$mysqli->query("DROP DATABASE " . self::$db_name);
}
/**
* tearDownAfterClass
*
* @return void
*/
public static function tearDownAfterClass()
{
// Remove the generated configuration and restore the backed up file.
@ -70,6 +85,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
self::dropTestDatabase();
}
/**
* setUp
*
* @return void
*/
public function setUp()
{
// Populating the database can take quite long.
@ -77,17 +97,32 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
$this->setBrowserUrl(self::$url);
}
/**
* testInstallRedirect
*
* @return void
*/
public function testInstallRedirect()
{
$this->url('/');
$this->assertContains('/install/index.php', $this->url());
}
/**
* testInstallPageTitle
*
* @return void
*/
public function testInstallPageTitle()
{
$this->assertContains('Dolibarr', $this->title());
}
/**
* testInstallProcess
*
* @return void
*/
public function testInstallProcess()
{
// FIXME: the button itself should have an ID
@ -95,6 +130,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
$this->assertContains('/install/check.php', $this->url());
}
/**
* testCheckPage
*
* @return void
*/
public function testCheckPage()
{
$unavailable_choices = $this->byId('navail_choices');
@ -109,6 +149,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
$this->assertContains('/install/fileconf.php', $this->url());
}
/**
* testForm
*
* @return void
*/
public function testForm()
{
$this->assertFalse($this->byClassName('hideroot')->displayed());
@ -153,12 +198,22 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
$this->byId('db_pass_root')->value('');
}
/**
* testFormSubmit
*
* @return void
*/
public function testFormSubmit()
{
$this->byName('forminstall')->submit();
$this->assertContains('/install/step1.php', $this->url());
}
/**
* testStep1
*
* @return void
*/
public function testStep1()
{
$this->assertFalse($this->byId('pleasewait')->displayed());
@ -170,6 +225,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
$this->assertContains('/install/step2.php', $this->url());
}
/**
* testStep2
*
* @return void
*/
public function testStep2()
{
$this->byName('forminstall')->submit();
@ -178,6 +238,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
// There is no step 3
/**
* testStep4
*
* @return void
*/
public function testStep4()
{
// FIXME: should have an ID
@ -191,6 +256,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
$this->assertContains('/install/step5.php', $this->url());
}
/**
* testStep5
*
* @return void
*/
public function testStep5()
{
// FIXME: this button should have an ID
@ -198,6 +268,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
$this->assertContains('/admin/index.php', $this->url());
}
/**
* testFirstLogin
*
* @return void
*/
public function testFirstLogin()
{
$this->assertEquals('login', $this->byTag('form')->attribute('id'));