diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8250671598f..b5bc097d8e2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5987,7 +5987,7 @@ function print_fiche_titre($title, $mesg = '', $picto = 'generic', $pictoisfullp /** * Load a title with picto * - * @param string $titre Title to show + * @param string $title Title to show * @param string $morehtmlright Added message to show on right * @param string $picto Icon to use before title (should be a 32x32 transparent png file) * @param int $pictoisfullpath 1=Icon name is a full absolute url of image @@ -5997,7 +5997,7 @@ function print_fiche_titre($title, $mesg = '', $picto = 'generic', $pictoisfullp * @return string * @see print_barre_liste() */ -function load_fiche_titre($titre, $morehtmlright = '', $picto = 'generic', $pictoisfullpath = 0, $id = '', $morecssontable = '', $morehtmlcenter = '') +function load_fiche_titre($title, $morehtmlright = '', $picto = 'generic', $pictoisfullpath = 0, $id = '', $morecssontable = '', $morehtmlcenter = '') { $return = ''; @@ -6012,7 +6012,7 @@ function load_fiche_titre($titre, $morehtmlright = '', $picto = 'generic', $pict $return .= ''.img_picto('', $picto, 'class="valignmiddle widthpictotitle pictotitle"', $pictoisfullpath).''; } $return .= ''; - $return .= '
'.$titre.'
'; + $return .= '
'.dol_escape_htmltag($title).'
'; $return .= ''; if (dol_strlen($morehtmlcenter)) { $return .= ''.$morehtmlcenter.''; @@ -6028,7 +6028,7 @@ function load_fiche_titre($titre, $morehtmlright = '', $picto = 'generic', $pict /** * Print a title with navigation controls for pagination * - * @param string $titre Title to show (required) + * @param string $title Title to show (required) * @param int|null $page Numero of page to show in navigation links (required) * @param string $file Url of page (required) * @param string $options More parameters for links ('' by default, does not include sortfield neither sortorder). Value must be 'urlencoded' before calling function. @@ -6048,7 +6048,7 @@ function load_fiche_titre($titre, $morehtmlright = '', $picto = 'generic', $pict * @param string $morehtmlrightbeforearrow More html to show (before arrows) * @return void */ -function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '', $sortorder = '', $morehtmlcenter = '', $num = -1, $totalnboflines = '', $picto = 'generic', $pictoisfullpath = 0, $morehtmlright = '', $morecss = '', $limit = -1, $hideselectlimit = 0, $hidenavigation = 0, $pagenavastextinput = 0, $morehtmlrightbeforearrow = '') +function print_barre_liste($title, $page, $file, $options = '', $sortfield = '', $sortorder = '', $morehtmlcenter = '', $num = -1, $totalnboflines = '', $picto = 'generic', $pictoisfullpath = 0, $morehtmlright = '', $morecss = '', $limit = -1, $hideselectlimit = 0, $hidenavigation = 0, $pagenavastextinput = 0, $morehtmlrightbeforearrow = '') { global $conf; @@ -6083,13 +6083,13 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '', // Left - if ($picto && $titre) { + if ($picto && $title) { print ''.img_picto('', $picto, 'class="valignmiddle pictotitle widthpictotitle"', $pictoisfullpath).''; } print ''; - print '
'.$titre; - if (!empty($titre) && $savtotalnboflines >= 0 && (string) $savtotalnboflines != '') { + print '
'.dol_escape_htmltag($title); + if (!empty($title) && $savtotalnboflines >= 0 && (string) $savtotalnboflines != '') { print '('.$totalnboflines.')'; } print '
'; diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 217193f04c0..a36088815d5 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -1655,15 +1655,12 @@ if ($ok && GETPOST('repair_supplier_order_duplicate_ref')) { if ($ok && GETPOST('recalculateinvoicetotal') == 'confirmed') { $err = 0; $db->begin(); - $sql = " - SELECT - f.rowid, - SUM(fd.total_ht) as total_ht - FROM ".MAIN_DB_PREFIX."facture f - LEFT JOIN ".MAIN_DB_PREFIX."facturedet fd - ON fd.fk_facture = f.rowid - WHERE f.total_ht = 0 - GROUP BY fd.fk_facture HAVING SUM(fd.total_ht) != 0"; + $sql = "SELECT f.rowid, SUM(fd.total_ht) as total_ht"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture f"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facturedet fd ON fd.fk_facture = f.rowid"; + $sql .= " WHERE f.total_ht = 0"; + $sql .= " GROUP BY fd.fk_facture HAVING SUM(fd.total_ht) <> 0"; + $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); @@ -1675,27 +1672,27 @@ if ($ok && GETPOST('recalculateinvoicetotal') == 'confirmed') { while ($i < $num) { $obj = $db->fetch_object($resql); $sql_calculs = " - SELECT - SUM(fd.total_ht) as 'total_ht', + SELECT + SUM(fd.total_ht) as 'total_ht', SUM(fd.total_tva) as 'total_tva', SUM(fd.total_localtax1) as 'localtax1', SUM(fd.total_localtax2) as 'localtax2', SUM(fd.total_ttc) as 'total_ttc' FROM ".MAIN_DB_PREFIX."facturedet fd - WHERE + WHERE fd.fk_facture = $obj->rowid"; $ressql_calculs = $db->query($sql_calculs); while ($obj_calcul = $db->fetch_object($ressql_calculs)) { $sql_maj = " - UPDATE ".MAIN_DB_PREFIX."facture - SET - total_ht = ".($obj_calcul->total_ht ? price2num($obj_calcul->total_ht, 'MT') : 0).", - total_tva = ".($obj_calcul->total_tva ? price2num($obj_calcul->total_tva, 'MT') : 0).", - localtax1 = ".($obj_calcul->localtax1 ? price2num($obj_calcul->localtax1, 'MT') : 0).", - localtax2 = ".($obj_calcul->localtax2 ? price2num($obj_calcul->localtax2, 'MT') : 0).", - total_ttc = ".($obj_calcul->total_ttc ? price2num($obj_calcul->total_ttc, 'MT') : 0)." - WHERE + UPDATE ".MAIN_DB_PREFIX."facture + SET + total_ht = ".($obj_calcul->total_ht ? price2num($obj_calcul->total_ht, 'MT') : 0).", + total_tva = ".($obj_calcul->total_tva ? price2num($obj_calcul->total_tva, 'MT') : 0).", + localtax1 = ".($obj_calcul->localtax1 ? price2num($obj_calcul->localtax1, 'MT') : 0).", + localtax2 = ".($obj_calcul->localtax2 ? price2num($obj_calcul->localtax2, 'MT') : 0).", + total_ttc = ".($obj_calcul->total_ttc ? price2num($obj_calcul->total_ttc, 'MT') : 0)." + WHERE rowid = $obj->rowid"; $db->query($sql_maj); } diff --git a/htdocs/product/messaging.php b/htdocs/product/messaging.php index c642172d3de..ce9125d90c3 100644 --- a/htdocs/product/messaging.php +++ b/htdocs/product/messaging.php @@ -216,11 +216,11 @@ $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'f if (isModEnabled('agenda')) { $permok = $user->hasRight('agenda', 'myactions', 'create'); - if ((!empty($objproduct->id) || !empty($objcon->id)) && $permok) { - if (get_class($objproduct) == 'Product') { - $out .= '&prodid='.$objproduct->id.'&origin=product&originid='.$id; + if (!empty($object->id) && $permok) { + if (get_class($object) == 'Product') { + $out .= '&prodid='.$object->id.'&origin=product&originid='.$id; } - $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '').'&backtopage='.$_SERVER["PHP_SELF"].'?id='.$object->id; + $out .= '&backtopage='.$_SERVER["PHP_SELF"].'?id='.$object->id; } $linktocreatetimeBtnStatus = $user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create'); diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index e8d692ec846..74bfe4e6d74 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -170,7 +170,8 @@ if ($result) { $i = 0; $param = "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield"; - print_barre_liste($langs->trans("ListOfValidatedPublicMembers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, ''); + $title = $langs->trans("ListOfValidatedPublicMembers"); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, ''); print ''; print '';