From 482a205936a6b6b3c41d686f6c227b8856ae0419 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Aug 2011 02:18:20 +0000 Subject: [PATCH] Qual: Removed errors reported by PHPCodeSniffer --- htdocs/categories/categorie.php | 16 +- htdocs/categories/class/categorie.class.php | 81 +++-- htdocs/categories/edit.php | 6 +- htdocs/categories/fiche.php | 2 +- htdocs/categories/index.php | 2 +- htdocs/categories/liste.php | 52 +-- htdocs/categories/photos.php | 362 ++++++++++---------- htdocs/categories/viewcat.php | 16 +- 8 files changed, 278 insertions(+), 259 deletions(-) diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index 6e96f164d2b..2d758fd42b6 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -322,12 +322,12 @@ else if ($_GET["id"] || $_GET["ref"]) print ''; // Status (to sell) - print ''.$langs->trans("Status").' ('.$langs->trans("Sell").')'.''; + print ''.$langs->trans("Status").' ('.$langs->trans("Sell").')'; print $product->getLibStatut(2,0); print ''; // Status (to buy) - print ''.$langs->trans("Status").' ('.$langs->trans("Buy").')'.''; + print ''.$langs->trans("Status").' ('.$langs->trans("Buy").')'; print $product->getLibStatut(2,1); print ''; @@ -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) { @@ -468,7 +473,7 @@ function formCategory($db,$object,$typeid) $c = new Categorie($db); $cats = $c->containing($object->id,$typeid); - if (sizeof($cats) > 0) + if (count($cats) > 0) { if ($typeid == 0) $title=$langs->trans("ProductIsInCategories"); if ($typeid == 1) $title=$langs->trans("CompanyIsInSuppliersCategories"); @@ -517,7 +522,7 @@ function formCategory($db,$object,$typeid) } print "\n"; } - else if($cats < 0) + else if ($cats < 0) { print $langs->trans("ErrorUnknown"); } @@ -530,6 +535,7 @@ function formCategory($db,$object,$typeid) print $title; print "
"; } + return 0; } $db->close(); diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index e097376d320..55b9eade15c 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -38,7 +38,7 @@ class Categorie { var $error; var $db; - + var $element='category'; var $table_element='category'; @@ -131,7 +131,7 @@ class Categorie // Clean parameters if (empty($this->visible)) $this->visible=0; - $this->parentId = ($this->id_mere) != "" ? intval($this->id_mere) : 0; + $this->parentId = ($this->id_mere) != "" ? intval($this->id_mere) : 0; if ($this->already_exists()) { @@ -217,8 +217,8 @@ class Categorie $this->error=$langs->trans("ImpossibleUpdateCat"); $this->error.=" : ".$langs->trans("CategoryExistsAtSameLevel"); return -1; - } - + } + $this->db->begin(); $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'categorie_association'; @@ -500,10 +500,11 @@ class Categorie } /** - * \brief 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 table Table name for select in table. Full table name will be PREFIX_categorie_table. + * 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 table Table name for select in table. Full table name will be PREFIX_categorie_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) { $sql = "SELECT description FROM ".MAIN_DB_PREFIX."categorie "; $sql .= "WHERE rowid = '".$cate."'"; - $res = $this->db->query ($sql); - $n = $this->db->fetch_array ($res); + $res = $this->db->query($sql); + $n = $this->db->fetch_array($res); return ($n[0]); } @@ -610,7 +614,7 @@ class Categorie function get_full_arbo($type,$markafterid=0) { global $conf; - + $this->cats = array(); // Charge tableau des meres @@ -839,7 +843,7 @@ class Categorie $sql.= " JOIN ".MAIN_DB_PREFIX."categorie_association as ca"; $sql.= " ON c.rowid=ca.fk_categorie_fille"; $sql.= " WHERE ca.fk_categorie_mere=".$this->id_mere; - $sql.= " AND c.label='".$this->db->escape($this->label)."'"; + $sql.= " AND c.label='".$this->db->escape($this->label)."'"; } else // mother_id undefined (so it's root) { @@ -852,14 +856,14 @@ class Categorie $sql.= " JOIN ".MAIN_DB_PREFIX."categorie_association as ca"; $sql.= " ON c.rowid!=ca.fk_categorie_fille"; $sql.= " WHERE c.type=".$this->type; - $sql.= " AND c.label='".$this->db->escape($this->label)."'"; + $sql.= " AND c.label='".$this->db->escape($this->label)."'"; } dol_syslog("Categorie::already_exists sql=".$sql); $res = $this->db->query($sql); if ($res) - { + { if($this->db->num_rows($resql) > 0) // Checking for empty resql - { + { $obj = $this->db->fetch_array($res); /* If object called create, obj cannot have is id. * If object called update, he mustn't have the same label as an other category for this mother. @@ -867,7 +871,7 @@ class Categorie * update may be for label. */ if($obj[0] > 0 && $obj[0] != $this->id) return 1; - } + } return 0; } else @@ -961,7 +965,7 @@ class Categorie /** * print_primary_way() affiche le chemin le plus court pour se rendre a un produit */ - function print_primary_way($id, $sep= " >> ", $url, $type="") + function print_primary_way($id, $sep= " >> ", $url="", $type="") { $primary_way = Array(); $way = $this->get_primary_way($id,$type); @@ -1073,8 +1077,14 @@ class Categorie /** - * \brief Retourne les categories dont l'id ou le nom correspond - * ajoute des wildcards au nom sauf si $exact = true + * Retourne les categories dont l'id ou le nom correspond + * 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) { @@ -1115,11 +1125,12 @@ class Categorie } /** - * \brief 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 maxlength Max length of text - * \return string Chaine avec URL + * 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 maxlength Max length of text + * @return string Chaine avec URL */ 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 - * \param sdir Repertoire destination finale - * \param $file Nom du fichier uploade - * \param maxWidth Largeur maximum que dois faire la miniature (160 par defaut) - * \param maxHeight Hauteur maximum que dois faire la miniature (120 par defaut) + * Deplace fichier uploade sous le nom $files dans le repertoire sdir + * + * @param sdir Repertoire destination finale + * @param $file Nom du fichier uploade + * @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) { @@ -1194,10 +1206,11 @@ class Categorie /** - * \brief Retourne tableau de toutes les photos de la categorie - * \param dir Repertoire a scanner - * \param nbmax Nombre maximum de photos (0=pas de max) - * \return array Tableau de photos + * Return tableau de toutes les photos de la categorie + * + * @param dir Repertoire a scanner + * @param nbmax Nombre maximum de photos (0=pas de max) + * @return array Tableau de photos */ function liste_photos($dir,$nbmax=0) { diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index b6b0d681e21..2ce4e6e5f5f 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -52,7 +52,7 @@ $result = restrictedArea($user, 'categorie', $id); // Action mise a jour d'une categorie if ($action == 'update' && $user->rights->categorie->creer) { - $categorie = new Categorie ($db); + $categorie = new Categorie($db); $result=$categorie->fetch($id); $categorie->label = $_POST["nom"]; @@ -112,7 +112,7 @@ if ($mesg) print ''; } -$categorie = new Categorie ($db, $id); +$categorie = new Categorie($db, $id); $html = new Form($db); print ''; @@ -144,7 +144,7 @@ $doleditor->Create(); print ''; // Parent category -print ''; diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index 39d10b7178a..5ac78405053 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -215,7 +215,7 @@ if ($user->rights->categorie->creer) print ''; // Parent category - print ''; diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 43281d0383f..29fa9decf7f 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -69,7 +69,7 @@ print ''; print ''; print ''; print ''; +print $langs->trans("Name").':'; /* // faire une rech dans une sous categorie uniquement print '
'.$langs->trans ("In").''; +print '
'.$langs->trans("In").''; print $html->select_all_categories($type,$categorie->id_mere,'catMere',64,$categorie->id); print '
'.$langs->trans ("AddIn").''; + print '
'.$langs->trans("AddIn").''; print $html->select_all_categories($type,$catorigin); print '
'.$langs->trans("Search").'
'; -print $langs->trans("Name").':
'; diff --git a/htdocs/categories/liste.php b/htdocs/categories/liste.php index f91b81ea5e5..143aac02eec 100644 --- a/htdocs/categories/liste.php +++ b/htdocs/categories/liste.php @@ -28,47 +28,47 @@ require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php"); 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 ''; print '
'; -$c = new Categorie ($db); -$cats = $c->get_all_categories (); +$c = new Categorie($db); +$cats = $c->get_all_categories(); if ($cats != -1) { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $var=true; - foreach ($cats as $cat) + print '
'.$langs->trans("Ref").''.$langs->trans("Description").''.$langs->trans("Type").'
'; + print ''; + print ''; + print ''; + print ''; + print ''; + + $var=true; + foreach ($cats as $cat) { - $var = ! $var; - print "\t\n"; - print "\t\t\n"; - print "\t\t\n"; - print '\n"; - print "\t\n"; + $var = ! $var; + print "\t\n"; + print "\t\t\n"; + print "\t\t\n"; + print '\n"; + print "\t\n"; } - print "
'.$langs->trans("Ref").''.$langs->trans("Description").''.$langs->trans("Type").'
".$cat->label."".dol_trunc($cat->description,36)."'; - if ($cat->type == 0) print $langs->trans("Product"); - elseif ($cat->type == 1) print $langs->trans("Supplier"); - elseif ($cat->type == 2) print $langs->trans("Customer"); - else print $cat->type; - print "
".$cat->label."".dol_trunc($cat->description,36)."'; + if ($cat->type == 0) print $langs->trans("Product"); + elseif ($cat->type == 1) print $langs->trans("Supplier"); + elseif ($cat->type == 2) print $langs->trans("Customer"); + else print $cat->type; + print "
"; + print "
"; } else { - dol_print_error(); + dol_print_error(); } print '
'; diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 3a810ddab0c..56d2d844204 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -43,8 +43,8 @@ $confirm=GETPOST('confirm'); if ($id == "") { - dol_print_error('','Missing parameter id'); - exit(); + dol_print_error('','Missing parameter id'); + exit(); } // Security check @@ -58,22 +58,22 @@ $object = new Categorie($db); if ($_FILES['userfile']['size'] > 0 && $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) { - if ($id) - { - $result = $object->fetch($id); + if ($id) + { + $result = $object->fetch($id); - $result = $object->add_photo($conf->categorie->dir_output, $_FILES['userfile']); - } + $result = $object->add_photo($conf->categorie->dir_output, $_FILES['userfile']); + } } if ($action == 'confirm_delete' && $_GET["file"] && $confirm == 'yes' && $user->rights->categorie->creer) { - $object->delete_photo($conf->categorie->dir_output."/".$_GET["file"]); + $object->delete_photo($conf->categorie->dir_output."/".$_GET["file"]); } if ($action == 'addthumb' && $_GET["file"]) { - $object->add_thumb($conf->categorie->dir_output."/".$_GET["file"]); + $object->add_thumb($conf->categorie->dir_output."/".$_GET["file"]); } @@ -81,223 +81,223 @@ if ($action == 'addthumb' && $_GET["file"]) * View */ -llxHeader ("","",$langs->trans("Categories")); +llxHeader("","",$langs->trans("Categories")); $html = new Form($db); if (!empty($id) || !empty($ref)) { - $result = $object->fetch($id); + $result = $object->fetch($id); - if ($result) - { - $title=$langs->trans("ProductsCategoryShort"); - if ($type == 0) $title=$langs->trans("ProductsCategoryShort"); - elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort"); - elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort"); - elseif ($type == 3) $title=$langs->trans("MembersCategoryShort"); + if ($result) + { + $title=$langs->trans("ProductsCategoryShort"); + if ($type == 0) $title=$langs->trans("ProductsCategoryShort"); + elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort"); + elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort"); + elseif ($type == 3) $title=$langs->trans("MembersCategoryShort"); - $head = categories_prepare_head($object,$type); - dol_fiche_head($head, 'photos', $title, 0, 'category'); + $head = categories_prepare_head($object,$type); + dol_fiche_head($head, 'photos', $title, 0, 'category'); - /* - * Confirmation de la suppression de photo - */ - if ($action == 'delete') - { - $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1); - if ($ret == 'html') print '
'; - } + /* + * Confirmation de la suppression de photo + */ + if ($action == 'delete') + { + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1); + if ($ret == 'html') print '
'; + } - print($mesg); + print($mesg); - print ''; + print '
'; - // Path of category - print ''; + // Path of category + print ''; - // Description - print ''; + // Description + print ''; - // Visibility -/* if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER) - { - if ($object->socid) - { - $soc = new Societe($db); - $soc->fetch($object->socid); + // Visibility + /* if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER) + { + if ($object->socid) + { + $soc = new Societe($db); + $soc->fetch($object->socid); - print ''; + print ''; - $catsMeres = $object->get_meres (); + $catsMeres = $object->get_meres (); - if ($catsMeres < 0) - { - dol_print_error(); - } - else if (count($catsMeres) > 0) - { - print ''; - } - } - else - { - print ''; - } - } - else - { - print ''; - } -*/ + if ($catsMeres < 0) + { + dol_print_error(); + } + else if (count($catsMeres) > 0) + { + print ''; + } + } + else + { + print ''; + } + } + else + { + print ''; + } + */ - print "
'; - $ways = $object->print_all_ways (); - print $langs->trans("Ref").''; - print ''.$langs->trans("Root").' >> '; - foreach ($ways as $way) - { - print $way."
\n"; - } - print '
'; + $ways = $object->print_all_ways(); + print $langs->trans("Ref").''; + print ''.$langs->trans("Root").' >> '; + foreach ($ways as $way) + { + print $way."
\n"; + } + print '
'; - print $langs->trans("Description").''; - print nl2br($object->description); - print '
'; + print $langs->trans("Description").''; + print nl2br($object->description); + print '
'; - print $langs->trans("AssignedToTheCustomer").''; - print $soc->getNomUrl(1); - print '
'; + print $langs->trans("AssignedToTheCustomer").''; + print $soc->getNomUrl(1); + print '
'; - print $langs->trans("CategoryContents").''; - print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible")); - print '
'; - print $langs->trans("CategoryContents").''; - print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible")); - print '
'; - print $langs->trans("CategoryContents").''; - print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible")); - print '
'; + print $langs->trans("CategoryContents").''; + print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible")); + print '
'; + print $langs->trans("CategoryContents").''; + print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible")); + print '
'; + print $langs->trans("CategoryContents").''; + print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible")); + print '
\n"; + print "\n"; - print "\n"; + print "\n"; - /* ************************************************************************** */ - /* */ - /* Barre d'action */ - /* */ - /* ************************************************************************** */ + /* ************************************************************************** */ + /* */ + /* Barre d'action */ + /* */ + /* ************************************************************************** */ - print "\n
\n"; + print "\n
\n"; - if ($action != 'ajout_photo' && $user->rights->produit->creer) - { - if (! empty($conf->global->MAIN_UPLOAD_DOC)) - { - print ''; - print $langs->trans("AddPhoto").''; - } - else - { - print ''; - print $langs->trans("AddPhoto").''; - } - } + if ($action != 'ajout_photo' && $user->rights->produit->creer) + { + if (! empty($conf->global->MAIN_UPLOAD_DOC)) + { + print ''; + print $langs->trans("AddPhoto").''; + } + else + { + print ''; + print $langs->trans("AddPhoto").''; + } + } - print "\n
\n"; + print "\n
\n"; - /* - * Ajouter une photo - */ - if ($action == 'ajout_photo' && $user->rights->categorie->creer && ! empty($conf->global->MAIN_UPLOAD_DOC)) - { - // Affiche formulaire upload - $formfile=new FormFile($db); - $formfile->form_attach_new_file(DOL_URL_ROOT.'/categories/photos.php?id='.$object->id.'&type='.$type,$langs->trans("AddPhoto"),1); - } + /* + * Ajouter une photo + */ + if ($action == 'ajout_photo' && $user->rights->categorie->creer && ! empty($conf->global->MAIN_UPLOAD_DOC)) + { + // Affiche formulaire upload + $formfile=new FormFile($db); + $formfile->form_attach_new_file(DOL_URL_ROOT.'/categories/photos.php?id='.$object->id.'&type='.$type,$langs->trans("AddPhoto"),1); + } - // Affiche photos - if ($action != 'ajout_photo') - { - $nbphoto=0; - $nbbyrow=5; + // Affiche photos + if ($action != 'ajout_photo') + { + $nbphoto=0; + $nbbyrow=5; - $maxWidth = 160; - $maxHeight = 120; + $maxWidth = 160; + $maxHeight = 120; - $pdir = get_exdir($object->id,2) . $object->id ."/photos/"; - $dir = $conf->categorie->dir_output.'/'.$pdir; + $pdir = get_exdir($object->id,2) . $object->id ."/photos/"; + $dir = $conf->categorie->dir_output.'/'.$pdir; - print '
'; - print ''; + print '
'; + print '
'; - foreach ($object->liste_photos($dir) as $key => $obj) - { - $nbphoto++; + foreach ($object->liste_photos($dir) as $key => $obj) + { + $nbphoto++; - if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print ''; - if ($nbbyrow) print ''; + if ($nbbyrow) print ''; - if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print ''; - } + // On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites + if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i',$obj['photo']) && ($object->imgWidth > $maxWidth || $object->imgHeight > $maxHeight)) + { + print ''.img_picto($langs->trans('GenerateThumb'),'refresh').'  '; + } + if ($user->rights->categorie->creer) + { + print ''; + print img_delete().''; + } + if ($nbbyrow) print ''; + if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print ''; + } - // Ferme tableau - while ($nbphoto % $nbbyrow) - { - print ''; - $nbphoto++; - } + // Ferme tableau + while ($nbphoto % $nbbyrow) + { + print ''; + $nbphoto++; + } - if ($nbphoto < 1) - { - print ''; - } + if ($nbphoto < 1) + { + print ''; + } - print '
'; + if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print '
'; - print ''; + print ''; - // Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine - if ($obj['photo_vignette']) - { - $filename='thumbs/'.$obj['photo_vignette']; - } - else - { - $filename=$obj['photo']; - } + // Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine + if ($obj['photo_vignette']) + { + $filename='thumbs/'.$obj['photo_vignette']; + } + else + { + $filename=$obj['photo']; + } - // Nom affiche - $viewfilename=$obj['photo']; + // Nom affiche + $viewfilename=$obj['photo']; - // Taille de l'image - $object->get_image_size($dir.$filename); - $imgWidth = ($object->imgWidth < $maxWidth) ? $object->imgWidth : $maxWidth; - $imgHeight = ($object->imgHeight < $maxHeight) ? $object->imgHeight : $maxHeight; + // Taille de l'image + $object->get_image_size($dir.$filename); + $imgWidth = ($object->imgWidth < $maxWidth) ? $object->imgWidth : $maxWidth; + $imgHeight = ($object->imgHeight < $maxHeight) ? $object->imgHeight : $maxHeight; - print ''; + print ''; - print ''; - print '
'.$viewfilename; - print '
'; + print ''; + print '
'.$viewfilename; + print '
'; - // On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites - if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i',$obj['photo']) && ($object->imgWidth > $maxWidth || $object->imgHeight > $maxHeight)) - { - print ''.img_picto($langs->trans('GenerateThumb'),'refresh').'  '; - } - if ($user->rights->categorie->creer) - { - print ''; - print img_delete().''; - } - if ($nbbyrow) print '
  
