2
0
forked from Wavyzz/dolibarr

Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur
2021-10-31 17:20:09 +01:00
4 changed files with 22 additions and 14 deletions

View File

@@ -2293,6 +2293,11 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
{
global $conf, $langs;
// If date undefined or "", we return ""
if (dol_strlen($time) == 0) {
return ''; // $time=0 allowed (it means 01/01/1970 00:00:00)
}
if ($tzoutput === 'auto') {
$tzoutput = (empty($conf) ? 'tzserver' : (isset($conf->tzuserinputkey) ? $conf->tzuserinputkey : 'tzserver'));
}
@@ -2316,7 +2321,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
$user_date_tz = new DateTimeZone($offsettzstring);
$user_dt = new DateTime();
$user_dt->setTimezone($user_date_tz);
$user_dt->setTimestamp(($tzoutput == 'tzuser' || empty($time)) ? dol_now() : $time);
$user_dt->setTimestamp($tzoutput == 'tzuser' ? dol_now() : (int) $time);
$offsettz = $user_dt->getOffset();
} else { // old method (The 'tzuser' was processed like the 'tzuserrel')
$offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore
@@ -2384,11 +2389,6 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
$format = str_replace('yyyy', 'yy', $format);
}
// If date undefined or "", we return ""
if (dol_strlen($time) == 0) {
return ''; // $time=0 allowed (it means 01/01/1970 00:00:00)
}
// Clean format
if (preg_match('/%b/i', $format)) { // There is some text to translate
// We inhibate translation to text made by strftime functions. We will use trans instead later.

View File

@@ -492,10 +492,14 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
if (!$user->rights->fournisseur->commande->supprimer) {
$deleteok = 0;
}
} elseif ($feature == 'payment_supplier') {
} elseif ($feature == 'payment_supplier') { // Permission to delete a payment of an invoice is permission to edit an invoice.
if (!$user->rights->fournisseur->facture->creer) {
$deleteok = 0;
}
} elseif ($feature == 'payment') { // Permission to delete a payment of an invoice is permission to edit an invoice.
if (!$user->rights->facture->creer) {
$deleteok = 0;
}
} elseif ($feature == 'banque') {
if (empty($user->rights->banque->modifier)) {
$deleteok = 0;

View File

@@ -354,13 +354,14 @@ if ($action == 'edit') {
$result = $c->fetch($conf->global->{$constname});
if ($result < 0) {
setEventMessages(null, $c->errors, 'errors');
}
} elseif ($result > 0 ) {
$ways = $c->print_all_ways(' &gt;&gt; ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
$toprint = array();
foreach ($ways as $way) {
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
}
print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
}
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
if ($conf->global->{$constname}==2) {
print $langs->trans("Prospect");

View File

@@ -83,7 +83,10 @@ class DateLibTzFranceTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
if (getServerTimeZoneString() != 'Europe/Paris' && getServerTimeZoneString() != 'Europe/Berlin') {
print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ=Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; die(1);
print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ=Europe/Paris, not a TZ=".getServerTimeZoneString().".\n";
print "You can launch the test from command line with:\n";
print "php -d date.timezone='Europe/Paris' phpunit DateLibTzFranceTest.php\n";
die(1);
}
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.