diff --git a/build/debian/control b/build/debian/control index 0ef5367072f..eed54669555 100755 --- a/build/debian/control +++ b/build/debian/control @@ -4,7 +4,7 @@ Priority: optional Maintainer: Laurent Destailleur (eldy) # Uploaders: Laurent Destailleur (eldy) # Only if differs from Maintainer Standards-Version: 3.9.6 -Homepage: http://www.dolibarr.org +Homepage: https://www.dolibarr.org Build-Depends: debhelper (>= 9), po-debconf # This package need at least debian 7 or ubuntu 13.04 or any distribution based on this version diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index 9da825e262e..8a005d2dc82 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -119,9 +119,8 @@ llxHeader('', $langs->trans("Mailing"), 'EN:Module_EMailing|FR:Module_Mailing|ES $form = new Form($db); -if ($filteremail) -{ - $sql = "SELECT m.rowid, m.titre, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi,"; +if ($filteremail) { + $sql = "SELECT m.rowid, m.titre as title, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi,"; $sql .= " mc.statut as sendstatut"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql .= " WHERE m.rowid = mc.fk_mailing AND m.entity = ".$conf->entity; @@ -131,7 +130,7 @@ if ($filteremail) if (!$sortorder) $sortorder = "ASC"; if (!$sortfield) $sortfield = "m.rowid"; } else { - $sql = "SELECT m.rowid, m.titre, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi"; + $sql = "SELECT m.rowid, m.titre as title, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m"; $sql .= " WHERE m.entity = ".$conf->entity; if ($search_ref) $sql .= " AND m.rowid = '".$db->escape($search_ref)."'"; @@ -238,9 +237,10 @@ if ($resql) print $email->getNomUrl(1); print ''; + // Title print ''.$obj->title.''; - // Date creation + // Date creation print ''; print dol_print_date($db->jdate($obj->datec), 'day'); print ''; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 24f5b748e52..f036145161d 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1191,23 +1191,23 @@ class Facture extends CommonInvoice { unset($object->lines[$i]); } - // Bloc to update dates of service (month by month only if previously filled at 1d near start or end of month) + + // Bloc to update dates of service (month by month only if previously filled and similare to start and end of month) // If it's a service with start and end dates - if (!empty($line->date_start) && !empty($line->date_end)) { + if (!empty($conf->global->INVOICE_AUTO_NEXT_MONTH_ON_LINES) && !empty($line->date_start) && !empty($line->date_end)) { // Get the dates $start = dol_getdate($line->date_start); $end = dol_getdate($line->date_end); // Get the first and last day of the month $first = dol_get_first_day($start['year'], $start['mon']); - $last = dol_get_first_day($end['year'], $end['mon']); + $last = dol_get_last_day($end['year'], $end['mon']); - // Get diff betweend start/end of month and previously filled - $diffFirst = num_between_day($first, dol_mktime($start['hours'], $start['minutes'], $start['seconds'], $start['mon'], $start['mday'], $start['year'], 'user')); - $diffLast = num_between_day(dol_mktime($end['hours'], $end['minutes'], $end['seconds'], $end['mon'], $end['mday'], $end['year'], 'user'), $last); - - // If there is <= 1d (or 2?) of start/or/end of month - if ($diffFirst <= 2 && $diffLast <= 2) { + //print dol_print_date(dol_mktime(0, 0, 0, $start['mon'], $start['mday'], $start['year'], 'gmt'), 'dayhour').' '.dol_print_date($first, 'dayhour').'
'; + //print dol_mktime(23, 59, 59, $end['mon'], $end['mday'], $end['year'], 'gmt').' '.$last.'
';exit; + // If start date is first date of month and end date is last date of month + if (dol_mktime(0, 0, 0, $start['mon'], $start['mday'], $start['year'], 'gmt') == $first + && dol_mktime(23, 59, 59, $end['mon'], $end['mday'], $end['year'], 'gmt') == $last) { $nextMonth = dol_get_next_month($end['mon'], $end['year']); $newFirst = dol_get_first_day($nextMonth['year'], $nextMonth['month']); $newLast = dol_get_last_day($nextMonth['year'], $nextMonth['month']); diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 5614659eac0..1d4d1a37354 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -161,8 +161,9 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) $sql .= $hookmanager->resPrint; $sql .= " GROUP BY f.rowid, f.ref, f.datef, f.total, f.tva, f.total_ttc, f.ref_client, f.type, f.fk_statut, f.paye,"; - $sql .= " s.email, s.nom, s.rowid, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur,"; + $sql .= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur,"; $sql .= " cc.rowid, cc.code"; + if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user"; // Add Group from hooks $parameters = array(); diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 3a889367dc1..74b091865ff 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -356,7 +356,8 @@ function dol_stringtotime($string, $gm = 1) } -/** Return previous day +/** + * Return previous day * * @param int $day Day * @param int $month Month @@ -371,7 +372,8 @@ function dol_get_prev_day($day, $month, $year) return array('year' => $tmparray['year'], 'month' => $tmparray['mon'], 'day' => $tmparray['mday']); } -/** Return next day +/** + * Return next day * * @param int $day Day * @param int $month Month @@ -386,7 +388,8 @@ function dol_get_next_day($day, $month, $year) return array('year' => $tmparray['year'], 'month' => $tmparray['mon'], 'day' => $tmparray['mday']); } -/** Return previous month +/** + * Return previous month * * @param int $month Month * @param int $year Year @@ -405,7 +408,8 @@ function dol_get_prev_month($month, $year) return array('year' => $prev_year, 'month' => $prev_month); } -/** Return next month +/** + * Return next month * * @param int $month Month * @param int $year Year @@ -424,7 +428,8 @@ function dol_get_next_month($month, $year) return array('year' => $next_year, 'month' => $next_month); } -/** Return previous week +/** + * Return previous week * * @param int $day Day * @param int $week Week @@ -442,7 +447,8 @@ function dol_get_prev_week($day, $week, $month, $year) return array('year' => $tmparray['year'], 'month' => $tmparray['mon'], 'day' => $tmparray['mday']); } -/** Return next week +/** + * Return next week * * @param int $day Day * @param int $week Week @@ -461,7 +467,8 @@ function dol_get_next_week($day, $week, $month, $year) return array('year' => $tmparray['year'], 'month' => $tmparray['mon'], 'day' => $tmparray['mday']); } -/** Return GMT time for first day of a month or year +/** + * Return GMT time for first day of a month or year * * @param int $year Year * @param int $month Month @@ -478,7 +485,9 @@ function dol_get_first_day($year, $month = 1, $gm = false) } -/** Return GMT time for last day of a month or year +/** + * Return GMT time for last day of a month or year. + * Note: The timestamp contains last day and last hours (23:59:59) * * @param int $year Year * @param int $month Month @@ -504,7 +513,8 @@ function dol_get_last_day($year, $month = 12, $gm = false) return $datelim; } -/** Return GMT time for last hour of a given GMT date (it removes hours, min and second part) +/** + * Return GMT time for last hour of a given GMT date (it removes hours, min and second part) * * @param int $date Date * @return int Date for last hour of a given date @@ -515,7 +525,8 @@ function dol_get_last_hour($date) return dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year'], false); } -/** Return GMT time for first hour of a given GMT date (it removes hours, min and second part) +/** + * Return GMT time for first hour of a given GMT date (it removes hours, min and second part) * * @param int $date Date * @return int Date for last hour of a given date diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d0f3bb622b2..8db917882ec 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1984,8 +1984,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = { global $conf, $langs; - if ($tzoutput == 'auto' && property_exists($conf, 'tzuserinputkey')) { - $tzoutput = $conf->tzuserinputkey; + if ($tzoutput === 'auto') { + $tzoutput = (empty($conf) ? 'tzserver' : $conf->tzuserinputkey); } // Clean parameters diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index c5467c08357..9bbfe1322e9 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2185,7 +2185,8 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc"; $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; $sql2 .= " WHERE p.rowid IN (".join(',', $arrayidofprojects).")"; - $sql2 .= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, s.nom, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_percent, p.opp_amount, p.dateo, p.datee"; + $sql2 .= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, s.rowid, s.nom, s.name_alias, s.code_client, s.code_compta, s.client, s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur,"; + $sql2 .= " s.logo, s.email, s.entity, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_percent, p.opp_amount, p.dateo, p.datee"; $sql2 .= " ORDER BY p.title, p.ref"; $resql = $db->query($sql2); diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 075403cc3e4..c1c26234206 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -217,8 +217,9 @@ if (empty($reshook)) if (!empty($origin) && !empty($originid)) { // Parse element/subelement (ex: project_task) - $element = $subelement = $_POST['origin']; - if (preg_match('/^([^_]+)_([^_]+)/i', $_POST['origin'], $regs)) + $regs = array(); + $element = $subelement = GETPOST('origin', 'alphanohtml'); + if (preg_match('/^([^_]+)_([^_]+)/i', GETPOST('origin', 'alphanohtml'), $regs)) { $element = $regs[1]; $subelement = $regs[2]; @@ -478,8 +479,7 @@ if (empty($reshook)) $desc = GETPOST('np_desc', 'restricthtml'); $date_intervention = dol_mktime(GETPOST('dihour', 'int'), GETPOST('dimin', 'int'), 0, GETPOST('dimonth', 'int'), GETPOST('diday', 'int'), GETPOST('diyear', 'int')); - $duration = empty($conf->global->FICHINTER_WITHOUT_DURATION) ?convertTime2Seconds(GETPOST('durationhour', 'int'), GETPOST('durationmin', 'int')) : 0; - + $duration = empty($conf->global->FICHINTER_WITHOUT_DURATION) ? convertTime2Seconds(GETPOST('durationhour', 'int'), GETPOST('durationmin', 'int')) : 0; // Extrafields $extrafields->fetch_name_optionals_label($object->table_element_line); @@ -1335,8 +1335,7 @@ if ($action == 'create') print '
'; print ''; print ''; - if ($action == 'editline') - { + if ($action == 'editline') { print ''; print ''; } else { @@ -1348,8 +1347,9 @@ if ($action == 'create') $sql .= ' ft.date as date_intervention'; $sql .= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft'; $sql .= ' WHERE ft.fk_fichinter = '.$object->id; - if (!empty($conf->global->FICHINTER_HIDE_EMPTY_DURATION)) + if (!empty($conf->global->FICHINTER_HIDE_EMPTY_DURATION)) { $sql .= ' AND ft.duree <> 0'; + } $sql .= ' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid'; $resql = $db->query($sql); @@ -1376,13 +1376,11 @@ if ($action == 'create') print ' '; print "\n"; } - while ($i < $num) - { + while ($i < $num) { $objp = $db->fetch_object($resql); // Ligne en mode visu - if ($action != 'editline' || GETPOST('line_id', 'int') != $objp->rowid) - { + if ($action != 'editline' || GETPOST('line_id', 'int') != $objp->rowid) { print ''; // No. @@ -1402,8 +1400,7 @@ if ($action == 'create') print "\n"; - - // Econ to edit and delete + // Icon to edit and delete if ($object->statut == 0 && $user->rights->ficheinter->creer) { print ''; diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index d739f70e76e..4175e5064c6 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2010-2019 Juanjo Menent + * Copyright (C) 2010-2021 Juanjo Menent * Copyright (C) 2014 Cedric Gross * Copyright (C) 2016 Florian Henry * Copyright (C) 2017-2020 Ferran Marcet @@ -228,6 +228,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) foreach ($_POST as $key => $value) { // without batch module enabled + $reg = array(); if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) { $pos++; @@ -269,16 +270,20 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) if (!$error && !empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) { if (empty($conf->multicurrency->enabled) && empty($conf->dynamicprices->enabled)) { - $dto = GETPOST("dto_".$reg[1].'_'.$reg[2], 'int'); + $dto = price2num(GETPOST("dto_".$reg[1].'_'.$reg[2], 'int'), ''); + if (empty($dto)) { + $dto = 0; + } + //update supplier price if (GETPOSTISSET($saveprice)) { // TODO Use class $sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price"; - $sql .= " SET unitprice='".GETPOST($pu)."'"; - $sql .= ", price=".GETPOST($pu)."*quantity"; - $sql .= ", remise_percent='".(!empty($dto) ? $dto : 0)."'"; - $sql .= " WHERE fk_soc=".$object->socid; - $sql .= " AND fk_product=".GETPOST($prod, 'int'); + $sql .= " SET unitprice='".price2num(GETPOST($pu), 'MU')."'"; + $sql .= ", price=".price2num(GETPOST($pu), 'MU')."*quantity"; + $sql .= ", remise_percent = ".((float) $dto); + $sql .= " WHERE fk_soc=".((int) $object->socid); + $sql .= " AND fk_product=".((int) GETPOST($prod, 'int')); $resql = $db->query($sql); } diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 6c376fc35f3..f2b1820c019 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -322,7 +322,7 @@ $sql .= " WHERE p.entity IN (".getEntity('project').")"; $sql .= " AND p.fk_statut = 1"; if ($mine || empty($user->rights->projet->all->lire)) $sql .= " AND p.rowid IN (".$projectsListId.")"; // If we have this test true, it also means projectset is not 2 if ($socid) $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; -$sql .= " GROUP BY s.rowid, s.nom, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.canvas, s.status"; +$sql .= " GROUP BY s.rowid, s.nom, s.name_alias, s.code_client, s.code_compta, s.client, s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur, s.logo, s.email, s.entity, s.canvas, s.status"; $sql .= $db->order($sortfield, $sortorder); //$sql .= $db->plimit($max + 1, 0);