Merge branch '13.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/core/lib/functions.lib.php
This commit is contained in:
commit
9ec5ba46fb
@ -4,7 +4,7 @@ Priority: optional
|
||||
Maintainer: Laurent Destailleur (eldy) <eldy@users.sourceforge.net>
|
||||
# Uploaders: Laurent Destailleur (eldy) <eldy@users.sourceforge.net> # 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
|
||||
|
||||
|
||||
@ -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 '</td>';
|
||||
|
||||
// Title
|
||||
print '<td>'.$obj->title.'</td>';
|
||||
// Date creation
|
||||
|
||||
// Date creation
|
||||
print '<td class="center">';
|
||||
print dol_print_date($db->jdate($obj->datec), 'day');
|
||||
print '</td>';
|
||||
|
||||
@ -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').'<br>';
|
||||
//print dol_mktime(23, 59, 59, $end['mon'], $end['mday'], $end['year'], 'gmt').' '.$last.'<br>';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']);
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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 '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" name="addinter" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
if ($action == 'editline')
|
||||
{
|
||||
if ($action == 'editline') {
|
||||
print '<input type="hidden" name="action" value="updateline">';
|
||||
print '<input type="hidden" name="line_id" value="'.GETPOST('line_id', 'int').'">';
|
||||
} 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 '<td class="liste_titre"> </td>';
|
||||
print "</tr>\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 '<tr class="oddeven">';
|
||||
|
||||
// No.
|
||||
@ -1402,8 +1400,7 @@ if ($action == 'create')
|
||||
|
||||
print "</td>\n";
|
||||
|
||||
|
||||
// Econ to edit and delete
|
||||
// Icon to edit and delete
|
||||
if ($object->statut == 0 && $user->rights->ficheinter->creer)
|
||||
{
|
||||
print '<td class="center">';
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2010-2019 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2021 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Cedric Gross <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2016 Florian Henry <florian.henry@atm-consulting.fr>
|
||||
* Copyright (C) 2017-2020 Ferran Marcet <fmarcet@2byte.es>
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user