From c7a6a67e20c461c037e721293e3ec1c206d349a4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Jun 2017 11:04:29 +0200 Subject: [PATCH] Fix remove warnings --- htdocs/categories/class/categorie.class.php | 22 +++++++++--------- htdocs/categories/index.php | 24 ++++++++++---------- htdocs/core/actions_sendmails.inc.php | 2 +- htdocs/core/boxes/box_services_contracts.php | 6 ++--- htdocs/core/boxes/modules_boxes.php | 10 ++++---- 5 files changed, 31 insertions(+), 33 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index cfe4f3ad169..60ef207bb48 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -53,7 +53,7 @@ class Categorie extends CommonObject const TYPE_PROJECT = 6; const TYPE_BANK_LINE = 'bank_line'; public $picto = 'category'; - + /** * @var array ID mapping from type string @@ -557,7 +557,7 @@ class Categorie extends CommonObject $error++; } } - + if (! $error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_lang"; @@ -814,7 +814,7 @@ class Categorie extends CommonObject $resql = $this->db->query($sql); if ($resql) { - while ($rec = $this->db->fetch_array($resql)) + while ($rec = $this->db->fetch_array($resql)) { if ($onlyids) { @@ -938,7 +938,7 @@ class Categorie extends CommonObject * * @return array Array of categories. this->cats and this->motherof are set. */ - function get_full_arbo($type,$markafterid=0) + function get_full_arbo($type, $markafterid=0) { global $conf, $langs; @@ -1355,7 +1355,7 @@ class Categorie extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."bank_class as a, ".MAIN_DB_PREFIX."bank_categ as c"; $sql.= " WHERE a.lineid=".$id." AND a.fk_categ = c.rowid"; $sql.= " ORDER BY c.label"; - + $res = $this->db->query($sql); if ($res) { @@ -1377,7 +1377,7 @@ class Categorie extends CommonObject { dol_print_error($this->db); return -1; - } + } } else { @@ -1385,7 +1385,7 @@ class Categorie extends CommonObject $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as ct, " . MAIN_DB_PREFIX . "categorie as c"; $sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_" . $this->MAP_CAT_FK[$type] . " = " . (int) $id . " AND c.type = " . $this->MAP_ID[$type]; $sql .= " AND c.entity IN (" . getEntity( 'category', 1 ) . ")"; - + $res = $this->db->query($sql); if ($res) { @@ -1408,7 +1408,7 @@ class Categorie extends CommonObject return -1; } } - + return $cats; } @@ -1434,7 +1434,7 @@ class Categorie extends CommonObject $cats = array(); // For backward compatibility - if (is_numeric( $type )) { + if (is_numeric($type)) { // We want to reverse lookup $map_type = array_flip( $this->MAP_ID ); $type = $map_type[$type]; @@ -1782,8 +1782,8 @@ class Categorie extends CommonObject { return ''; } - - + + /** * Initialise an instance with random values. * Used to build previews or test instances. diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index b68da6fd597..ea4d60e9b5b 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -36,9 +36,8 @@ $langs->load("categories"); if (! $user->rights->categorie->lire) accessforbidden(); $id=GETPOST('id','int'); -$type=(GETPOST('type') ? GETPOST('type') : Categorie::TYPE_PRODUCT); +$type=(GETPOST('type','aZ09') ? GETPOST('type','aZ09') : Categorie::TYPE_PRODUCT); $catname=GETPOST('catname','alpha'); -$section=(GETPOST('section')?GETPOST('section'):0); /* @@ -48,14 +47,15 @@ $section=(GETPOST('section')?GETPOST('section'):0); $categstatic = new Categorie($db); $form = new Form($db); -if ($type == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductsCategoriesArea"); -elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCategoriesArea"); -elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoriesArea"); -elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoriesArea"); -elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactsCategoriesArea"); -elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesArea"); -elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesArea"); -else $title=$langs->trans("CategoriesArea"); +if ($type == Categorie::TYPE_PRODUCT) { $title=$langs->trans("ProductsCategoriesArea"); $typetext='product'; } +elseif ($type == Categorie::TYPE_SUPPLIER) { $title=$langs->trans("SuppliersCategoriesArea"); $typetext='supplier'; } +elseif ($type == Categorie::TYPE_CUSTOMER) { $title=$langs->trans("CustomersCategoriesArea"); $typetext='customer'; } +elseif ($type == Categorie::TYPE_MEMBER) { $title=$langs->trans("MembersCategoriesArea"); $typetext='member'; } +elseif ($type == Categorie::TYPE_CONTACT) { $title=$langs->trans("ContactsCategoriesArea"); $typetext='contact'; } +elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='account'; } +elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; } +elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; } +else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; } $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); @@ -104,7 +104,7 @@ print '
'; */ if ($catname || $id > 0) { - $cats = $categstatic->rechercher($id,$catname,$type); + $cats = $categstatic->rechercher($id, $catname, $typetext); print ''; print ''; @@ -140,7 +140,7 @@ print '

'; // Charge tableau des categories -$cate_arbo = $categstatic->get_full_arbo($type); +$cate_arbo = $categstatic->get_full_arbo($typetext); // Define fulltree array $fulltree=$cate_arbo; diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 7bb3e8aec49..786c1c0db9d 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -447,7 +447,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO { $langs->load("errors"); setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("MailTo")), null, 'warnings'); - dol_syslog('Try to send email with no recipiend defined', LOG_WARNING); + dol_syslog('Try to send email with no recipient defined', LOG_WARNING); $action = 'presend'; } } diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index 3082b787e15..ccdcfbdbe5a 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2011 Laurent Destailleur + * Copyright (C) 2005-2017 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -20,7 +20,7 @@ /** * \file htdocs/core/boxes/box_services_contracts.php * \ingroup produits,services - * \brief Module de generation de l'affichage de la box services_vendus + * \brief Widget of sells products */ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; @@ -124,7 +124,7 @@ class box_services_contracts extends ModeleBoxes $thirdpartytmp->id = $objp->socid; // Multilangs - if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active + if (! empty($conf->global->MAIN_MULTILANGS) && $objp->product_id > 0) // if option multilang is on { $sqld = "SELECT label"; $sqld.= " FROM ".MAIN_DB_PREFIX."product_lang"; diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 662e0b262bc..d83f0e80cba 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -255,14 +255,14 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" $out.= $s; } $out.= ''; - + if (! empty($conf->use_javascript_ajax)) { $sublink=''; if (! empty($head['sublink'])) $sublink.= ''; if (! empty($head['subpicto'])) $sublink.= img_picto($head['subtext'], $head['subpicto'], 'class="'.(empty($head['subclass'])?'':$head['subclass']).'" id="idsubimg'.$this->boxcode.'"'); if (! empty($head['sublink'])) $sublink.= ''; - + $out.= '
'.$langs->trans("FoundCats").'
'; $out.=$sublink; // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object @@ -273,7 +273,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" $out.= ''; $out.= '
'; } - + $out.= "\n"; } @@ -285,10 +285,8 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" { if (isset($contents[$i])) { - - // TR - if (isset($contents[$i][0]['tr'])) $out.= ''; + if (isset($contents[$i][0]['tr'])) $out.= ''; else $out.= ''; // Loop on each TD