Removed deprecated use of string in dol_print_date(). Only date allowed.

This commit is contained in:
Laurent Destailleur 2019-04-01 19:27:34 +02:00
parent fc983fa65c
commit 8fe1be1a67
14 changed files with 127 additions and 117 deletions

View File

@ -24,7 +24,10 @@ Following changes may create regressions for some external modules, but were nec
* All methods set_draft() were renamed into setDraft(). * All methods set_draft() were renamed into setDraft().
* Removed deprecated function function test_sql_and_script_inject that was replaced with testSqlAndScriptInject. * Removed deprecated function function test_sql_and_script_inject that was replaced with testSqlAndScriptInject.
* Method load_measuring_units were renamed into selectMeasuringUnits and select_measuring_units was deprecated. * Method load_measuring_units were renamed into selectMeasuringUnits and select_measuring_units was deprecated.
* Hidden option CHANGE_ORDER_CONCAT_DESCRIPTION were renamed into MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION * Hidden option CHANGE_ORDER_CONCAT_DESCRIPTION were renamed into MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION.
* Method dolEscapeXML was moved from functions.lib.php into function2.lib.php (not used enough to be loaded by default).
* Removed deprecated use of string in dol_print_date(). Only date allowed.
***** ChangeLog for 9.0.1 compared to 9.0.0 ***** ***** ChangeLog for 9.0.1 compared to 9.0.0 *****

View File

