Qual: Removed errors reported by PHPCodeSniffer

This commit is contained in:
Laurent Destailleur 2011-08-28 02:18:20 +00:00
parent fbe292a439
commit 482a205936
8 changed files with 278 additions and 259 deletions

View File

@ -322,12 +322,12 @@ else if ($_GET["id"] || $_GET["ref"])
print '</tr>'; print '</tr>';
// Status (to sell) // Status (to sell)
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')'.'</td><td>'; print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td>';
print $product->getLibStatut(2,0); print $product->getLibStatut(2,0);
print '</td></tr>'; print '</td></tr>';
// Status (to buy) // Status (to buy)
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')'.'</td><td>'; print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td>';
print $product->getLibStatut(2,1); print $product->getLibStatut(2,1);
print '</td></tr>'; print '</td></tr>';
@ -425,7 +425,12 @@ else if ($_GET["id"] || $_GET["ref"])
/** /**
* Fonction Barre d'actions * Function to output a HTML select for a category
*
* @param DoliDb $db Database handler
* @param Object $object Object we want to see categories it can be classified into
* @param int $typeid Type of category (0, 1, 2, 3)
* @return int 0
*/ */
function formCategory($db,$object,$typeid) function formCategory($db,$object,$typeid)
{ {
@ -468,7 +473,7 @@ function formCategory($db,$object,$typeid)
$c = new Categorie($db); $c = new Categorie($db);
$cats = $c->containing($object->id,$typeid); $cats = $c->containing($object->id,$typeid);
if (sizeof($cats) > 0) if (count($cats) > 0)
{ {
if ($typeid == 0) $title=$langs->trans("ProductIsInCategories"); if ($typeid == 0) $title=$langs->trans("ProductIsInCategories");
if ($typeid == 1) $title=$langs->trans("CompanyIsInSuppliersCategories"); if ($typeid == 1) $title=$langs->trans("CompanyIsInSuppliersCategories");
@ -517,7 +522,7 @@ function formCategory($db,$object,$typeid)
} }
print "</table>\n"; print "</table>\n";
} }
else if($cats < 0) else if ($cats < 0)
{ {
print $langs->trans("ErrorUnknown"); print $langs->trans("ErrorUnknown");
} }
@ -530,6 +535,7 @@ function formCategory($db,$object,$typeid)
print $title; print $title;
print "<br/>"; print "<br/>";
} }
return 0;
} }
$db->close(); $db->close();

View File

