diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 5b2f807fcd7..242fc71d80c 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2016-2019 Alexandre Spangaro - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -220,7 +220,7 @@ if ($conf->accounting->enabled) { /* * Show boxes */ - $boxlist .= '
'; + $boxlist = '
'; $boxlist .= '
'; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 53c85e6a05d..6429f86311a 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2216,7 +2216,7 @@ class Adherent extends CommonObject $statusType = 'status1'; $labelStatus = $langs->trans("MemberStatusActive"); $labelStatusShort = $langs->trans("MemberStatusActiveShort"); - } elseif ($date_end_subscription < time()) { + } elseif ($date_end_subscription < dol_now()) { $statusType = 'status3'; $labelStatus = $langs->trans("MemberStatusActiveLate"); $labelStatusShort = $langs->trans("MemberStatusActiveLateShort"); diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 7ec39b7eda8..4a4724593e4 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -79,10 +79,10 @@ $subscriptionstatic = new Subscription($db); print load_fiche_titre($langs->trans("MembersArea"), $resultboxes['selectboxlist'], 'members'); -$Adherents = array(); -$AdherentsAValider = array(); -$MemberUpToDate = array(); -$AdherentsResilies = array(); +$MembersValidated = array(); +$MembersToValidate = array(); +$MembersUpToDate = array(); +$MembersResiliated = array(); $AdherentType = array(); @@ -111,7 +111,7 @@ if ($result) { $AdherentType[$objp->rowid] = $adhtype; if ($objp->statut == -1) { - $MemberToValidate[$objp->rowid] = $objp->somme; + $MembersToValidate[$objp->rowid] = $objp->somme; } if ($objp->statut == 1) { $MembersValidated[$objp->rowid] = $objp->somme; @@ -144,7 +144,7 @@ if ($result) { $i = 0; while ($i < $num) { $objp = $db->fetch_object($result); - $MemberUpToDate[$objp->fk_adherent_type] = $objp->somme; + $MembersUpToDate[$objp->fk_adherent_type] = $objp->somme; $i++; } $db->free(); @@ -202,13 +202,13 @@ if ($conf->use_javascript_ajax) { $dataval = array(); $i = 0; foreach ($AdherentType as $key => $adhtype) { - $dataval['draft'][] = array($i, isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0); - $dataval['notuptodate'][] = array($i, isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0); - $dataval['uptodate'][] = array($i, isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0); + $dataval['draft'][] = array($i, isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0); + $dataval['notuptodate'][] = array($i, isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : 0); + $dataval['uptodate'][] = array($i, isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0); $dataval['resiliated'][] = array($i, isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0); - $SommeA += isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0; - $SommeB += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0; - $SommeC += isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0; + $SommeA += isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0; + $SommeB += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : 0; + $SommeC += isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0; $SommeD += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0; $i++; } @@ -476,9 +476,9 @@ print "\n"; foreach ($AdherentType as $key => $adhtype) { print ''; print ''.$adhtype->getNomUrl(1, dol_size(32)).''; - print ''.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0 ? $MemberToValidate[$key] : '').' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3).''; - print ''.(isset($MembersValidated[$key]) && ($MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) > 0) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : '').' '.$staticmember->LibStatut(1, $adhtype->subscription, 0, 3).''; - print ''.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key] : '').' '.$staticmember->LibStatut(1, $adhtype->subscription, $now, 3).''; + print ''.(isset($MembersToValidate[$key]) && $MembersToValidate[$key] > 0 ? $MembersToValidate[$key] : '').' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3).''; + print ''.(isset($MembersValidated[$key]) && ($MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) > 0) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : '').' '.$staticmember->LibStatut(1, $adhtype->subscription, 0, 3).''; + print ''.(isset($MembersUpToDate[$key]) && $MembersUpToDate[$key] > 0 ? $MembersUpToDate[$key] : '').' '.$staticmember->LibStatut(1, $adhtype->subscription, $now, 3).''; print ''.(isset($MembersResiliated[$key]) && $MembersResiliated[$key] > 0 ? $MembersResiliated[$key] : '').' '.$staticmember->LibStatut(0, $adhtype->subscription, 0, 3).''; print "\n"; } diff --git a/htdocs/admin/eventorganization_confbooth_extrafields.php b/htdocs/admin/eventorganization_confbooth_extrafields.php index 4e45b0fddc3..4b6f9bdc46a 100644 --- a/htdocs/admin/eventorganization_confbooth_extrafields.php +++ b/htdocs/admin/eventorganization_confbooth_extrafields.php @@ -60,7 +60,7 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; */ -llxHeader('', $langs->trans("EventOrganizationSetup"), $help_url); +llxHeader('', $langs->trans("EventOrganizationSetup")); $linkback = ''.$langs->trans("BackToModuleList").''; diff --git a/htdocs/bom/lib/bom.lib.php b/htdocs/bom/lib/bom.lib.php index a5be872a096..8f3cadeedc2 100644 --- a/htdocs/bom/lib/bom.lib.php +++ b/htdocs/bom/lib/bom.lib.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2021 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,17 +41,11 @@ function bomAdminPrepareHead() $head[$h][2] = 'settings'; $h++; - $head[$h][0] = dol_buildpath("/admin/bom_extrafields.php", 1); + $head[$h][0] = DOL_URL_ROOT."/admin/bom_extrafields.php"; $head[$h][1] = $langs->trans("ExtraFields"); $head[$h][2] = 'bom_extrafields'; $h++; - /*$head[$h][0] = DOL_URL_ROOT."/bom/admin/about.php"; - $head[$h][1] = $langs->trans("About"); - $head[$h][2] = 'about'; - $h++; - */ - // Show more tabs from modules // Entries must be declared in modules descriptor with line //$this->tabs = array( diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index aa2dc20e2b2..6ca392aef47 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -5,6 +5,7 @@ * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -151,7 +152,7 @@ $cate_arbo = $categstatic->get_full_arbo($typetext); $fulltree = $cate_arbo; // Load possible missing includes -if ($conf->global->CATEGORY_SHOW_COUNTS) { +if (!empty($conf->global->CATEGORY_SHOW_COUNTS)) { if ($type == Categorie::TYPE_MEMBER) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; } @@ -177,7 +178,7 @@ foreach ($fulltree as $key => $val) { $desc = dol_htmlcleanlastbr($val['description']); $counter = ''; - if ($conf->global->CATEGORY_SHOW_COUNTS) { + if (!empty($conf->global->CATEGORY_SHOW_COUNTS)) { // we need only a count of the elements, so it is enough to consume only the id's from the database $elements = $type == Categorie::TYPE_ACCOUNT ? $categstatic->getObjectsInCateg("account", 1) // Categorie::TYPE_ACCOUNT is "bank_account" instead of "account" diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index a125dc466f8..3616de126be 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -7,7 +7,7 @@ * Copyright (C) 2014 Cedric GROSS * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Open-DSI - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -258,7 +258,13 @@ if (empty($conf->global->AGENDA_DISABLE_EXT)) { $buggedfile = 'AGENDA_EXT_BUGGEDFILE'.$i; if (!empty($conf->global->$source) && !empty($conf->global->$name)) { // Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight' - $listofextcals[] = array('src'=>$conf->global->$source, 'name'=>$conf->global->$name, 'offsettz'=>$conf->global->$offsettz, 'color'=>$conf->global->$color, 'buggedfile'=>(isset($conf->global->buggedfile) ? $conf->global->buggedfile : 0)); + $listofextcals[] = array( + 'src'=>$conf->global->$source, + 'name'=>$conf->global->$name, + 'offsettz' => (!empty($conf->global->$offsettz) ? $conf->global->$offsettz : 0), + 'color'=>$conf->global->$color, + 'buggedfile'=>(isset($conf->global->buggedfile) ? $conf->global->buggedfile : 0) + ); } } } @@ -275,7 +281,13 @@ if (empty($user->conf->AGENDA_DISABLE_EXT)) { $buggedfile = 'AGENDA_EXT_BUGGEDFILE_'.$user->id.'_'.$i; if (!empty($user->conf->$source) && !empty($user->conf->$name)) { // Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight' - $listofextcals[] = array('src'=>$user->conf->$source, 'name'=>$user->conf->$name, 'offsettz'=>$user->conf->$offsettz, 'color'=>$user->conf->$color, 'buggedfile'=>(isset($user->conf->buggedfile) ? $user->conf->buggedfile : 0)); + $listofextcals[] = array( + 'src'=>$user->conf->$source, + 'name'=>$user->conf->$name, + 'offsettz' => (!empty($user->conf->$offsettz) ? $user->conf->$offsettz : 0), + 'color'=>$user->conf->$color, + 'buggedfile'=>(isset($user->conf->buggedfile) ? $user->conf->buggedfile : 0) + ); } } } diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 44bd8547e8a..908819e1d1a 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -38,6 +38,7 @@ $action = GETPOST('action', 'aZ09'); $month = GETPOST('month', 'int'); $year = GETPOST('year', 'int'); +$optioncss = GETPOST('optioncss', 'alpha'); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 9e25cc3deee..542d7aeb1bd 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -9,6 +9,7 @@ * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2020 Josep Lluís Amador + * Copyright (C) 2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -997,6 +998,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) { $sql .= ", s.nom as name"; $sql .= ", s.rowid as socid, s.email"; $sql .= ", s.code_client, s.code_compta"; + $sql .= ", s.code_fournisseur, s.code_compta_fournisseur"; $sql .= ", cc.rowid as country_id, cc.code as country_code"; $sql .= ", sum(pf.amount) as am"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays,".MAIN_DB_PREFIX."facture as f"; @@ -1019,6 +1021,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) { $sql .= " GROUP BY f.rowid, f.ref, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,"; $sql .= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, cc.rowid, cc.code"; + $sql .= ", s.code_fournisseur, s.code_compta_fournisseur"; $sql .= " ORDER BY f.datef ASC, f.ref ASC"; $resql = $db->query($sql); diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index e2047d00738..79379ee0b24 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -114,7 +114,7 @@ if (empty($min)) { // Define modetax (0 or 1) // 0=normal, 1=option vat for services is on debit, 2=option on payments for products -$modetax = $conf->global->TAX_MODE; +$modetax = empty($conf->global->TAX_MODE) ? 0 : $conf->global->TAX_MODE; if (GETPOSTISSET("modetax")) { $modetax = GETPOST("modetax", 'int'); } diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 788067ec696..c1f89dd3bbc 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -4,7 +4,7 @@ * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2006-2015 Yannick Warnier * Copyright (C) 2014 Ferran Marcet - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2019 Eric Seigne * * This program is free software; you can redistribute it and/or modify @@ -116,16 +116,16 @@ if (empty($min)) { // Define modetax (0 or 1) // 0=normal, 1=option vat for services is on debit, 2=option on payments for products -$modetax = $conf->global->TAX_MODE; +$modetax = (empty($conf->global->TAX_MODE) ? 0 : $conf->global->TAX_MODE); if (GETPOSTISSET("modetax")) { - $modetax = GETPOST("modetax", 'int'); + $modetax = GETPOSTINT("modetax"); } if (empty($modetax)) { $modetax = 0; } // Security check -$socid = GETPOST('socid', 'int'); +$socid = GETPOSTINT('socid'); if ($user->socid) { $socid = $user->socid; } @@ -242,7 +242,7 @@ if ($mysoc->tva_assuj) { $vatsup .= ' ('.$langs->trans("ToGetBack").')'; } -$optioncss = GETPOST('optioncss'); +$optioncss = GETPOST('optioncss', 'alpha'); if ($optioncss != "print") { report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode); } diff --git a/htdocs/core/boxes/box_accountancy_last_manual_entries.php b/htdocs/core/boxes/box_accountancy_last_manual_entries.php index f3893692845..13b4d92a36f 100644 --- a/htdocs/core/boxes/box_accountancy_last_manual_entries.php +++ b/htdocs/core/boxes/box_accountancy_last_manual_entries.php @@ -102,9 +102,11 @@ class box_accountancy_last_manual_entries extends ModeleBoxes $date = $this->db->jdate($objp->date_movement); $journal = $objp->code_journal; $label = $objp->label_operation; - $amount = $objp->amount; + $amount = $objp->amount; - $bookkeepingstatic->id = $objp->id; + // adding id (rowid) will give two lines (debit and credit) + // so rowid isn't in sql request + // $bookkeepingstatic->id = $objp->id; $bookkeepingstatic->piece_num = $objp->piece_num; $this->info_box_contents[$line][] = array( diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index fb618813f56..4a0114b5244 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2015 Bahfir Abbes * Copyright (C) 2016-2017 Ferran Marcet - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -966,6 +966,7 @@ class FormFile // Loop on each file found $found = 0; + $i = 0; foreach ($file_list as $file) { $i++; if ($filter && !preg_match('/'.$filter.'/i', $file["name"])) { diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index 6b2526477b3..36a74f8f85e 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -3,6 +3,7 @@ * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * Copyright (C) 2019 Eric Seigne + * Copyright (C) 2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -274,8 +275,7 @@ function getDefaultDatesForTransfer() global $db, $conf; // Period by default on transfer (0: previous month | 1: current month | 2: fiscal year) - $periodbydefaultontransfer = $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER; - isset($periodbydefaultontransfer) ? $periodbydefaultontransfer : 0; + $periodbydefaultontransfer = (empty($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER) ? 0 : $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER); if ($periodbydefaultontransfer == 2) { $sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; $sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'"; diff --git a/htdocs/core/lib/cron.lib.php b/htdocs/core/lib/cron.lib.php index 4207e6c3b4f..2d111e37ef8 100644 --- a/htdocs/core/lib/cron.lib.php +++ b/htdocs/core/lib/cron.lib.php @@ -34,12 +34,12 @@ function cronadmin_prepare_head() $h = 0; $head = array(); - $head[$h][0] = dol_buildpath('/cron/admin/cron.php', 1); + $head[$h][0] = DOL_URL_ROOT.'/cron/admin/cron.php'; $head[$h][1] = $langs->trans("Miscellaneous"); $head[$h][2] = 'setup'; $h++; - $head[$h][0] = dol_buildpath('/cron/list.php?mode=modulesetup', 1); + $head[$h][0] = DOL_URL_ROOT.'/cron/list.php?mode=modulesetup'; $head[$h][1] = $langs->trans("Module2300Name"); $head[$h][2] = 'jobs'; $h++; @@ -64,12 +64,12 @@ function cron_prepare_head(Cronjob $object) $h = 0; $head = array(); - $head[$h][0] = dol_buildpath('/cron/card.php', 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/cron/card.php?id='.$object->id; $head[$h][1] = $langs->trans("CronTask"); $head[$h][2] = 'card'; $h++; - $head[$h][0] = dol_buildpath('/cron/info.php', 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/cron/info.php?id='.$object->id; $head[$h][1] = $langs->trans("Info"); $head[$h][2] = 'info'; $h++; diff --git a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php index d1fe41d8c1f..ebab4e8608a 100644 --- a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php @@ -14,7 +14,7 @@ if (empty($extrafieldsobjectkey) && is_object($object)) { // Loop to show all columns of extrafields from $obj, $extrafields and $db if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... - if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']) > 0) { + if (isset($extrafields->attributes[$extrafieldsobjectkey]['label']) && is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']) > 0) { if (empty($extrafieldsobjectprefix)) { $extrafieldsobjectprefix = 'ef.'; } diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 0426231becf..7943df254c1 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2012-2016 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2016 Juanjo Menent - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1183,9 +1183,10 @@ class Holiday extends CommonObject * * @param int $withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int $notooltip 1=Disable tooltip * @return string String with URL */ - public function getNomUrl($withpicto = 0, $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $save_lastsearch_value = -1, $notooltip = 0) { global $langs; diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 94dd7f98cd1..e40ceb3f9ba 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -4,6 +4,7 @@ * Copyright (C) 2012-2014 Regis Houssin * Copyright (C) 2015-2016 Alexandre Spangaro * Copyright (C) 2019 Nicolas ZABOURI + * Copyright (C) 2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -150,6 +151,7 @@ if (!empty($conf->holiday->enabled)) { print ''; $out = ''; + $nb_holiday = 0; $typeleaves = $holiday->getTypes(1, 1); foreach ($typeleaves as $key => $val) { $nb_type = $holiday->getCPforUser($user->id, $val['rowid']); diff --git a/htdocs/index.php b/htdocs/index.php index 0754d297606..debdec757cb 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -464,7 +464,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { $globalStatsKey = $groupElement['globalStatsKey']; $groupElement['globalStats'] = array(); - if (is_array($keys) && in_array($globalStatsKey, $keys)) { + if (isset($keys) && is_array($keys) && in_array($globalStatsKey, $keys)) { // get key index of stats used in $includes, $classes, $keys, $icons, $titres, $links $keyIndex = array_search($globalStatsKey, $keys); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 5b1324aec49..31fbc0ee4b3 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -13,6 +13,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2020 Demarest Maxime * Copyright (C) 2020 Charlene Benke + * Copyright (C) 2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -791,7 +792,7 @@ if (!defined('NOLOGIN')) { } else { // We are already into an authenticated session $login = $_SESSION["dol_login"]; - $entity = $_SESSION["dol_entity"]; + $entity = isset($_SESSION["dol_entity"]) ? $_SESSION["dol_entity"] : 0; dol_syslog("- This is an already logged session. _SESSION['dol_login']=".$login." _SESSION['dol_entity']=".$entity, LOG_DEBUG); $resultFetchUser = $user->fetch('', $login, '', 1, ($entity > 0 ? $entity : -1)); diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 89054a11cc5..9cdbe85cf4b 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -125,7 +125,13 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is usel if ((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && ($user->rights->produit->lire || $user->rights->service->lire)) { $prodser = array(); $prodser[0][0] = $prodser[0][1] = $prodser[0][2] = $prodser[0][3] = 0; + $prodser[0]['sell'] = 0; + $prodser[0]['buy'] = 0; + $prodser[0]['none'] = 0; $prodser[1][0] = $prodser[1][1] = $prodser[1][2] = $prodser[1][3] = 0; + $prodser[1]['sell'] = 0; + $prodser[1]['buy'] = 0; + $prodser[1]['none'] = 0; $sql = "SELECT COUNT(p.rowid) as total, p.fk_product_type, p.tosell, p.tobuy"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index e83a4c86a10..af35f691cd0 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -449,7 +449,7 @@ $title = $langs->trans("Project").' - '.$object->ref.($object->thirdparty->name if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE)) { $title = $object->ref.($object->thirdparty->name ? ' - '.$object->thirdparty->name : '').($object->title ? ' - '.$object->title : ''); } -$help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; +$help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos|DE:Modul_Projekte"; llxHeader("", $title, $help_url); diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index e5cbcc22d67..356df3a746e 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -1,7 +1,7 @@ * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018-2021 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,6 +40,7 @@ $resource_id = GETPOST('resource_id', 'int'); $sortorder = GETPOST('sortorder', 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma'); +$optioncss = GETPOST('optioncss', 'alpha'); // Initialize context for list $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'resourcelist'; diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 72d7d4838c0..d8e7e4d4009 100755 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -3,7 +3,7 @@ * Copyright (C) 2014-2020 Laurent Destailleur * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Charlie BENKE - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2021 Gauthier VERDOL * * This program is free software; you can redistribute it and/or modify @@ -44,7 +44,7 @@ if (!empty($conf->projet->enabled)) { $langs->load("projects"); } -$id = GETPOST("id", 'int'); +$id = GETPOSTINT('id'); $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09'); $accountid = GETPOST('accountid', 'int') > 0 ? GETPOST('accountid', 'int') : 0; @@ -60,11 +60,11 @@ $datep = dol_mktime(12, 0, 0, GETPOST("datepmonth", 'int'), GETPOST("datepday", $datev = dol_mktime(12, 0, 0, GETPOST("datevmonth", 'int'), GETPOST("datevday", 'int'), GETPOST("datevyear", 'int')); $datesp = dol_mktime(12, 0, 0, GETPOST("datespmonth", 'int'), GETPOST("datespday", 'int'), GETPOST("datespyear", 'int')); $dateep = dol_mktime(12, 0, 0, GETPOST("dateepmonth", 'int'), GETPOST("dateepday", 'int'), GETPOST("dateepyear", 'int')); -$label = GETPOST('label'); -$fk_user = GETPOST('userid', 'int'); +$label = GETPOST('label', 'alphanohtml'); +$fk_user = GETPOSTINT('userid'); // Security check -$socid = GETPOST("socid", "int"); +$socid = GETPOSTINT('socid'); if ($user->socid) { $socid = $user->socid; } diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index 68c96888b5c..dc7e310d560 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -97,6 +97,13 @@ class PaymentSalary extends CommonObject */ public $fk_user_modif; + /** + * @var array + */ + public $fields = array( + 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), + ); + /** * Constructor * diff --git a/htdocs/salaries/index.html b/htdocs/salaries/index.html new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/htdocs/salaries/index.html @@ -0,0 +1 @@ + diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 7c3500f7e78..74685d37b05 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -79,7 +79,7 @@ $search_zip = trim(GETPOST("search_zip", 'alpha')); $search_state = trim(GETPOST("search_state", 'alpha')); $search_region = trim(GETPOST("search_region", 'alpha')); $search_email = trim(GETPOST('search_email', 'alpha')); -$search_phone = trim(GETPOST('search_phone', 'ahttps://wiki.dolibarr.org/index.php?title=Migrer_mon_Dolibarr_vers_une_offre_Cloudlpha')); +$search_phone = trim(GETPOST('search_phone', 'alpha')); $search_fax = trim(GETPOST('search_fax', 'alpha')); $search_url = trim(GETPOST('search_url', 'alpha')); $search_idprof1 = trim(GETPOST('search_idprof1', 'alpha')); diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 9206507464b..cde14647061 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -51,7 +51,7 @@ if (empty($page) || $page == -1) { $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; - +$optioncss = GETPOST('optioncss', 'alpha'); /* @@ -185,12 +185,10 @@ if (!$rowid) { //print "".$charge->customer."\n"; // Link /*print ""; - if ($societestatic->id > 0) - { + if ($societestatic->id > 0) { print $societestatic->getNomUrl(1); } - if ($memberstatic->id > 0) - { + if ($memberstatic->id > 0) { print $memberstatic->getNomUrl(1); } print "\n";*/ diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 208c8242ab4..0bb4936d460 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -90,6 +90,7 @@ $yearvalid = GETPOST("yearvalid"); $monthvalid = GETPOST("monthvalid"); $dayvalid = GETPOST("dayvalid"); +$optioncss = GETPOST('optioncss', 'alpha'); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 44a7a81ee81..237edd265de 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2909,6 +2909,7 @@ class Ticket extends CommonObject global $conf, $user, $langs; $now = dol_now(); + $delay_warning = 0; $this->nbtodo = $this->nbtodolate = 0; $clause = " WHERE"; @@ -2951,8 +2952,8 @@ class Ticket extends CommonObject while ($obj = $this->db->fetch_object($resql)) { $response->nbtodo++; if ($mode == 'opened') { - $datelimit = $this->db->jdate($obj->datefin); - if ($datelimit < ($now - $delay_warning)) { + $datelimit = $this->db->jdate($obj->datec) + $delay_warning; + if ($datelimit < $now) { //$response->nbtodolate++; } } diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index 31a1efe2481..de341f2f62d 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -1,6 +1,7 @@ * Copyright (C) - 2019 Nicolas ZABOURI + * Copyright (C) 2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -127,11 +128,13 @@ print '
'; $tick = array( 'unread' => 0, 'read' => 0, + 'needmoreinfo' => 0, 'answered' => 0, 'assigned' => 0, 'inprogress' => 0, 'waiting' => 0, 'closed' => 0, + 'canceled' => 0, 'deleted' => 0, ); @@ -144,7 +147,7 @@ $sql .= ' WHERE t.entity IN ('.getEntity('ticket').')'; $sql .= dolSqlDateFilter('datec', 0, 0, $endyear); if (!$user->rights->societe->client->voir && !$socid) { - $sql .= " AND t.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; + $sql .= " AND t.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } // External users restriction @@ -153,7 +156,7 @@ if ($user->socid > 0) { } else { // For internals users, if (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && !$user->rights->ticket->manage) { - $sql .= " AND t.fk_user_assign = ".$user->id; + $sql .= " AND t.fk_user_assign = ".((int) $user->id); } } $sql .= " GROUP BY t.fk_statut"; @@ -322,7 +325,7 @@ if ($user->socid > 0) { $sql .= " AND t.fk_soc= ".((int) $user->socid); } else { // Restricted to assigned user only - if ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && !$user->rights->ticket->manage) { + if (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && !$user->rights->ticket->manage) { $sql .= " AND t.fk_user_assign=".$user->id; } } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index f3866e0caf5..c1abbc2e4ae 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -13,7 +13,7 @@ * Copyright (C) 2015 Ari Elbaz (elarifr) * Copyright (C) 2015-2018 Charlene Benke * Copyright (C) 2016 Raphaël Doursenaud - * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2018 David Beniamine * * This program is free software; you can redistribute it and/or modify @@ -1247,9 +1247,10 @@ if ($action == 'create' || $action == 'adduserldap') { } else { // View and edit mode if ($id > 0) { - $object->fetch($id, '', '', 1); + $res = $object->fetch($id, '', '', 1); if ($res < 0) { - dol_print_error($db, $object->error); exit; + dol_print_error($db, $object->error); + exit; } $res = $object->fetch_optionals(); diff --git a/htdocs/user/hierarchy.php b/htdocs/user/hierarchy.php index 10cc58d43b9..6073ca4c88f 100644 --- a/htdocs/user/hierarchy.php +++ b/htdocs/user/hierarchy.php @@ -4,7 +4,7 @@ * Copyright (C) 2006-2015 Laurent Destailleur * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,6 +44,7 @@ if ($user->socid > 0) { $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_user = GETPOST('search_user', 'alpha'); +$optioncss = GETPOST('optioncss', 'alpha'); // Load mode employee $mode = GETPOST("mode", 'alpha'); diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index 3f3197d956a..07edb353aa4 100755 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -177,8 +177,8 @@ class Workstation extends CommonObject { global $conf, $langs; - dol_include_once('/workstation/class/workstationusergroup.class.php'); - dol_include_once('/workstation/class/workstationresource.class.php'); + require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstationusergroup.class.php'; + require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstationresource.class.php'; $this->db = $db;