Qual: Removed PHPCodesniffer error.

This commit is contained in:
Laurent Destailleur 2011-09-16 17:57:09 +00:00
parent ea631c3e80
commit bc25ed0834
10 changed files with 137 additions and 124 deletions

View File

@ -181,11 +181,13 @@
</rule>
<rule ref="PEAR.NamingConventions.ValidFunctionName" />
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNoCaptial">
<severity>0</severity>
</rule>
<rule ref="PEAR.NamingConventions.ValidFunctionName.NotCamelCaps">
<severity>0</severity>
</rule>
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNoCaptial">
<rule ref="PEAR.NamingConventions.ValidFunctionName.PrivateNoUnderscore">
<severity>0</severity>
</rule>

View File

@ -64,6 +64,7 @@ abstract class ActionsContactCardCommon
* Load data control
*
* @param int $id Id of object
* @return void
*/
function doActions($id)
{
@ -189,7 +190,8 @@ abstract class ActionsContactCardCommon
/**
* Return the title of card
*
* @param string $action Type of action
* @param string $action Type of action
* @return string HTML output
*/
function getTitle($action)
{
@ -204,9 +206,10 @@ abstract class ActionsContactCardCommon
}
/**
* Set content of ->tpl array, to use into template
* Set content of ->tpl array, to use into template
*
* @param string $action Type of action
* @param string $action Type of action
* @return string HTML output
*/
function assign_values($action='')
{
@ -214,7 +217,7 @@ abstract class ActionsContactCardCommon
global $form, $formcompany, $objsoc;
if ($action == 'create' || $action == 'edit') $this->assign_post($action);
foreach($this->object as $key => $value)
{
$this->tpl[$key] = $value;
@ -250,7 +253,7 @@ abstract class ActionsContactCardCommon
}
// Civility
$this->tpl[select_civility] = $formcompany->select_civility($this->object->civilite_id);
$this->tpl['select_civility'] = $formcompany->select_civility($this->object->civilite_id);
// Predefined with third party
if ($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS))
@ -395,9 +398,12 @@ abstract class ActionsContactCardCommon
}
/**
* Assigne les valeurs POST dans l'objet
* Assign POST values into object
*
* @param string $action Action string
* @return string HTML output
*/
function assign_post($action)
private function assign_post($action)
{
global $langs, $mysoc;

View File

@ -52,9 +52,10 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
/**
* Assign custom values for canvas
* Assign custom values for canvas
*
* @param string $action Type of action
* @param string $action Type of action
* @return void
*/
function assign_values($action='')
{
@ -94,24 +95,6 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
}
}
/**
* Check permissions of a user to show a page and an object. Check read permission
* If $_REQUEST['action'] defined, we also check write permission.
*
* @param user User to check
* @param features Features to check (in most cases, it's module name)
* @param objectid Object ID if we want to check permission on a particular record (optionnal)
* @param dbtablename Table name where object is stored. Not used if objectid is null (optionnal)
* @param feature2 Feature to check (second level of permission)
* @param dbt_keyfield Field name for socid foreign key if not fk_soc. (optionnal)
* @param dbt_select Field name for select if not rowid. (optionnal)
* @return int 1
*/
function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
{
return restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select);
}
}
?>

View File