'; - print "
".$langs->trans("NoPhotoYet")."

"; - print '
'; + print "
".$langs->trans("NoPhotoYet")."

"; + print '
'; - } - } + print ''; + } + } } else { - print $langs->trans("ErrorUnknown"); + print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 478bd124928..c1bb3b9739d 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -82,7 +82,7 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi $html = new Form($db); -llxHeader ("","",$langs->trans("Categories")); +llxHeader("","",$langs->trans("Categories")); if ($mesg) print $mesg.'
'; @@ -109,7 +109,7 @@ print ''; // Path of category print '"; print "\n"; - if (sizeof ($cats) > 0) + if (count($cats) > 0) { $var=true; foreach ($cats as $cat) @@ -217,7 +217,7 @@ if ($object->type == 0) print "
'; -$ways = $object->print_all_ways (); +$ways = $object->print_all_ways(); print $langs->trans("Ref").''; print ''.$langs->trans("Root").' >> '; foreach ($ways as $way) @@ -168,7 +168,7 @@ else } print "
\n"; print '\n"; - if (sizeof ($prods) > 0) + if (count($prods) > 0) { $i = 0; $var=true; @@ -255,7 +255,7 @@ if ($object->type == 1) print "
'.$langs->trans("ProductsAndServices")."
\n"; print "\n"; - if (sizeof ($socs) > 0) + if (count($socs) > 0) { $i = 0; $var=true; @@ -274,7 +274,7 @@ if ($object->type == 1) } else { - print ""; + print ""; } print "
".$langs->trans("Suppliers")."
".$langs->trans ("ThisCategoryHasNoSupplier")."
".$langs->trans("ThisCategoryHasNoSupplier")."
\n"; } @@ -293,7 +293,7 @@ if($object->type == 2) print "\n"; print "\n"; - if (sizeof ($socs) > 0) + if (count($socs) > 0) { $i = 0; $var=true; @@ -333,7 +333,7 @@ if ($object->type == 3) print "
".$langs->trans("Customers")."
\n"; print '\n"; - if (sizeof ($prods) > 0) + if (count($prods) > 0) { $i = 0; $var=true;
'.$langs->trans("Member")."