@ -407,18 +407,17 @@ foreach ($accounts as $key=>$type)
$found++; $found++;
$obj = new Account($db); $result = $objecttmp->fetch($key);
$obj->fetch($key);
$solde = $obj->solde(1); $solde = $objecttmp->solde(1);
if (! empty($lastcurrencycode) && $lastcurrencycode != $obj->currency_code) if (! empty($lastcurrencycode) && $lastcurrencycode != $objecttmp->currency_code)
{ {
$lastcurrencycode='various'; // We found several different currencies $lastcurrencycode='various'; // We found several different currencies
} }
if ($lastcurrencycode != 'various') if ($lastcurrencycode != 'various')
{ {
$lastcurrencycode=$obj->currency_code; $lastcurrencycode=$objecttmp->currency_code;
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -426,14 +425,14 @@ foreach ($accounts as $key=>$type)
// Ref // Ref
if (! empty($arrayfields['b.ref']['checked'])) if (! empty($arrayfields['b.ref']['checked']))
{ {
print '<td class="nowrap">'.$obj->getNomUrl(1).'</td>'; print '<td class="nowrap">'.$objecttmp->getNomUrl(1).'</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Label // Label
if (! empty($arrayfields['b.label']['checked'])) if (! empty($arrayfields['b.label']['checked']))
{ {
print '<td>'.$obj->label.'</td>'; print '<td>'.$objecttmp->label.'</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
@ -441,7 +440,7 @@ foreach ($accounts as $key=>$type)
if (! empty($arrayfields['accountype']['checked'])) if (! empty($arrayfields['accountype']['checked']))
{ {
print '<td>'; print '<td>';
print $obj->type_lib[$obj->type]; print $objecttmp->type_lib[$objecttmp->type];
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
@ -449,7 +448,7 @@ foreach ($accounts as $key=>$type)
// Number // Number
if (! empty($arrayfields['b.number']['checked'])) if (! empty($arrayfields['b.number']['checked']))
{ {
print '<td>'.$obj->number.'</td>'; print '<td>'.$objecttmp->number.'</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
@ -460,12 +459,12 @@ foreach ($accounts as $key=>$type)
if (! empty($conf->accounting->enabled)) if (! empty($conf->accounting->enabled))
{ {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $obj->account_number, 1); $accountingaccount->fetch('', $objecttmp->account_number, 1);
print $accountingaccount->getNomUrl(0, 1, 1, '', 1); print $accountingaccount->getNomUrl(0, 1, 1, '', 1);
} }
else else
{ {
print $obj->account_number; print $objecttmp->account_number;
} }
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
@ -478,7 +477,7 @@ foreach ($accounts as $key=>$type)
if (! empty($conf->accounting->enabled)) if (! empty($conf->accounting->enabled))
{ {
$accountingjournal = new AccountingJournal($db); $accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($obj->fk_accountancy_journal); $accountingjournal->fetch($objecttmp->fk_accountancy_journal);
print $accountingjournal->getNomUrl(0, 1, 1, '', 1); print $accountingjournal->getNomUrl(0, 1, 1, '', 1);
} }
else else
@ -493,7 +492,7 @@ foreach ($accounts as $key=>$type)
if (! empty($arrayfields['b.currency_code']['checked'])) if (! empty($arrayfields['b.currency_code']['checked']))
{ {
print '<td class="center">'; print '<td class="center">';
print $obj->currency_code; print $objecttmp->currency_code;
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
@ -502,11 +501,11 @@ foreach ($accounts as $key=>$type)
if (! empty($arrayfields['toreconcile']['checked'])) if (! empty($arrayfields['toreconcile']['checked']))
{ {
print '<td class="center">'; print '<td class="center">';
if ($obj->rappro) if ($objecttmp->rappro)
{ {
$result=$obj->load_board($user, $obj->id); $result=$objecttmp->load_board($user, $objecttmp->id);
if ($result<0) { if ($result<0) {
setEventMessages($obj->error, $obj->errors, 'errors'); setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
} else { } else {
print $result->nbtodo; print $result->nbtodo;
if ($result->nbtodolate) print ' &nbsp; ('.$result->nbtodolate.img_warning($langs->trans("Late")).')'; if ($result->nbtodolate) print ' &nbsp; ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';
@ -520,14 +519,14 @@ foreach ($accounts as $key=>$type)
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook // Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); $parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objecttmp); // Note that $action and $objecttmpect may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Date creation // Date creation
if (! empty($arrayfields['b.datec']['checked'])) if (! empty($arrayfields['b.datec']['checked']))
{ {
print '<td class="center">'; print '<td class="center">';
print dol_print_date($obj->date_creation, 'dayhour'); print dol_print_date($objecttmp->date_creation, 'dayhour');
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
@ -535,7 +534,7 @@ foreach ($accounts as $key=>$type)
if (! empty($arrayfields['b.tms']['checked'])) if (! empty($arrayfields['b.tms']['checked']))
{ {
print '<td class="center">'; print '<td class="center">';
print dol_print_date($obj->date_update, 'dayhour'); print dol_print_date($objecttmp->date_update, 'dayhour');
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
@ -543,7 +542,7 @@ foreach ($accounts as $key=>$type)
// Status // Status
if (! empty($arrayfields['b.clos']['checked'])) if (! empty($arrayfields['b.clos']['checked']))
{ {
print '<td class="center">'.$obj->getLibStatut(5).'</td>'; print '<td class="center">'.$objecttmp->getLibStatut(5).'</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
@ -551,7 +550,7 @@ foreach ($accounts as $key=>$type)
if (! empty($arrayfields['balance']['checked'])) if (! empty($arrayfields['balance']['checked']))
{ {
print '<td class="nowraponall right">'; print '<td class="nowraponall right">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$obj->id.'">'.price($solde, 0, $langs, 0, -1, -1, $obj->currency_code).'</a>'; print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$objecttmp->id.'">'.price($solde, 0, $langs, 0, -1, -1, $objecttmp->currency_code).'</a>';
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalbalancefield']=$totalarray['nbfield']; if (! $i) $totalarray['totalbalancefield']=$totalarray['nbfield'];
@ -563,15 +562,15 @@ foreach ($accounts as $key=>$type)
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{ {
$selected=0; $selected=0;
if (in_array($obj->rowid, $arrayofselected)) $selected=1; if (in_array($objecttmp->id, $arrayofselected)) $selected=1;
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>'; print '<input id="cb'.$objecttmp->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$objecttmp->id.'"'.($selected?' checked="checked"':'').'>';
} }
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
print '</tr>'; print '</tr>';
$total[$obj->currency_code] += $solde; $total[$objecttmp->currency_code] += $solde;
$i++; $i++;
} }

View File

@ -1592,6 +1592,9 @@ class BonPrelevement extends CommonObject
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$CrLf = "\n"; $CrLf = "\n";
$Rowing = sprintf("%06d", $row_idfac); $Rowing = sprintf("%06d", $row_idfac);

View File

@ -224,9 +224,9 @@ class FormAccounting extends Form
/** /**
* Return select filter with date of transaction * Return select filter with date of transaction
* *
* @param string $htmlname Name of select field * @param string $htmlname Name of select field
* @param string $selectedkey Value * @param string $selectedkey Value
* @return string HTML edit field * @return string HTML edit field
*/ */
public function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '') public function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '')
{ {
@ -247,7 +247,7 @@ class FormAccounting extends Form
} }
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {
$options[$obj->import_key] = dol_print_date($obj->import_key, 'dayhourtext'); $options[$obj->import_key] = $obj->import_key;
} }
return Form::selectarray($htmlname, $options, $selectedkey); return Form::selectarray($htmlname, $options, $selectedkey);

View File

@ -886,17 +886,6 @@ function dol_string_nospecial($str, $newstr = '_', $badcharstoreplace = '')
} }
/**
* Encode string for xml usage
*
* @param string $string String to encode
* @return string String encoded
*/
function dolEscapeXML($string)
{
return strtr($string, array('\''=>'&apos;','"'=>'&quot;','&'=>'&amp;','<'=>'&lt;','>'=>'&gt;'));
}
/** /**
* Returns text escaped for inclusion into javascript code * Returns text escaped for inclusion into javascript code
* *
@ -1785,8 +1774,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'tzserver', $outputlang
if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg) if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg)
|| preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000 || preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000
{ {
// TODO Remove this. This part of code should not be used. // This part of code should not be used.
dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_WARNING); /*dol_syslog("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"], LOG_WARNING);
//if (function_exists('debug_print_backtrace')) debug_print_backtrace(); //if (function_exists('debug_print_backtrace')) debug_print_backtrace();
// Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS' // Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS'
$syear = (! empty($reg[1]) ? $reg[1] : ''); $syear = (! empty($reg[1]) ? $reg[1] : '');
@ -1797,7 +1786,9 @@ function dol_print_date($time, $format = '', $tzoutput = 'tzserver', $outputlang
$ssec = (! empty($reg[6]) ? $reg[6] : ''); $ssec = (! empty($reg[6]) ? $reg[6] : '');
$time=dol_mktime($shour, $smin, $ssec, $smonth, $sday, $syear, true); $time=dol_mktime($shour, $smin, $ssec, $smonth, $sday, $syear, true);
$ret=adodb_strftime($format, $time+$offsettz+$offsetdst, $to_gmt); $ret=adodb_strftime($format, $time+$offsettz+$offsetdst, $to_gmt);*/
dol_print_error("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"]);
return '';
} }
else else
{ {

View File

@ -2414,28 +2414,39 @@ function getModuleDirForApiClass($module)
return $moduledirforclass; return $moduledirforclass;
} }
/* /**
* Return 2 hexa code randomly * Return 2 hexa code randomly
* *
* @param $min int Between 0 and 255 * @param int $min Between 0 and 255
* @param $max int Between 0 and 255 * @param int $max Between 0 and 255
* @return String * @return string A color string '12'
*/ */
function random_color_part($min = 0, $max = 255) function randomColorPart($min = 0, $max = 255)
{ {
return str_pad(dechex(mt_rand($min, $max)), 2, '0', STR_PAD_LEFT); return str_pad(dechex(mt_rand($min, $max)), 2, '0', STR_PAD_LEFT);
} }
/* /**
* Return hexadecimal color randomly * Return hexadecimal color randomly
* *
* @param $min int Between 0 and 255 * @param int $min Between 0 and 255
* @param $max int Between 0 and 255 * @param int $max Between 0 and 255
* @return String * @return string A color string '123456'
*/ */
function random_color($min = 0, $max = 255) function randomColor($min = 0, $max = 255)
{ {
return random_color_part($min, $max) . random_color_part($min, $max) . random_color_part($min, $max); return randomColorPart($min, $max) . randomColorPart($min, $max) . randomColorPart($min, $max);
}
/**
* Encode string for xml usage
*
* @param string $string String to encode
* @return string String encoded
*/
function dolEscapeXML($string)
{
return strtr($string, array('\''=>'&apos;','"'=>'&quot;','&'=>'&amp;','<'=>'&lt;','>'=>'&gt;'));
} }
/** /**

View File

@ -117,7 +117,7 @@ class pdf_crabe extends ModelePDFFactures
/** /**
* Issuer * Issuer
* @var Company object that emits * @var Societe object that emits
*/ */
public $emetteur; public $emetteur;
@ -856,7 +856,7 @@ class pdf_crabe extends ModelePDFFactures
$invoice->fetch($obj->fk_facture_source); $invoice->fetch($obj->fk_facture_source);
$pdf->SetXY($tab3_posx, $tab3_top+$y); $pdf->SetXY($tab3_posx, $tab3_top+$y);
$pdf->MultiCell(20, 3, dol_print_date($obj->datef, 'day', false, $outputlangs, true), 0, 'L', 0); $pdf->MultiCell(20, 3, dol_print_date($db->jdate($obj->datef), 'day', false, $outputlangs, true), 0, 'L', 0);
$pdf->SetXY($tab3_posx+21, $tab3_top+$y); $pdf->SetXY($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 3, price(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $obj->multicurrency_amount_ttc : $obj->amount_ttc, 0, $outputlangs), 0, 'L', 0); $pdf->MultiCell(20, 3, price(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $obj->multicurrency_amount_ttc : $obj->amount_ttc, 0, $outputlangs), 0, 'L', 0);
$pdf->SetXY($tab3_posx+40, $tab3_top+$y); $pdf->SetXY($tab3_posx+40, $tab3_top+$y);

View File

@ -928,7 +928,7 @@ class pdf_sponge extends ModelePDFFactures
$invoice->fetch($obj->fk_facture_source); $invoice->fetch($obj->fk_facture_source);
$pdf->SetXY($tab3_posx, $tab3_top+$y); $pdf->SetXY($tab3_posx, $tab3_top+$y);
$pdf->MultiCell(20, 3, dol_print_date($obj->datef, 'day', false, $outputlangs, true), 0, 'L', 0); $pdf->MultiCell(20, 3, dol_print_date($db->jdate($obj->datef), 'day', false, $outputlangs, true), 0, 'L', 0);
$pdf->SetXY($tab3_posx+21, $tab3_top+$y); $pdf->SetXY($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 3, price(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $obj->multicurrency_amount_ttc : $obj->amount_ttc, 0, $outputlangs), 0, 'L', 0); $pdf->MultiCell(20, 3, price(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $obj->multicurrency_amount_ttc : $obj->amount_ttc, 0, $outputlangs), 0, 'L', 0);
$pdf->SetXY($tab3_posx+40, $tab3_top+$y); $pdf->SetXY($tab3_posx+40, $tab3_top+$y);
@ -1829,7 +1829,7 @@ class pdf_sponge extends ModelePDFFactures
* Define Array Column Field * Define Array Column Field
* *
* @param object $object common object * @param object $object common object
* @param outputlangs $outputlangs langs * @param Translate $outputlangs langs
* @param int $hidedetails Do not show line details * @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc * @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref * @param int $hideref Do not show ref

View File

@ -64,9 +64,11 @@ if (!empty($object->comments))
$fk_user = $comment->fk_user_author; $fk_user = $comment->fk_user_author;
$userstatic->fetch($fk_user); $userstatic->fetch($fk_user);
if(empty($TColors[$fk_user])) { if (empty($TColors[$fk_user]))
$bgcolor = random_color(180, 240); {
if(!empty($userstatic->color)) { $bgcolor = randomColor(180, 240);
if (!empty($userstatic->color))
{
$bgcolor = $userstatic->color; $bgcolor = $userstatic->color;
} }
$color = (colorIsLight($bgcolor))?'555':'fff'; $color = (colorIsLight($bgcolor))?'555':'fff';

View File

@ -173,10 +173,10 @@ else
print '</td>'; print '</td>';
print '<td>' . $user->getFullName($langs) . '</td>'; print '<td>' . $user->getFullName($langs) . '</td>';
print '<td>' . $obj->label . '</td>'; print '<td>' . $obj->label . '</td>';
print '<td class="center">' . dol_print_date($obj->date_debut, 'day'); print '<td class="center">' . dol_print_date($db->jdate($obj->date_debut), 'day');
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$starthalfday]).')</span>'; print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$starthalfday]).')</span>';
print '</td>'; print '</td>';
print '<td class="center">' . dol_print_date($obj->date_fin, 'day'); print '<td class="center">' . dol_print_date($db->jdate($obj->date_fin), 'day');
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$endhalfday]).')</span>'; print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$endhalfday]).')</span>';
print '</td>'; print '</td>';
print '<td class="right">' . num_open_day($date_start, $date_end, 0, 1, $obj->halfday) . '</td>'; print '<td class="right">' . num_open_day($date_start, $date_end, 0, 1, $obj->halfday) . '</td>';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012-2016 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013-2018 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013-2018 Juanjo Menent <jmenent@2byte.es>
@ -981,7 +981,7 @@ if ($resql)
if (! empty($arrayfields['p.datec']['checked'])) if (! empty($arrayfields['p.datec']['checked']))
{ {
print '<td class="center">'; print '<td class="center">';
print dol_print_date($obj->date_creation, 'dayhour', 'tzuser'); print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
@ -989,7 +989,7 @@ if ($resql)
if (! empty($arrayfields['p.tms']['checked'])) if (! empty($arrayfields['p.tms']['checked']))
{ {
print '<td class="center">'; print '<td class="center">';
print dol_print_date($obj->date_update, 'dayhour', 'tzuser'); print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }

View File

@ -479,6 +479,20 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_S
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$projectstatic->id = $obj->projectid;
$projectstatic->ref = $obj->ref;
$projectstatic->title = $obj->title;
$projectstatic->statut = $obj->status;
$projectstatic->public = $obj->public;
$projectstatic->dateo = $db->jdate($obj->projdateo);
$projectstatic->datee = $db->jdate($obj->projdatee);
$taskstatic->projectstatus = $obj->projectstatus;
$taskstatic->progress = $obj->progress;
$taskstatic->fk_statut = $obj->status;
$taskstatic->dateo = $db->jdate($obj->dateo);
$taskstatic->datee = $db->jdate($obj->datee);
$username=''; $username='';
if ($obj->userid && $userstatic->id != $obj->userid) // We have a user and it is not last loaded user if ($obj->userid && $userstatic->id != $obj->userid) // We have a user and it is not last loaded user
{ {
@ -490,14 +504,6 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_S
print '<tr class="oddeven">'; print '<tr class="oddeven">';
//print '<td>'.$username.'</td>'; //print '<td>'.$username.'</td>';
print '<td>'; print '<td>';
$projectstatic->id=$obj->projectid;
$projectstatic->ref=$obj->ref;
$projectstatic->title=$obj->title;
$projectstatic->statut = $obj->status;
$projectstatic->public = $obj->public;
$projectstatic->dateo = $db->jdate($obj->projdateo);
$projectstatic->datee = $db->jdate($obj->projdatee);
print $projectstatic->getNomUrl(1, '', 0, '', '<br>'); print $projectstatic->getNomUrl(1, '', 0, '', '<br>');
print '</td>'; print '</td>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
@ -517,14 +523,8 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_S
} }
else print $langs->trans("NoTasks"); else print $langs->trans("NoTasks");
print '</td>'; print '</td>';
$taskstatic->projectstatus = $obj->projectstatus;
$taskstatic->progress = $obj->progress;
$taskstatic->fk_statut = $obj->status;
$taskstatic->dateo = $db->jdate($obj->dateo);
$taskstatic->datee = $db->jdate($obj->datee);
print '<td class="center">'.dol_print_date($db->jdate($obj->dateo), 'day').'</td>'; print '<td class="center">'.dol_print_date($db->jdate($obj->dateo), 'day').'</td>';
print '<td class="center">'.dol_print_date($db->jdate($obj->datee), 'day'); print '<td class="center">'.dol_print_date($db->jdate($obj->datee), 'day');
print dol_print_date($obj->date_end, 'dayhour');
if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late")); if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late"));
print '</td>'; print '</td>';
print '<td class="right"><a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$obj->taskid.'&withproject=1">'; print '<td class="right"><a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$obj->taskid.'&withproject=1">';

View File

@ -519,21 +519,21 @@ if ($action == "view_ticketlist")
// Date ticket // Date ticket
if (!empty($arrayfields['t.datec']['checked'])) { if (!empty($arrayfields['t.datec']['checked'])) {
print '<td>'; print '<td>';
print dol_print_date($obj->datec, 'dayhour'); print dol_print_date($db->jdate($obj->datec), 'dayhour');
print '</td>'; print '</td>';
} }
// Date read // Date read
if (!empty($arrayfields['t.date_read']['checked'])) { if (!empty($arrayfields['t.date_read']['checked'])) {
print '<td>'; print '<td>';
print dol_print_date($obj->date_read, 'dayhour'); print dol_print_date($db->jdate($obj->date_read), 'dayhour');
print '</td>'; print '</td>';
} }
// Date close // Date close
if (!empty($arrayfields['t.date_close']['checked'])) { if (!empty($arrayfields['t.date_close']['checked'])) {
print '<td>'; print '<td>';
print dol_print_date($obj->date_close, 'dayhour'); print dol_print_date($db->jdate($obj->date_close), 'dayhour');
print '</td>'; print '</td>';
} }
@ -616,7 +616,7 @@ if ($action == "view_ticketlist")
} }
if (!empty($arrayfields['t.tms']['checked'])) { if (!empty($arrayfields['t.tms']['checked'])) {
print '<td>' . dol_print_date($obj->tms, 'dayhour') . '</td>'; print '<td>' . dol_print_date($db->jdate($obj->tms), 'dayhour') . '</td>';
} }
// Extra fields // Extra fields

View File

@ -1049,46 +1049,47 @@ function getProductsForCategory($authentication, $id, $lang = '')
if ($res) if ($res)
{ {
$iProduct = 0; $iProduct = 0;
$tmpproduct = new Product($db);
$products=array();
while ($rec = $db->fetch_array($res)) while ($rec = $db->fetch_array($res))
{ {
$obj = new Product($db); $tmpproduct->fetch($rec['fk_'.$field]);
$obj->fetch($rec['fk_'.$field]); if ($tmpproduct->status > 0)
if($obj->status > 0 )
{ {
$dir = (!empty($conf->product->dir_output)?$conf->product->dir_output:$conf->service->dir_output); $dir = (!empty($conf->product->dir_output)?$conf->product->dir_output:$conf->service->dir_output);
$pdir = get_exdir($obj->id, 2, 0, 0, $product, 'product') . $obj->id ."/photos/"; $pdir = get_exdir($tmpproduct->id, 2, 0, 0, $tmpproduct, 'product') . $tmpproduct->id ."/photos/";
$dir = $dir . '/'. $pdir; $dir = $dir . '/'. $pdir;
$products[] = array( $products[] = array(
'id' => $obj->id, 'id' => $tmpproduct->id,
'ref' => $obj->ref, 'ref' => $tmpproduct->ref,
'ref_ext' => $obj->ref_ext, 'ref_ext' => $tmpproduct->ref_ext,
'label' => ! empty($obj->multilangs[$langs->defaultlang]["label"]) ? $obj->multilangs[$langs->defaultlang]["label"] : $obj->label, 'label' => ! empty($tmpproduct->multilangs[$langs->defaultlang]["label"]) ? $tmpproduct->multilangs[$langs->defaultlang]["label"] : $tmpproduct->label,
'description' => ! empty($obj->multilangs[$langs->defaultlang]["description"]) ? $obj->multilangs[$langs->defaultlang]["description"] : $obj->description, 'description' => ! empty($tmpproduct->multilangs[$langs->defaultlang]["description"]) ? $tmpproduct->multilangs[$langs->defaultlang]["description"] : $tmpproduct->description,
'date_creation' => dol_print_date($obj->date_creation, 'dayhourrfc'), 'date_creation' => dol_print_date($tmpproduct->date_creation, 'dayhourrfc'),
'date_modification' => dol_print_date($obj->date_modification, 'dayhourrfc'), 'date_modification' => dol_print_date($tmpproduct->date_modification, 'dayhourrfc'),
'note' => ! empty($obj->multilangs[$langs->defaultlang]["note"]) ? $obj->multilangs[$langs->defaultlang]["note"] : $obj->note, 'note' => ! empty($tmpproduct->multilangs[$langs->defaultlang]["note"]) ? $tmpproduct->multilangs[$langs->defaultlang]["note"] : $tmpproduct->note,
'status_tosell' => $obj->status, 'status_tosell' => $tmpproduct->status,
'status_tobuy' => $obj->status_buy, 'status_tobuy' => $tmpproduct->status_buy,
'type' => $obj->type, 'type' => $tmpproduct->type,
'barcode' => $obj->barcode, 'barcode' => $tmpproduct->barcode,
'barcode_type' => $obj->barcode_type, 'barcode_type' => $tmpproduct->barcode_type,
'country_id' => $obj->country_id>0?$obj->country_id:'', 'country_id' => $tmpproduct->country_id>0?$tmpproduct->country_id:'',
'country_code' => $obj->country_code, 'country_code' => $tmpproduct->country_code,
'custom_code' => $obj->customcode, 'custom_code' => $tmpproduct->customcode,
'price_net' => $obj->price, 'price_net' => $tmpproduct->price,
'price' => $obj->price_ttc, 'price' => $tmpproduct->price_ttc,
'vat_rate' => $obj->tva_tx, 'vat_rate' => $tmpproduct->tva_tx,
'price_base_type' => $obj->price_base_type, 'price_base_type' => $tmpproduct->price_base_type,
'stock_real' => $obj->stock_reel, 'stock_real' => $tmpproduct->stock_reel,
'stock_alert' => $obj->seuil_stock_alerte, 'stock_alert' => $tmpproduct->seuil_stock_alerte,
'pmp' => $obj->pmp, 'pmp' => $tmpproduct->pmp,
'import_key' => $obj->import_key, 'import_key' => $tmpproduct->import_key,
'dir' => $pdir, 'dir' => $pdir,
'images' => $obj->liste_photos($dir, $nbmax) 'images' => $tmpproduct->liste_photos($dir, $nbmax)
); );
//Retreive all extrafield for thirdsparty //Retreive all extrafield for thirdsparty
@ -1096,11 +1097,11 @@ function getProductsForCategory($authentication, $id, $lang = '')
$extrafields=new ExtraFields($db); $extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('product', true); $extralabels=$extrafields->fetch_name_optionals_label('product', true);
//Get extrafield values //Get extrafield values
$obj->fetch_optionals(); $tmpproduct->fetch_optionals();
foreach($extrafields->attribute_label as $key=>$label) foreach($extrafields->attribute_label as $key=>$label)
{ {
$products[$iProduct]=array_merge($products[$iProduct], array('options_'.$key => $obj->array_options['options_'.$key])); $products[$iProduct]=array_merge($products[$iProduct], array('options_'.$key => $tmpproduct->array_options['options_'.$key]));
} }
$iProduct++; $iProduct++;
@ -1117,7 +1118,7 @@ function getProductsForCategory($authentication, $id, $lang = '')
{ {
$errorcode='NORECORDS_FOR_ASSOCIATION'; $errorlabel='No products associated'.$sql; $errorcode='NORECORDS_FOR_ASSOCIATION'; $errorlabel='No products associated'.$sql;
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
dol_syslog("getProductsForCategory:: ".$c->error, LOG_DEBUG); dol_syslog("getProductsForCategory:: ".$errorcode, LOG_DEBUG);
} }
} }
else else