forked from Wavyzz/dolibarr
Fix: Popup calendar now use the user lang (not default lang).
Perf: Increase speed of popup calendar and removed old calendar.
This commit is contained in:
@@ -727,7 +727,7 @@ if ($_POST['action'] == "addline" && $user->rights->propale->creer)
|
||||
|
||||
$info_bits=0;
|
||||
if ($tva_npr) $info_bits |= 0x01;
|
||||
|
||||
|
||||
// Rang to use
|
||||
$rang = (!empty($module->rangtouse)?$module->rangtouse:-1);
|
||||
|
||||
@@ -1394,10 +1394,10 @@ if ($id > 0 || ! empty($ref))
|
||||
foreach($hooks->objModules as $module)
|
||||
{
|
||||
$lines = $propal->getLinesArray(1);
|
||||
|
||||
|
||||
$module->getObjectList($propal);
|
||||
$sublines = $propal->getLinesArray(2);
|
||||
|
||||
|
||||
if (! empty($module->lines))
|
||||
{
|
||||
$propal->print_title_list();
|
||||
@@ -1429,17 +1429,17 @@ if ($id > 0 || ! empty($ref))
|
||||
if (! preg_match('/editline|edit_/',$_GET["action"]))
|
||||
{
|
||||
$var=true;
|
||||
|
||||
|
||||
// Add free products/services
|
||||
$propal->showAddFreeProductForm();
|
||||
|
||||
|
||||
// Add predefined products/services
|
||||
if ($conf->product->enabled || $conf->service->enabled)
|
||||
{
|
||||
$var=!$var;
|
||||
$propal->showAddPredefinedProductForm();
|
||||
}
|
||||
|
||||
|
||||
// Hook of thirdparty module
|
||||
if (! empty($hooks->objModules))
|
||||
{
|
||||
|
||||
@@ -399,17 +399,17 @@ class Conf
|
||||
$this->global->MAIN_GRAPH_LIBRARY = 'artichow';
|
||||
}
|
||||
|
||||
// Format for date (if not found in lang)
|
||||
$this->format_date_short="%d/%m/%Y"; # Format of day with PHP/C tags (strftime functions)
|
||||
$this->format_date_short_java="dd/MM/yyyy"; # Format of day with Java tags
|
||||
$this->format_hour_short="%H:%M";
|
||||
$this->format_hour_short_duration="%H:%M";
|
||||
$this->format_date_text_short="%d %b %Y";
|
||||
$this->format_date_text="%d %B %Y";
|
||||
$this->format_date_hour_short="%d/%m/%Y %H:%M";
|
||||
$this->format_date_hour_text_short="%d %b %Y %H:%M";
|
||||
$this->format_date_hour_text="%d %B %Y %H:%M";
|
||||
|
||||
// Format for date (used by default when not found or searched in lang)
|
||||
$this->format_date_short="%d/%m/%Y"; # Format of day with PHP/C tags (strftime functions)
|
||||
$this->format_date_short_java="dd/MM/yyyy"; # Format of day with Java tags
|
||||
$this->format_hour_short="%H:%M";
|
||||
$this->format_hour_short_duration="%H:%M";
|
||||
$this->format_date_text_short="%d %b %Y";
|
||||
$this->format_date_text="%d %B %Y";
|
||||
$this->format_date_hour_short="%d/%m/%Y %H:%M";
|
||||
$this->format_date_hour_text_short="%d %b %Y %H:%M";
|
||||
$this->format_date_hour_text="%d %B %Y %H:%M";
|
||||
|
||||
// Limites decimales si non definie (peuvent etre egale a 0)
|
||||
if (! isset($this->global->MAIN_MAX_DECIMALS_UNIT)) $this->global->MAIN_MAX_DECIMALS_UNIT=5;
|
||||
if (! isset($this->global->MAIN_MAX_DECIMALS_TOT)) $this->global->MAIN_MAX_DECIMALS_TOT=2;
|
||||
|
||||
@@ -2541,7 +2541,8 @@ class Form
|
||||
//print "e".$set_time." t ".$conf->format_date_short;
|
||||
if (strval($set_time) != '' && $set_time != -1)
|
||||
{
|
||||
$formated_date=dol_print_date($set_time,$conf->format_date_short);
|
||||
//$formated_date=dol_print_date($set_time,$conf->format_date_short);
|
||||
$formated_date=dol_print_date($set_time,$langs->trans("FormatDateShort")); // FormatDateShort for dol_print_date/FormatDateShortJava that is same for javascript
|
||||
}
|
||||
|
||||
// Calendrier popup version eldy
|
||||
@@ -2550,7 +2551,7 @@ class Form
|
||||
// Zone de saisie manuelle de la date
|
||||
$retstring.='<input id="'.$prefix.'" name="'.$prefix.'" type="text" size="9" maxlength="11" value="'.$formated_date.'"';
|
||||
$retstring.=($disabled?' disabled="true"':'');
|
||||
$retstring.=' onChange="dpChangeDay(\''.$prefix.'\',\''.$conf->format_date_short_java.'\'); "';
|
||||
$retstring.=' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJava").'\'); "'; // FormatDateShort for dol_print_date/FormatDateShortJava that is same for javascript
|
||||
$retstring.='>';
|
||||
|
||||
// Icone calendrier
|
||||
@@ -2558,7 +2559,7 @@ class Form
|
||||
{
|
||||
$retstring.='<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';
|
||||
$base=DOL_URL_ROOT.'/lib/';
|
||||
$retstring.=' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$conf->format_date_short_java.'\');">'.img_object($langs->trans("SelectDate"),'calendar').'</button>';
|
||||
$retstring.=' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJava").'\',\''.$langs->defaultlang.'\');">'.img_object($langs->trans("SelectDate"),'calendar').'</button>';
|
||||
}
|
||||
|
||||
$retstring.='<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n";
|
||||
@@ -2567,7 +2568,9 @@ class Form
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Bad value of calendar";
|
||||
// Calendrier popup version defaut
|
||||
/*
|
||||
if ($langs->defaultlang != "")
|
||||
{
|
||||
$retstring.='<script type="text/javascript">';
|
||||
@@ -2576,7 +2579,7 @@ class Form
|
||||
}
|
||||
$retstring.='<script type="text/javascript" src="'.DOL_URL_ROOT.'/lib/lib_calendar.js"></script>';
|
||||
$retstring.='<input id="'.$prefix.'" type="text" name="'.$prefix.'" size="9" value="'.$formated_date.'"';
|
||||
$retstring.=' onChange="dpChangeDay(\''.$prefix.'\',\''.$conf->format_date_short_java.'\')"';
|
||||
$retstring.=' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJava").'\')"';
|
||||
$retstring.='> ';
|
||||
$retstring.='<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n";
|
||||
$retstring.='<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
|
||||
@@ -2593,6 +2596,7 @@ class Form
|
||||
$retstring.='<img style="vertical-align:middle" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/calendar.png" border="0" alt="" title="">';
|
||||
$retstring.='</a>';
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2730,7 +2734,7 @@ class Form
|
||||
if ($conf->use_popup_calendar)
|
||||
{
|
||||
$base=DOL_URL_ROOT.'/lib/';
|
||||
$reset_scripts .= 'resetDP(\''.$base.'\',\''.$prefix.'\',\''.$conf->format_date_short_java.'\');';
|
||||
$reset_scripts .= 'resetDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJava").'\',\''.$langs->defaultlang.'\');';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -27,25 +27,26 @@
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
|
||||
if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
|
||||
if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
|
||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
|
||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
|
||||
//if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language
|
||||
if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
|
||||
|
||||
require_once("../main.inc.php");
|
||||
|
||||
//var_dump($langs);
|
||||
|
||||
if (! empty($_GET["lang"])) $langs->setDefaultLang($_GET["lang"]); // If language was forced on URL by the main.inc.php
|
||||
$langs->load("main");
|
||||
$right=($langs->direction=='rtl'?'left':'right');
|
||||
$left=($langs->direction=='rtl'?'right':'left');
|
||||
|
||||
//var_dump($langs->defaultlang);
|
||||
//var_dump($conf->format_date_short_java);
|
||||
//var_dump($langs->trans("FormatDateShortJava"));
|
||||
|
||||
|
||||
// URL http://mydolibarr/lib/datepicker.php?mode=test&m=10&y=2038 can be used for tests
|
||||
@@ -158,15 +159,15 @@ function displayBox($selectedDate,$month,$year){
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="dpButtons"
|
||||
onClick="loadMonth('<?php echo DOL_URL_ROOT.'/lib/' ?>','<?php echo $month?>','<?php echo $year-1?>','<?php echo $xyz ?>')"><<</td>
|
||||
onClick="loadMonth('<?php echo DOL_URL_ROOT.'/lib/' ?>','<?php echo $month?>','<?php echo $year-1?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')"><<</td>
|
||||
<td class="dpButtons"
|
||||
onClick="loadMonth('<?php echo DOL_URL_ROOT.'/lib/' ?>','<?php if($month==1) echo "12"; else echo $month-1?>','<?php if($month==1) echo $year-1; else echo $year?>','<?php echo $xyz ?>')"><</td>
|
||||
onClick="loadMonth('<?php echo DOL_URL_ROOT.'/lib/' ?>','<?php if($month==1) echo "12"; else echo $month-1?>','<?php if($month==1) echo $year-1; else echo $year?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')"><</td>
|
||||
<td colspan="3" class="dpButtons"
|
||||
onClick="loadMonth('<?php echo DOL_URL_ROOT.'/lib/' ?>','<?php echo dol_date('m',$today)?>','<?php echo $todayArray["year"]?>','<?php echo $xyz ?>')"><?php echo $langs->trans("MonthOfDay") ?></td>
|
||||
onClick="loadMonth('<?php echo DOL_URL_ROOT.'/lib/' ?>','<?php echo dol_date('m',$today)?>','<?php echo $todayArray["year"]?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')"><?php echo $langs->trans("CurrentMonth") ?></td>
|
||||
<td class="dpButtons"
|
||||
onClick="loadMonth('<?php echo DOL_URL_ROOT.'/lib/' ?>','<?php if($month==12) echo "1"; else echo $month+1?>','<?php if($month==12) echo $year+1; else echo $year;?>','<?php echo $xyz ?>')">></td>
|
||||
onClick="loadMonth('<?php echo DOL_URL_ROOT.'/lib/' ?>','<?php if($month==12) echo "1"; else echo $month+1?>','<?php if($month==12) echo $year+1; else echo $year;?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')">></td>
|
||||
<td class="dpButtons"
|
||||
onClick="loadMonth('<?php echo DOL_URL_ROOT.'/lib/' ?>','<?php echo $month?>','<?php echo $year+1?>','<?php echo $xyz ?>')">>></td>
|
||||
onClick="loadMonth('<?php echo DOL_URL_ROOT.'/lib/' ?>','<?php echo $month?>','<?php echo $year+1?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')">>></td>
|
||||
</tr>
|
||||
<tr class="dpDayNames">
|
||||
<td width="14%"><?php echo $langs->trans("ShortSunday") ?></td>
|
||||
@@ -210,10 +211,16 @@ function displayBox($selectedDate,$month,$year){
|
||||
if($thedate==$selDate) $dayclass="dpSelected";
|
||||
elseif($thedate==$today) $dayclass="dpToday";
|
||||
|
||||
if ($langs->trans("FormatDateShortJava")=="FormatDateShortJava")
|
||||
{
|
||||
print "ERROR FormatDateShortJava not defined for language ".$langs->defaultlang;
|
||||
exit;
|
||||
}
|
||||
|
||||
// Sur click dans calendrier, appelle fonction dpClickDay
|
||||
echo "<TD class=\"".$dayclass."\"";
|
||||
echo " onMouseOver=\"dpHighlightDay(".$mydate["year"].",".dol_date("n",$thedate).",".$mydate["mday"].",tradMonths)\"";
|
||||
echo " onClick=\"dpClickDay(".$mydate["year"].",".dol_date("n",$thedate).",".$mydate["mday"].",'".$conf->format_date_short_java."')\"";
|
||||
echo " onClick=\"dpClickDay(".$mydate["year"].",".dol_date("n",$thedate).",".$mydate["mday"].",'".$langs->trans("FormatDateShortJava")."')\"";
|
||||
echo ">".sprintf("%02s",$mydate["mday"])."</TD>";
|
||||
$cols++;
|
||||
|
||||
|
||||
@@ -89,13 +89,13 @@ function company_save_refresh()
|
||||
dateFieldID "dateo" Nom du champ
|
||||
format "dd/MM/yyyy" Format issu de Dolibarr de SimpleDateFormat a utiliser pour retour
|
||||
==================================================================*/
|
||||
function showDP(base,dateFieldID,format)
|
||||
function showDP(base,dateFieldID,format,codelang)
|
||||
{
|
||||
//check to see if another box is already showing
|
||||
var alreadybox=getObjectFromID("DPCancel");
|
||||
if (alreadybox) closeDPBox(); // This erase value of showDP.datefieldID
|
||||
|
||||
//alert("showDP "+dateFieldID);
|
||||
//alert("showDP "+codelang);
|
||||
showDP.datefieldID=dateFieldID; // Must be after the close
|
||||
|
||||
var dateField=getObjectFromID(dateFieldID);
|
||||
@@ -154,25 +154,26 @@ function showDP(base,dateFieldID,format)
|
||||
datetime=selDate.getTime();
|
||||
ymd=formatDate(selDate,'yyyyMMdd');
|
||||
}
|
||||
loadMonth(base,month,year,ymd);
|
||||
loadMonth(base,month,year,ymd,codelang);
|
||||
hideSelectBoxes();
|
||||
document.body.appendChild(showDP.box);
|
||||
}
|
||||
|
||||
function resetDP(base,dateFieldID,format)
|
||||
function resetDP(base,dateFieldID,format,codelang)
|
||||
{
|
||||
var dateField=getObjectFromID(dateFieldID);
|
||||
dateField.value = formatDate(new Date(), format);
|
||||
dpChangeDay(dateFieldID, format);
|
||||
dpChangeDay(dateFieldID,format);
|
||||
|
||||
var alreadybox=getObjectFromID("DPCancel");
|
||||
if (alreadybox) showDP(base,dateFieldID,format);
|
||||
if (alreadybox) showDP(base,dateFieldID,format,codelang);
|
||||
}
|
||||
|
||||
function loadMonth(base,month,year,ymd)
|
||||
function loadMonth(base,month,year,ymd,codelang)
|
||||
{
|
||||
/*showDP.box.innerHTML="Loading...";*/
|
||||
var theURL=base+"datepicker.php?cm=shw";
|
||||
//alert(codelang);
|
||||
var theURL=base+"datepicker.php?cm=shw&lang="+codelang;
|
||||
theURL+="&m="+encodeURIComponent(month);
|
||||
theURL+="&y="+encodeURIComponent(year);
|
||||
if (selDate)
|
||||
|
||||
Reference in New Issue
Block a user