@ -33,29 +33,20 @@ class DaoContactDefault extends Contact
var $errno = 0;
/**
* Constructeur de la classe
* @param DB Handler acces base de donnees
* Constructor
*
* @param DoliDB $DB Handler acces base de donnees
*/
function DaoContactDefault($DB)
{
$this->db = $DB;
}
/**
* Lecture des donnees dans la base
* @param id Element id
*/
function fetch($id)
{
$result = parent::fetch($id);
return $result;
}
/**
* Create third party in database
* @param user Object of user that ask creation
* @return int >= 0 if OK, < 0 if KO
*
* @param User $user Object of user that ask creation
* @return int >= 0 if OK, < 0 if KO
*/
function create($user='')
{
@ -65,13 +56,14 @@ class DaoContactDefault extends Contact
}
/**
* Update parameters of third party
* @param id id societe
* @param user Utilisateur qui demande la mise a jour
* @param call_trigger 0=non, 1=oui
* @param allowmodcodeclient Inclut modif code client et code compta
* @param allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur
* @return int <0 si ko, >=0 si ok
* Update parameters of third party
*
* @param int $id Id societe
* @param User $user Utilisateur qui demande la mise a jour
* @param int $call_trigger 0=non, 1=oui
* @param int $allowmodcodeclient Inclut modif code client et code compta
* @param int $allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur
* @return int <0 if KO, >=0 if OK
*/
function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0)
{
@ -81,8 +73,9 @@ class DaoContactDefault extends Contact
}
/**
* Delete third party in database
* @param id id de la societe a supprimer
* Delete third party in database
*
* @return int <0 if KO, >=0 if OK
*/
function delete()
{

View File

@ -55,7 +55,7 @@ dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']
</tr>
<tr>
<td><?php echo $langs->trans("PostOrFunction" ); ?></td>
<td><?php echo $langs->trans("PostOrFunction"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['poste']; ?></td>
</tr>

View File

@ -193,10 +193,11 @@ class Contact extends CommonObject
/**
* Update informations into database
* @param id Id of contact/address to update
* @param user Objet user making change
* @param notrigger 0=no, 1=yesi
* @return int <0 if KO, >0 if OK
*
* @param int $id Id of contact/address to update
* @param User $user Objet user making change
* @param int $notrigger 0=no, 1=yesi
* @return int <0 if KO, >0 if OK
*/
function update($id, $user=0, $notrigger=0)
{
@ -280,12 +281,13 @@ class Contact extends CommonObject
/**
* \brief Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
* \param info Info string loaded by _load_ldap_info
* \param mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
* 1=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb)
* 2=Return key only (uid=qqq)
* \return string DN
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
*
* @param array $info Info string loaded by _load_ldap_info
* @param int $mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
* 1=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb)
* 2=Return key only (uid=qqq)
* @return string DN
*/
function _load_ldap_dn($info,$mode=0)
{
@ -299,8 +301,9 @@ class Contact extends CommonObject
/**
* \brief Initialise tableau info (tableau des attributs LDAP)
* \return array Tableau info des attributs
* Initialise tableau info (tableau des attributs LDAP)
*
* @return array Tableau info des attributs
*/
function _load_ldap_info()
{
@ -368,10 +371,11 @@ class Contact extends CommonObject
/**
* Update field alert birthday
* @param id Id of contact
* @param user User asking to change alert or birthday
* @return int
* Update field alert birthday
*
* @param int $id Id of contact
* @param User $user User asking to change alert or birthday
* @return int <0 if KO, >=0 if OK
*/
function update_perso($id, $user=0)
{
@ -431,11 +435,12 @@ class Contact extends CommonObject
}
/*
* \brief Charge l'objet contact
* \param id id du contact
* \param user Utilisateur (abonnes aux alertes) qui veut les alertes de ce contact
* \return int -1 if KO, 0 if OK but not found, 1 if OK
/**
* Charge l'objet contact
*
* @param int $id id du contact
* @param User $user Utilisateur (abonnes aux alertes) qui veut les alertes de ce contact
* @return int -1 if KO, 0 if OK but not found, 1 if OK
*/
function fetch($id, $user=0)
{
@ -584,12 +589,13 @@ class Contact extends CommonObject
/**
* \brief Charge le nombre d'elements auquel est lie ce contact
* ref_facturation
* ref_contrat
* ref_commande
* ref_propale
* \return int 0 si ok, -1 si erreur
* Charge le nombre d'elements auquel est lie ce contact
* ref_facturation
* ref_contrat
* ref_commande
* ref_propale
*
* @return int <0 if KO, >=0 if OK
*/
function load_ref_elements()
{
@ -628,8 +634,9 @@ class Contact extends CommonObject
/**
* Efface le contact de la base
* @param notrigger Disable all trigger
* @return int <0 if KO, >0 if OK
*
* @param int $notrigger Disable all trigger
* @return int <0 if KO, >0 if OK
*/
function delete($notrigger=0)
{
@ -721,9 +728,11 @@ class Contact extends CommonObject
}
/*
* \brief Charge les informations sur le contact, depuis la base
* \param id id du contact a charger
/**
* Charge les informations sur le contact, depuis la base
*
* @param int $id Id du contact a charger
* @return void
*/
function info($id)
{
@ -766,8 +775,9 @@ class Contact extends CommonObject
}
/**
* \brief Return number of mass Emailing received by this contacts with its email
* \return int Number of EMailings
* Return number of mass Emailing received by this contacts with its email
*
* @return int Number of EMailings
*/
function getNbOfEMailings()
{
@ -792,12 +802,13 @@ class Contact extends CommonObject
}
/**
* Return name of contact with link (and eventually picto)
* Use $this->id, $this->name, $this->firstname, this->civilite_id
* @param withpicto Include picto with link
* @param option Where the link point to
* @param maxlen Max length of
* @return string String with URL
* Return name of contact with link (and eventually picto)
* Use $this->id, $this->name, $this->firstname, this->civilite_id
*
* @param int $withpicto Include picto with link
* @param string $option Where the link point to
* @param int $maxlen Max length of
* @return string String with URL
*/
function getNomUrl($withpicto=0,$option='',$maxlen=0)
{
@ -822,9 +833,10 @@ class Contact extends CommonObject
/**
* Return full address of contact
* @param withcountry 1=Add country into address string
* @param sep Separator to use to build string
* @return string Full address string
*
* @param int $withcountry 1=Add country into address string
* @param string $sep Separator to use to build string
* @return string Full address string
*/
function getFullAddress($withcountry=0,$sep="\n")
{
@ -847,6 +859,7 @@ class Contact extends CommonObject
/**
* Return label of a civility contact
*
* @return string Translated name of civility
*/
function getCivilityLabel()
@ -868,10 +881,11 @@ class Contact extends CommonObject
/**
* Return full name (civility+' '+name+' '+lastname)
* @param langs Language object for translation of civility
* @param option 0=No option, 1=Add civility
* @param nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname
* @return string String with full name
*
* @param Translate $langs Language object for translation of civility
* @param string $option 0=No option, 1=Add civility
* @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname
* @return string String with full name
*/
function getFullName($langs,$option=0,$nameorder=-1)
{
@ -904,9 +918,10 @@ class Contact extends CommonObject
/**
* \brief Retourne le libelle du statut du contact
* \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* \return string Libelle
* Retourne le libelle du statut du contact
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle
*/
function getLibStatut($mode)
{
@ -914,12 +929,13 @@ class Contact extends CommonObject
}
/**
* \brief Renvoi le libelle d'un statut donne
* \param statut Id statut
* \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* \return string Libelle
* Renvoi le libelle d'un statut donne
*
* @param int $statut Id statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle
*/
function LibStatut($statut,$mode)
function LibStatut($statut, $mode)
{
global $langs;
@ -969,9 +985,10 @@ class Contact extends CommonObject
/**
* \brief Return translated label of Public or Private
* \param type Type (0 = public, 1 = private)
* \return string Label translated
* Return translated label of Public or Private
*
* @param int $statut Type (0 = public, 1 = private)
* @return string Label translated
*/
function LibPubPriv($statut)
{
@ -982,7 +999,9 @@ class Contact extends CommonObject
/**
* \brief Initialise le contact avec valeurs fictives aleatoire
* Initialise le contact avec valeurs fictives aleatoire
*
* @return void
*/
function initAsSpecimen()
{

View File

@ -79,7 +79,7 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action);
if (method_exists($objcanvas->control,'doActions'))
{
$objcanvas->doActions($id);
if (! empty($objcanvas->error) || (! empty($objcanvas->errors) && sizeof($objcanvas->errors) > 0))
if (! empty($objcanvas->error) || (! empty($objcanvas->errors) && count($objcanvas->errors) > 0))
{
$error=$objcanvas->error; $errors=$objcanvas->errors;
if ($action=='add') { $objcanvas->action='create'; $action='create'; }

View File

@ -176,7 +176,7 @@ if ($result > 0)
//var_dump($records);
// Affichage arbre
if (sizeof($records) && $records != false && (! isset($records['count']) || $records['count'] > 0))
if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0))
{
if (! is_array($records))
{

View File

@ -241,7 +241,7 @@ if ($result)
$num = $db->num_rows($result);
$i = 0;
print_barre_liste($titre ,$page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num,$nbtotalofrecords);
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords);
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -406,7 +406,7 @@ if ($result)
print '</form>';
if ($num > $limit) print_barre_liste('' ,$page, "index.php", '&amp;begin='.$begin.'&amp;view='.$view.'&amp;userid='.$_GET["userid"], $sortfield, $sortorder,'',$num,$nbtotalofrecords, '');
if ($num > $limit) print_barre_liste('', $page, "index.php", '&amp;begin='.$begin.'&amp;view='.$view.'&amp;userid='.$_GET["userid"], $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
$db->free($result);
}

View File

@ -63,6 +63,9 @@ abstract class ActionsCardCommon
/**
* Load data control
*
* @param int $socid Id of third party
* @return void
*/
function doActions($socid)
{
@ -337,7 +340,7 @@ abstract class ActionsCardCommon
}
else
{
Header ('Location: '.$_SERVER["PHP_SELF"].'?socid='.$this->object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc'));
Header('Location: '.$_SERVER["PHP_SELF"].'?socid='.$this->object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc'));
exit;
}
}
@ -347,6 +350,9 @@ abstract class ActionsCardCommon
/**
* Return the title of card
*
* @param string $action Type of action
* @return string HTML output
*/
private function getTitle($action)
{
@ -362,9 +368,10 @@ abstract class ActionsCardCommon
}
/**
* Assigne les valeurs par defaut pour le canvas
*
* @param string $action Type of template
* Set content of ->tpl array, to use into template
*
* @param string $action Type of action
* @return string HTML output
*/
function assign_values($action)
{
@ -372,7 +379,7 @@ abstract class ActionsCardCommon
global $form, $formadmin, $formcompany;
if ($action == 'create' || $action == 'edit') $this->assign_post();
if ($_GET["type"]=='f') { $this->object->fournisseur=1; }
if ($_GET["type"]=='c') { $this->object->client=1; }
if ($_GET["type"]=='p') { $this->object->client=2; }
@ -583,7 +590,7 @@ abstract class ActionsCardCommon
// Sales representatives
$this->tpl['sales_representatives'] = '';
$listsalesrepresentatives=$this->object->getSalesRepresentatives($user);
$nbofsalesrepresentative=sizeof($listsalesrepresentatives);
$nbofsalesrepresentative=count($listsalesrepresentatives);
if ($nbofsalesrepresentative > 3) // We print only number
{
$this->tpl['sales_representatives'].= '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$this->object->id.'">';
@ -651,7 +658,10 @@ abstract class ActionsCardCommon
}
/**
* Assigne les valeurs POST dans l'objet
* Assign POST values into object
*
* @param string $action Action string
* @return string HTML output
*/
private function assign_post($action)
{