Fix: edit in place datepicker more stable
This commit is contained in:
parent
75340e4b74
commit
dea1210c2d
14
.cvsignore
14
.cvsignore
@ -1,14 +0,0 @@
|
|||||||
index.php
|
|
||||||
*.htaccess
|
|
||||||
*.settings
|
|
||||||
*.buildpath
|
|
||||||
*.project
|
|
||||||
*.cache
|
|
||||||
*.log
|
|
||||||
*.DS_Store
|
|
||||||
document
|
|
||||||
documents
|
|
||||||
DEBIAN
|
|
||||||
install.lock
|
|
||||||
*.patch
|
|
||||||
default.properties
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
dolibarr-*.exe
|
|
||||||
dolibarr-*.tgz
|
|
||||||
dolibarr-*.zip
|
|
||||||
dolibarr-*.rpm
|
|
||||||
dolibarr-*.deb
|
|
||||||
makepack-google.conf
|
|
||||||
module_google-*.tgz
|
|
||||||
module_pibarcode-1.0.tgz
|
|
||||||
*.exe
|
|
||||||
*.tgz
|
|
||||||
*.torrent
|
|
||||||
*.zip
|
|
||||||
version-phpsane.txt
|
|
||||||
makepack-phpsane.conf
|
|
||||||
html
|
|
||||||
*.deb
|
|
||||||
*.dsc
|
|
||||||
*.tar.gz
|
|
||||||
*.changes
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
*.db
|
|
||||||
ca_dolibarr.key
|
|
||||||
doliwamptest.iss
|
|
||||||
@ -1 +0,0 @@
|
|||||||
spec
|
|
||||||
@ -1 +0,0 @@
|
|||||||
Thumbs.db
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
out.*
|
|
||||||
socpeople*
|
|
||||||
@ -1 +0,0 @@
|
|||||||
example*.pdf
|
|
||||||
@ -1 +0,0 @@
|
|||||||
Thumbs.db
|
|
||||||
@ -1 +0,0 @@
|
|||||||
*.db
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
google
|
|
||||||
.htaccess
|
|
||||||
.DS_Store
|
|
||||||
.documents
|
|
||||||
dolibarr_mail
|
|
||||||
demo_pwc
|
|
||||||
phpsane
|
|
||||||
test.php
|
|
||||||
custom
|
|
||||||
custom2
|
|
||||||
@ -1 +0,0 @@
|
|||||||
google.php
|
|
||||||
@ -356,8 +356,7 @@ else if ($id)
|
|||||||
|
|
||||||
// Date
|
// Date
|
||||||
print '<tr><td>'.$langs->trans("Date").'</td><td>';
|
print '<tr><td>'.$langs->trans("Date").'</td><td>';
|
||||||
print $form->editInPlace($object->date, 'date', $user->rights->deplacement->creer, 'datepicker');
|
print $form->editInPlace($object->date, 'dated', $user->rights->deplacement->creer, 'datepicker');
|
||||||
//print dol_print_date($object->date,'day');
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Km/Price
|
// Km/Price
|
||||||
|
|||||||
@ -1,4 +0,0 @@
|
|||||||
conf.php*.sav
|
|
||||||
*.php
|
|
||||||
conf.php.mysql
|
|
||||||
conf.php.postgres
|
|
||||||
@ -37,7 +37,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/genericobject.class.php");
|
|||||||
top_httphead();
|
top_httphead();
|
||||||
|
|
||||||
//print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
|
//print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
|
||||||
print_r($_POST);
|
//print_r($_POST);
|
||||||
|
|
||||||
// Load original field value
|
// Load original field value
|
||||||
if((isset($_POST['field']) && ! empty($_POST['field']))
|
if((isset($_POST['field']) && ! empty($_POST['field']))
|
||||||
@ -51,7 +51,9 @@ if((isset($_POST['field']) && ! empty($_POST['field']))
|
|||||||
$fk_element = GETPOST('fk_element');
|
$fk_element = GETPOST('fk_element');
|
||||||
$value = GETPOST('value');
|
$value = GETPOST('value');
|
||||||
$type = GETPOST('type');
|
$type = GETPOST('type');
|
||||||
|
$timestamp = GETPOST('timestamp');
|
||||||
|
|
||||||
|
$format='text';
|
||||||
$return=array();
|
$return=array();
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
@ -62,26 +64,31 @@ if((isset($_POST['field']) && ! empty($_POST['field']))
|
|||||||
$object = new GenericObject($db);
|
$object = new GenericObject($db);
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$value = trim($value);
|
$newvalue = trim($value);
|
||||||
if ($type == 'numeric')
|
if ($type == 'numeric')
|
||||||
{
|
{
|
||||||
$value = price2num($value);
|
$newvalue = price2num($newvalue);
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (! is_numeric($value))
|
if (! is_numeric($newvalue))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$return['error'] = $langs->trans('ErrorBadValue');
|
$return['error'] = $langs->trans('ErrorBadValue');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ($type == 'datepicker')
|
||||||
|
{
|
||||||
|
$format = 'date';
|
||||||
|
$newvalue = ($timestamp / 1000);
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$ret=$object->setValueFrom($table_element, $fk_element, $field, $value);
|
$ret=$object->setValueFrom($table_element, $fk_element, $field, $newvalue, $format);
|
||||||
if ($ret > 0)
|
if ($ret > 0)
|
||||||
{
|
{
|
||||||
if ($type == 'numeric') $value = price($value);
|
if ($type == 'numeric') $value = price($newvalue);
|
||||||
else if ($type == 'textarea') $value = dol_nl2br($value);
|
else if ($type == 'textarea') $value = dol_nl2br($newvalue);
|
||||||
|
|
||||||
$return['value'] = $value;
|
$return['value'] = $value;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -622,16 +622,18 @@ abstract class CommonObject
|
|||||||
* @param int $id Object id
|
* @param int $id Object id
|
||||||
* @param string $field Field to update
|
* @param string $field Field to update
|
||||||
* @param mixte $value New value
|
* @param mixte $value New value
|
||||||
|
* @param string $format Data format
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function setValueFrom($table, $id, $field, $value)
|
function setValueFrom($table, $id, $field, $value, $format='text')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET ";
|
||||||
$sql.= $field." = '".$this->db->escape($value)."'";
|
if ($format == 'text') $sql.= $field." = '".$this->db->escape($value)."'";
|
||||||
|
else if ($format == 'date') $sql.= $field." = '".$this->db->idate($value)."'";
|
||||||
$sql.= " WHERE rowid = ".$id;
|
$sql.= " WHERE rowid = ".$id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::setValueFrom sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::setValueFrom sql=".$sql, LOG_DEBUG);
|
||||||
|
|||||||
@ -164,6 +164,9 @@ class Form
|
|||||||
|
|
||||||
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && $condition)
|
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && $condition)
|
||||||
{
|
{
|
||||||
|
// Use for timestamp format
|
||||||
|
if ($type == 'datepicker') $out.= '<input id="timeStamp" type="hidden"/>';
|
||||||
|
|
||||||
$out.= '<div class="edit_'.$type.'" id="'.$htmlname.'">';
|
$out.= '<div class="edit_'.$type.'" id="'.$htmlname.'">';
|
||||||
$out.= $value;
|
$out.= $value;
|
||||||
$out.= '</div>';
|
$out.= '</div>';
|
||||||
|
|||||||
@ -105,11 +105,14 @@ $(document).ready(function() {
|
|||||||
cancel : cancelInPlace,
|
cancel : cancelInPlace,
|
||||||
submit : submitInPlace,
|
submit : submitInPlace,
|
||||||
indicator : indicatorInPlace,
|
indicator : indicatorInPlace,
|
||||||
submitdata : {
|
submitdata : function(value, settings) {
|
||||||
|
return {
|
||||||
type: 'datepicker',
|
type: 'datepicker',
|
||||||
element: element,
|
element: element,
|
||||||
table_element: table_element,
|
table_element: table_element,
|
||||||
fk_element: fk_element
|
fk_element: fk_element,
|
||||||
|
timestamp: $('#timeStamp').val()
|
||||||
|
};
|
||||||
},
|
},
|
||||||
callback : function(result, settings) {
|
callback : function(result, settings) {
|
||||||
var obj = $.parseJSON(result);
|
var obj = $.parseJSON(result);
|
||||||
|
|||||||
@ -1,2 +0,0 @@
|
|||||||
modGoogle.class.php
|
|
||||||
modPHPSane.class.php
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
mailinglist_chatsderace.modules.php
|
|
||||||
mailinglist_chiensderace.modules.php
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
jpgraph2
|
|
||||||
phpsane
|
|
||||||
php_excelreader
|
|
||||||
.DS_Store
|
|
||||||
ckfinder
|
|
||||||
@ -1 +0,0 @@
|
|||||||
examples
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
aaa.txt
|
|
||||||
demos
|
|
||||||
@ -1 +0,0 @@
|
|||||||
samples
|
|
||||||
@ -1 +0,0 @@
|
|||||||
install.forced.php
|
|
||||||
@ -1 +0,0 @@
|
|||||||
google.lang
|
|
||||||
@ -1 +0,0 @@
|
|||||||
google.lang
|
|
||||||
@ -1 +0,0 @@
|
|||||||
google.lang
|
|
||||||
@ -1 +0,0 @@
|
|||||||
google.lang
|
|
||||||
@ -1 +0,0 @@
|
|||||||
google.lang
|
|
||||||
@ -1 +0,0 @@
|
|||||||
google.lang
|
|
||||||
@ -1 +0,0 @@
|
|||||||
google.lang
|
|
||||||
@ -1 +0,0 @@
|
|||||||
google.lang
|
|
||||||
@ -1 +0,0 @@
|
|||||||
google.lang
|
|
||||||
@ -16,6 +16,8 @@ jQuery(function($){
|
|||||||
dayNamesShort: ['Dim.','Lun.','Mar.','Mer.','Jeu.','Ven.','Sam.'],
|
dayNamesShort: ['Dim.','Lun.','Mar.','Mer.','Jeu.','Ven.','Sam.'],
|
||||||
dayNamesMin: ['D','L','M','M','J','V','S'],
|
dayNamesMin: ['D','L','M','M','J','V','S'],
|
||||||
weekHeader: 'Sem.',
|
weekHeader: 'Sem.',
|
||||||
|
altField: '#timeStamp',
|
||||||
|
altFormat: '@', // Gives a timestamp dateformat
|
||||||
dateFormat: 'dd/mm/yy',
|
dateFormat: 'dd/mm/yy',
|
||||||
firstDay: 1,
|
firstDay: 1,
|
||||||
isRTL: false,
|
isRTL: false,
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
google.lang
|
|
||||||
@ -1 +0,0 @@
|
|||||||
google.lang
|
|
||||||
@ -1 +0,0 @@
|
|||||||
google.lang
|
|
||||||
@ -1 +0,0 @@
|
|||||||
google.lang
|
|
||||||
@ -1 +0,0 @@
|
|||||||
Thumbs.db
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
don.php
|
|
||||||
merci.php
|
|
||||||
valid.php
|
|
||||||
erreur.php
|
|
||||||
navigation.fr.xsl
|
|
||||||
fsfe-fr.xsl
|
|
||||||
eucd.css
|
|
||||||
donateurs.php
|
|
||||||
graph.php
|
|
||||||
@ -1 +0,0 @@
|
|||||||
Thumbs.db
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
*.db
|
|
||||||
clear
|
|
||||||
bureau2crea?-?ancien
|
|
||||||
@ -1 +0,0 @@
|
|||||||
*.db
|
|
||||||
@ -1 +0,0 @@
|
|||||||
Thumbs.db
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
*.db
|
|
||||||
*.db
|
|
||||||
@ -1 +0,0 @@
|
|||||||
*.db
|
|
||||||
@ -1 +0,0 @@
|
|||||||
tango-icon-theme*
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
*.db
|
|
||||||
style.css?-?Copie.php
|
|
||||||
@ -1 +0,0 @@
|
|||||||
Thumbs.db
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
*.db
|
|
||||||
*.db
|
|
||||||
@ -1 +0,0 @@
|
|||||||
*.db
|
|
||||||
@ -1 +0,0 @@
|
|||||||
tango-icon-theme*
|
|
||||||
@ -1 +0,0 @@
|
|||||||
*.db
|
|
||||||
@ -1 +0,0 @@
|
|||||||
Thumbs.db
|
|
||||||
@ -1 +0,0 @@
|
|||||||
*.db
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
*.db
|
|
||||||
*.db
|
|
||||||
@ -1 +0,0 @@
|
|||||||
*.db
|
|
||||||
@ -1 +0,0 @@
|
|||||||
Thumbs.db
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
*.db
|
|
||||||
*.db
|
|
||||||
@ -1 +0,0 @@
|
|||||||
*.db
|
|
||||||
@ -1 +0,0 @@
|
|||||||
tango-icon-theme*
|
|
||||||
@ -1 +0,0 @@
|
|||||||
report
|
|
||||||
@ -1 +0,0 @@
|
|||||||
report
|
|
||||||
Loading…
Reference in New Issue
Block a user