mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 17:48:25 +01:00
FIX: Variable might not be traversable
This commit is contained in:
committed by
Raphaël Doursenaud
parent
f68cb3bfcb
commit
eea9a76589
@@ -170,6 +170,9 @@ if ($result) {
|
|||||||
}
|
}
|
||||||
$links = $object->get_url($obj->rowid);
|
$links = $object->get_url($obj->rowid);
|
||||||
|
|
||||||
|
// get_url may return -1 which is not traversable
|
||||||
|
if (is_array($links)) {
|
||||||
|
|
||||||
foreach ( $links as $key => $val ) {
|
foreach ( $links as $key => $val ) {
|
||||||
|
|
||||||
$tabtype[$obj->rowid] = $links[$key]['type'];
|
$tabtype[$obj->rowid] = $links[$key]['type'];
|
||||||
@@ -248,6 +251,7 @@ if ($result) {
|
|||||||
$tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount;
|
$tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount;
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
|
$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
|
||||||
|
|
||||||
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
||||||
|
|||||||
@@ -157,7 +157,9 @@ if ($result) {
|
|||||||
}
|
}
|
||||||
$links = $object->get_url($obj->rowid);
|
$links = $object->get_url($obj->rowid);
|
||||||
|
|
||||||
foreach ( $links as $key => $val ) {
|
// get_url may return -1 which is not traversable
|
||||||
|
if (is_array($links)) {
|
||||||
|
foreach ($links as $key => $val) {
|
||||||
|
|
||||||
$tabtype[$obj->rowid] = $links[$key]['type'];
|
$tabtype[$obj->rowid] = $links[$key]['type'];
|
||||||
|
|
||||||
@@ -216,6 +218,7 @@ if ($result) {
|
|||||||
$tabtp [$obj->rowid] [$cptsociale] += $obj->amount;
|
$tabtp [$obj->rowid] [$cptsociale] += $obj->amount;
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
|
$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
|
||||||
|
|
||||||
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
||||||
|
|||||||
@@ -600,41 +600,56 @@ else
|
|||||||
// Loop on each user to show calendar
|
// Loop on each user to show calendar
|
||||||
$sav = $tmpday;
|
$sav = $tmpday;
|
||||||
$showheader = true;
|
$showheader = true;
|
||||||
foreach ($usernames as $username)
|
|
||||||
{
|
// listUsersForGroup may return -1 which is not traversable
|
||||||
|
if (is_array($usernames)) {
|
||||||
|
foreach ($usernames as $username) {
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
echo '<td class="cal_current_month">' . $username->getNomUrl(1). '</td>';
|
echo '<td class="cal_current_month">' . $username->getNomUrl(1) . '</td>';
|
||||||
$tmpday = $sav;
|
$tmpday = $sav;
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
for ($iter_day = 0; $iter_day < 7; $iter_day++)
|
for ($iter_day = 0; $iter_day < 7; $iter_day++) {
|
||||||
{
|
if (($i + 1) < $begin_d || ($i + 1) > $end_d) {
|
||||||
if (($i + 1) < $begin_d || ($i + 1) > $end_d)
|
|
||||||
{
|
|
||||||
$i++;
|
$i++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show days of the current week
|
// Show days of the current week
|
||||||
$curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd');
|
$curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd');
|
||||||
$tmparray = dol_getdate($curtime,'fast');
|
$tmparray = dol_getdate($curtime, 'fast');
|
||||||
$tmpday = $tmparray['mday'];
|
$tmpday = $tmparray['mday'];
|
||||||
$tmpmonth = $tmparray['mon'];
|
$tmpmonth = $tmparray['mon'];
|
||||||
$tmpyear = $tmparray['year'];
|
$tmpyear = $tmparray['year'];
|
||||||
|
|
||||||
$style='cal_current_month';
|
$style = 'cal_current_month';
|
||||||
if ($iter_day == 6) $style.=' cal_other_month';
|
if ($iter_day == 6) $style .= ' cal_other_month';
|
||||||
$today=0;
|
$today = 0;
|
||||||
$todayarray=dol_getdate($now,'fast');
|
$todayarray = dol_getdate($now, 'fast');
|
||||||
if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1;
|
if ($todayarray['mday'] == $tmpday && $todayarray['mon'] == $month && $todayarray['year'] == $year) $today = 1;
|
||||||
if ($today) $style='cal_today_peruser';
|
if ($today) $style = 'cal_today_peruser';
|
||||||
|
|
||||||
show_day_events2($username, $tmpday, $month, $year, $monthshown, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader);
|
show_day_events2(
|
||||||
|
$username,
|
||||||
|
$tmpday,
|
||||||
|
$month,
|
||||||
|
$year,
|
||||||
|
$monthshown,
|
||||||
|
$style,
|
||||||
|
$eventarray,
|
||||||
|
0,
|
||||||
|
$maxnbofchar,
|
||||||
|
$newparam,
|
||||||
|
1,
|
||||||
|
300,
|
||||||
|
$showheader
|
||||||
|
);
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
$showheader = false;
|
$showheader = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ class Account extends CommonObject
|
|||||||
* @param int $fk_bank To search using bank transaction id
|
* @param int $fk_bank To search using bank transaction id
|
||||||
* @param int $url_id To search using link to
|
* @param int $url_id To search using link to
|
||||||
* @param string $type To search using type
|
* @param string $type To search using type
|
||||||
* @return array Array of links
|
* @return array|-1 Array of links or -1 on error
|
||||||
*/
|
*/
|
||||||
function get_url($fk_bank='', $url_id='', $type='')
|
function get_url($fk_bank='', $url_id='', $type='')
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1302,6 +1302,8 @@ class Form
|
|||||||
$assignedtouser=array();
|
$assignedtouser=array();
|
||||||
if (!empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true);
|
if (!empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true);
|
||||||
if (count($assignedtouser)) $out.='<br>';
|
if (count($assignedtouser)) $out.='<br>';
|
||||||
|
// dol_json_decode may return false on error which is not traversable
|
||||||
|
if (is_array($assignedtouser)) {
|
||||||
foreach($assignedtouser as $key => $value)
|
foreach($assignedtouser as $key => $value)
|
||||||
{
|
{
|
||||||
$userstatic->fetch($key);
|
$userstatic->fetch($key);
|
||||||
@@ -1310,6 +1312,7 @@ class Form
|
|||||||
//$out.=' '.($value['transparency']?$langs->trans("Busy"):$langs->trans("NotBusy"));
|
//$out.=' '.($value['transparency']?$langs->trans("Busy"):$langs->trans("NotBusy"));
|
||||||
$out.='<br>';
|
$out.='<br>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//$out.='</form>';
|
//$out.='</form>';
|
||||||
return $out;
|
return $out;
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ if (! function_exists('json_decode'))
|
|||||||
*
|
*
|
||||||
* @param string $json Json encoded to PHP Object or Array
|
* @param string $json Json encoded to PHP Object or Array
|
||||||
* @param bool $assoc False return an object, true return an array. Try to always use it with true !
|
* @param bool $assoc False return an object, true return an array. Try to always use it with true !
|
||||||
* @return mixed Object or Array
|
* @return mixed Object or Array or false on error
|
||||||
*/
|
*/
|
||||||
function dol_json_decode($json, $assoc=false)
|
function dol_json_decode($json, $assoc=false)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ class UserGroup extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param string $excludefilter Filter to exclude
|
* @param string $excludefilter Filter to exclude
|
||||||
* @param int $mode 0=Return array of user instance, 1=Return array of users id only
|
* @param int $mode 0=Return array of user instance, 1=Return array of users id only
|
||||||
* @return array Array of users
|
* @return array|-1 Array of users or -1 on error
|
||||||
*/
|
*/
|
||||||
function listUsersForGroup($excludefilter='', $mode=0)
|
function listUsersForGroup($excludefilter='', $mode=0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user