This commit is contained in:
Grand Philippe 2013-11-28 14:25:42 +01:00
commit 1fc50c137b
5 changed files with 48 additions and 12 deletions

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2008-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
*
@ -48,8 +48,9 @@ if ($actionsave)
$i+=dolibarr_set_const($db,'MAIN_AGENDA_XCAL_EXPORTKEY',trim(GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY','alpha')),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'MAIN_AGENDA_EXPORT_PAST_DELAY',trim(GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY','alpha')),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'MAIN_AGENDA_EXPORT_CACHE',trim(GETPOST('MAIN_AGENDA_EXPORT_CACHE','alpha')),'chaine',0,'',$conf->entity);
if ($i >= 3)
$i+=dolibarr_set_const($db,'AGENDA_EXPORT_FIX_TZ',trim(GETPOST('AGENDA_EXPORT_FIX_TZ','alpha')),'chaine',0,'',$conf->entity);
if ($i >= 4)
{
$db->commit();
setEventMessage($langs->trans("SetupSaved"));
@ -117,6 +118,24 @@ print "</tr>";
print '</table>';
print '<br>';
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print '<td width="25%">'.$langs->trans("Parameter")."</td>";
print "<td>".$langs->trans("Value")."</td>";
print "</tr>";
print "<tr ".$bc[$var].">";
print '<td class="fieldrequired">'.$langs->trans("FixTZ")."</td>";
print "<td>";
print '<input class="flat" type="text" size="4" name="AGENDA_EXPORT_FIX_TZ" value="'.$conf->global->AGENDA_EXPORT_FIX_TZ.'">';
print ' &nbsp; '.$langs->trans("FillThisOnlyIfRequired");
print "</td>";
print "</tr>";
print '</table>';
print '<br><center>';
print "<input type=\"submit\" name=\"save\" class=\"button\" value=\"".$langs->trans("Save")."\">";
print "</center>";

View File

@ -824,7 +824,8 @@ class ActionComm extends CommonObject
require_once (DOL_DOCUMENT_ROOT ."/core/lib/xcal.lib.php");
require_once (DOL_DOCUMENT_ROOT ."/core/lib/date.lib.php");
require_once (DOL_DOCUMENT_ROOT ."/core/lib/files.lib.php");
dol_syslog(get_class($this)."::build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG);
// Check parameters
@ -943,8 +944,8 @@ class ActionComm extends CommonObject
$event=array();
$event['uid']='dolibarragenda-'.$this->db->database_name.'-'.$obj->id."@".$_SERVER["SERVER_NAME"];
$event['type']=$type;
$datestart=$this->db->jdate($obj->datep);
$dateend=$this->db->jdate($obj->datep2);
$datestart=$this->db->jdate($obj->datep)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600));
$dateend=$this->db->jdate($obj->datep2)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600));
$duration=$obj->durationp;
$event['summary']=$obj->label.($obj->socname?" (".$obj->socname.")":"");
$event['desc']=$obj->note;
@ -963,8 +964,8 @@ class ActionComm extends CommonObject
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$url=$urlwithroot.'/comm/action/fiche.php?id='.$obj->id;
$event['url']=$url;
$event['created']=$this->db->jdate($obj->datec);
$event['modified']=$this->db->jdate($obj->datem);
$event['created']=$this->db->jdate($obj->datec)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600));
$event['modified']=$this->db->jdate($obj->datem)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600));
if ($qualified && $datestart)
{
@ -1011,10 +1012,11 @@ class ActionComm extends CommonObject
if ($result >= 0)
{
if (rename($outputfiletmp,$outputfile)) $result=1;
if (dol_move($outputfiletmp,$outputfile,0,1)) $result=1;
else
{
dol_syslog(get_class($this)."::build_exportfile failed to rename ".$outputfiletmp." to ".$outputfile, LOG_ERR);
$this->error='Failed to rename '.$outputfiletmp.' into '.$outputfile;
dol_syslog(get_class($this)."::build_exportfile ".$this->error, LOG_ERR);
dol_delete_file($outputfiletmp,0,1);
$result=-1;
}

View File

@ -531,13 +531,24 @@ function dol_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1)
$result=false;
dol_syslog("files.lib.php::dol_move srcfile=".$srcfile." destfile=".$destfile." newmask=".$newmask." overwritifexists=".$overwriteifexists);
if ($overwriteifexists || ! dol_is_file($destfile))
$destexists=dol_is_file($destfile);
if ($overwriteifexists || ! $destexists)
{
$newpathofsrcfile=dol_osencode($srcfile);
$newpathofdestfile=dol_osencode($destfile);
$result=@rename($newpathofsrcfile, $newpathofdestfile); // To see errors, remove @
if (! $result) dol_syslog("files.lib.php::dol_move failed", LOG_WARNING);
if (! $result)
{
if ($destexists)
{
dol_syslog("files.lib.php::dol_move failed. We try to delete first and move after.", LOG_WARNING);
// We force delete and try again. Rename function sometimes fails to replace dest file with some windows NTFS partitions.
dol_delete_file($destfile);
$result=@rename($newpathofsrcfile, $newpathofdestfile); // To see errors, remove @
}
else dol_syslog("files.lib.php::dol_move failed", LOG_WARNING);
}
if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
@chmod($newpathofsrcfile, octdec($newmask));
}

View File

@ -1008,6 +1008,8 @@ XDebugInstalled=XDebug est chargé.
XCacheInstalled=XCache is loaded.
AddRefInList=Display customer/supplier ref into list (select list or combobox) and most of hyperlink
FieldEdition=Edition of field %s
FixTZ=TimeZone fix
FillThisOnlyIfRequired=Example: +2 (fill only if timezone offset problems are experienced)
##### Module password generation
PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: 8 characters containing shared numbers and characters in lowercase.
PasswordGenerationNone=Do not suggest any generated password. Password must be type in manually.

View File

@ -1050,6 +1050,8 @@ XDebugInstalled=XDebug est chargé.
XCacheInstalled=XCache est chargé.
AddRefInList=Afficher le code client/fournisseur dans les liste (déroulante ou autocomplétion) et dans la pluspart des hyperliens
FieldEdition=Édition du champ %s
FixTZ=Correction du Timezone
FillThisOnlyIfRequired=Exemple: +2 (ne remplir que si un décalage d'heure est constaté dans l'export)
##### Module password generation
PasswordGenerationStandard=Renvoie un mot de passe généré selon l'algorithme interne de Dolibarr : 8 caractères, chiffres et caractères en minuscules mélangés.
PasswordGenerationNone=Ne propose pas de mots de passe générés. Le mot de passe est à saisir manuellement.