@ -500,10 +500,11 @@ class Categorie
} }
/** /**
* \brief Return list of contents of a category * Return list of contents of a category
* \param field Field name for select in table. Full field name will be fk_field. *
* \param class PHP Class of object to store entity * @param field Field name for select in table. Full field name will be fk_field.
* \param table Table name for select in table. Full table name will be PREFIX_categorie_table. * @param class PHP Class of object to store entity
* @param table Table name for select in table. Full table name will be PREFIX_categorie_table.
*/ */
function get_type($field,$classname,$table='') function get_type($field,$classname,$table='')
{ {
@ -565,15 +566,18 @@ class Categorie
/** /**
* retourne la description d'une categorie * Return category description
*
* @param $cate
* @return string Description
*/ */
function get_desc ($cate) function get_desc ($cate)
{ {
$sql = "SELECT description FROM ".MAIN_DB_PREFIX."categorie "; $sql = "SELECT description FROM ".MAIN_DB_PREFIX."categorie ";
$sql .= "WHERE rowid = '".$cate."'"; $sql .= "WHERE rowid = '".$cate."'";
$res = $this->db->query ($sql); $res = $this->db->query($sql);
$n = $this->db->fetch_array ($res); $n = $this->db->fetch_array($res);
return ($n[0]); return ($n[0]);
} }
@ -961,7 +965,7 @@ class Categorie
/** /**
* print_primary_way() affiche le chemin le plus court pour se rendre a un produit * print_primary_way() affiche le chemin le plus court pour se rendre a un produit
*/ */
function print_primary_way($id, $sep= " &gt;&gt; ", $url, $type="") function print_primary_way($id, $sep= " &gt;&gt; ", $url="", $type="")
{ {
$primary_way = Array(); $primary_way = Array();
$way = $this->get_primary_way($id,$type); $way = $this->get_primary_way($id,$type);
@ -1073,8 +1077,14 @@ class Categorie
/** /**
* \brief Retourne les categories dont l'id ou le nom correspond * Retourne les categories dont l'id ou le nom correspond
* ajoute des wildcards au nom sauf si $exact = true * ajoute des wildcards au nom sauf si $exact = true
*
* @param id
* @param nom
* @param type
* @param exact
* @return int or array
*/ */
function rechercher($id, $nom, $type, $exact = false) function rechercher($id, $nom, $type, $exact = false)
{ {
@ -1115,11 +1125,12 @@ class Categorie
} }
/** /**
* \brief Return name and link of category (with picto) * Return name and link of category (with picto)
* \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul *
* \param option Sur quoi pointe le lien ('', 'xyz') * @param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* \param maxlength Max length of text * @param option Sur quoi pointe le lien ('', 'xyz')
* \return string Chaine avec URL * @param maxlength Max length of text
* @return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0,$option='',$maxlength=0) function getNomUrl($withpicto=0,$option='',$maxlength=0)
{ {
@ -1142,11 +1153,12 @@ class Categorie
/** /**
* \brief Deplace fichier uploade sous le nom $files dans le repertoire sdir * Deplace fichier uploade sous le nom $files dans le repertoire sdir
* \param sdir Repertoire destination finale *
* \param $file Nom du fichier uploade * @param sdir Repertoire destination finale
* \param maxWidth Largeur maximum que dois faire la miniature (160 par defaut) * @param $file Nom du fichier uploade
* \param maxHeight Hauteur maximum que dois faire la miniature (120 par defaut) * @param maxWidth Largeur maximum que dois faire la miniature (160 par defaut)
* @param maxHeight Hauteur maximum que dois faire la miniature (120 par defaut)
*/ */
function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120) function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120)
{ {
@ -1194,10 +1206,11 @@ class Categorie
/** /**
* \brief Retourne tableau de toutes les photos de la categorie * Return tableau de toutes les photos de la categorie
* \param dir Repertoire a scanner *
* \param nbmax Nombre maximum de photos (0=pas de max) * @param dir Repertoire a scanner
* \return array Tableau de photos * @param nbmax Nombre maximum de photos (0=pas de max)
* @return array Tableau de photos
*/ */
function liste_photos($dir,$nbmax=0) function liste_photos($dir,$nbmax=0)
{ {

View File

@ -52,7 +52,7 @@ $result = restrictedArea($user, 'categorie', $id);
// Action mise a jour d'une categorie // Action mise a jour d'une categorie
if ($action == 'update' && $user->rights->categorie->creer) if ($action == 'update' && $user->rights->categorie->creer)
{ {
$categorie = new Categorie ($db); $categorie = new Categorie($db);
$result=$categorie->fetch($id); $result=$categorie->fetch($id);
$categorie->label = $_POST["nom"]; $categorie->label = $_POST["nom"];
@ -112,7 +112,7 @@ if ($mesg)
print '</div>'; print '</div>';
} }
$categorie = new Categorie ($db, $id); $categorie = new Categorie($db, $id);
$html = new Form($db); $html = new Form($db);
print '<table class="notopnoleft" border="0" width="100%">'; print '<table class="notopnoleft" border="0" width="100%">';
@ -144,7 +144,7 @@ $doleditor->Create();
print '</td></tr>'; print '</td></tr>';
// Parent category // Parent category
print '<tr><td>'.$langs->trans ("In").'</td><td>'; print '<tr><td>'.$langs->trans("In").'</td><td>';
print $html->select_all_categories($type,$categorie->id_mere,'catMere',64,$categorie->id); print $html->select_all_categories($type,$categorie->id_mere,'catMere',64,$categorie->id);
print '</td></tr>'; print '</td></tr>';

View File

@ -215,7 +215,7 @@ if ($user->rights->categorie->creer)
print '</td></tr>'; print '</td></tr>';
// Parent category // Parent category
print '<tr><td>'.$langs->trans ("AddIn").'</td><td>'; print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
print $html->select_all_categories($type,$catorigin); print $html->select_all_categories($type,$catorigin);
print '</td></tr>'; print '</td></tr>';

View File

@ -69,7 +69,7 @@ print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("Search").'</td>'; print '<td colspan="3">'.$langs->trans("Search").'</td>';
print '</tr>'; print '</tr>';
print '<tr '.$bc[0].'><td>'; print '<tr '.$bc[0].'><td>';
print $langs->trans("Name").':</td><td><input class="flat" type="text" size="20" name="catname" value="' . $_POST['catname'] . '"/></td><td><input type="submit" class="button" value="'.$langs->trans ("Search").'"></td></tr>'; print $langs->trans("Name").':</td><td><input class="flat" type="text" size="20" name="catname" value="' . $_POST['catname'] . '"/></td><td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
/* /*
// faire une rech dans une sous categorie uniquement // faire une rech dans une sous categorie uniquement
print '<tr '.$bc[0].'><td>'; print '<tr '.$bc[0].'><td>';

View File

@ -28,16 +28,16 @@ require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php");
if (!$user->rights->categorie->lire) accessforbidden(); if (!$user->rights->categorie->lire) accessforbidden();
llxHeader ("","",$langs->trans("Categories")); llxHeader("","",$langs->trans("Categories"));
print_fiche_titre ($langs->trans ("CatList")); print_fiche_titre($langs->trans("CatList"));
print '<table border="0" width="100%" class="notopnoleftnoright">'; print '<table border="0" width="100%" class="notopnoleftnoright">';
print '<tr><td valign="top" width="30%" class="notopnoleft">'; print '<tr><td valign="top" width="30%" class="notopnoleft">';
$c = new Categorie ($db); $c = new Categorie($db);
$cats = $c->get_all_categories (); $cats = $c->get_all_categories();
if ($cats != -1) if ($cats != -1)

View File

@ -81,7 +81,7 @@ if ($action == 'addthumb' && $_GET["file"])
* View * View
*/ */
llxHeader ("","",$langs->trans("Categories")); llxHeader("","",$langs->trans("Categories"));
$html = new Form($db); $html = new Form($db);
@ -115,7 +115,7 @@ if (!empty($id) || !empty($ref))
// Path of category // Path of category
print '<tr><td width="20%" class="notopnoleft">'; print '<tr><td width="20%" class="notopnoleft">';
$ways = $object->print_all_ways (); $ways = $object->print_all_ways();
print $langs->trans("Ref").'</td><td>'; print $langs->trans("Ref").'</td><td>';
print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> '; print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
foreach ($ways as $way) foreach ($ways as $way)
@ -131,7 +131,7 @@ if (!empty($id) || !empty($ref))
print '</td></tr>'; print '</td></tr>';
// Visibility // Visibility
/* if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER) /* if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
{ {
if ($object->socid) if ($object->socid)
{ {
@ -172,7 +172,7 @@ if (!empty($id) || !empty($ref))
print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible")); print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
print '</td></tr>'; print '</td></tr>';
} }
*/ */
print "</table>\n"; print "</table>\n";

View File

@ -82,7 +82,7 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi
$html = new Form($db); $html = new Form($db);
llxHeader ("","",$langs->trans("Categories")); llxHeader("","",$langs->trans("Categories"));
if ($mesg) print $mesg.'<br>'; if ($mesg) print $mesg.'<br>';
@ -109,7 +109,7 @@ print '<table border="0" width="100%" class="border">';
// Path of category // Path of category
print '<tr><td width="20%" class="notopnoleft">'; print '<tr><td width="20%" class="notopnoleft">';
$ways = $object->print_all_ways (); $ways = $object->print_all_ways();
print $langs->trans("Ref").'</td><td>'; print $langs->trans("Ref").'</td><td>';
print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> '; print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
foreach ($ways as $way) foreach ($ways as $way)
@ -168,7 +168,7 @@ else
} }
print "</td>"; print "</td>";
print "</tr>\n"; print "</tr>\n";
if (sizeof ($cats) > 0) if (count($cats) > 0)
{ {
$var=true; $var=true;
foreach ($cats as $cat) foreach ($cats as $cat)
@ -217,7 +217,7 @@ if ($object->type == 0)
print "<table class='noborder' width='100%'>\n"; print "<table class='noborder' width='100%'>\n";
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("ProductsAndServices")."</td></tr>\n"; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("ProductsAndServices")."</td></tr>\n";
if (sizeof ($prods) > 0) if (count($prods) > 0)
{ {
$i = 0; $i = 0;
$var=true; $var=true;
@ -255,7 +255,7 @@ if ($object->type == 1)
print "<table class='noborder' width='100%'>\n"; print "<table class='noborder' width='100%'>\n";
print "<tr class='liste_titre'><td>".$langs->trans("Suppliers")."</td></tr>\n"; print "<tr class='liste_titre'><td>".$langs->trans("Suppliers")."</td></tr>\n";
if (sizeof ($socs) > 0) if (count($socs) > 0)
{ {
$i = 0; $i = 0;
$var=true; $var=true;
@ -274,7 +274,7 @@ if ($object->type == 1)
} }
else else
{ {
print "<tr ".$bc[false]."><td>".$langs->trans ("ThisCategoryHasNoSupplier")."</td></tr>"; print "<tr ".$bc[false]."><td>".$langs->trans("ThisCategoryHasNoSupplier")."</td></tr>";
} }
print "</table>\n"; print "</table>\n";
} }
@ -293,7 +293,7 @@ if($object->type == 2)
print "<table class='noborder' width='100%'>\n"; print "<table class='noborder' width='100%'>\n";
print "<tr class='liste_titre'><td>".$langs->trans("Customers")."</td></tr>\n"; print "<tr class='liste_titre'><td>".$langs->trans("Customers")."</td></tr>\n";
if (sizeof ($socs) > 0) if (count($socs) > 0)
{ {
$i = 0; $i = 0;
$var=true; $var=true;
@ -333,7 +333,7 @@ if ($object->type == 3)
print "<table class='noborder' width='100%'>\n"; print "<table class='noborder' width='100%'>\n";
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Member")."</td></tr>\n"; print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Member")."</td></tr>\n";
if (sizeof ($prods) > 0) if (count($prods) > 0)
{ {
$i = 0; $i = 0;
$var=true; $var=true;