forked from Wavyzz/dolibarr
Fix: Date must be GTM in agenda export
This commit is contained in:
@@ -151,12 +151,12 @@ class ActionComm
|
||||
$sql.= "fk_facture,propalrowid,fk_commande)";
|
||||
$sql.= " VALUES (";
|
||||
$sql.= "'".$this->db->idate($now)."',";
|
||||
$sql.= ($this->datep?"'".$this->db->idate($this->datep)."'":"null").",";
|
||||
$sql.= ($this->datef?"'".$this->db->idate($this->datef)."'":"null").",";
|
||||
$sql.= ($this->date?"'".$this->db->idate($this->date)."'":"null").",";
|
||||
$sql.= ($this->dateend?"'".$this->db->idate($this->dateend)."'":"null").",";
|
||||
$sql.= ($this->durationp >= 0?"'".$this->durationp."'":"null").",";
|
||||
$sql.= ($this->durationa >= 0?"'".$this->durationa."'":"null").",";
|
||||
$sql.= ($this->datep!=''?"'".$this->db->idate($this->datep)."'":"null").",";
|
||||
$sql.= ($this->datef!=''?"'".$this->db->idate($this->datef)."'":"null").",";
|
||||
$sql.= ($this->date!=''?"'".$this->db->idate($this->date)."'":"null").",";
|
||||
$sql.= ($this->dateend!=''?"'".$this->db->idate($this->dateend)."'":"null").",";
|
||||
$sql.= ($this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null").",";
|
||||
$sql.= ($this->durationa >= 0 && $this->durationa != ''?"'".$this->durationa."'":"null").",";
|
||||
$sql.= "'".$this->type_id."', '".$this->societe->id."' ,'".addslashes($this->note)."',";
|
||||
$sql.= ($this->contact->id > 0?"'".$this->contact->id."'":"null").",";
|
||||
$sql.= ($user->id > 0 ? "'".$user->id."'":"null").",";
|
||||
@@ -334,13 +334,14 @@ class ActionComm
|
||||
return -1;
|
||||
}
|
||||
|
||||
//print 'eeea'.$this->datep.'-'.(strval($this->datep) != '').'-'.$this->db->idate($this->datep);
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm ";
|
||||
$sql.= " SET percent='".$this->percentage."'";
|
||||
$sql.= ", label = ".($this->label ? "'".addslashes($this->label)."'":"null");
|
||||
$sql.= ", datep = ".($this->datep ? "'".$this->db->idate($this->datep)."'" : 'null');
|
||||
$sql.= ", datep2 = ".($this->datef ? "'".$this->db->idate($this->datef)."'" : 'null');
|
||||
$sql.= ", datea = ".($this->date ? "'".$this->db->idate($this->date)."'" : 'null');
|
||||
$sql.= ", datea2 = ".($this->dateend ? "'".$this->db->idate($this->dateend)."'" : 'null');
|
||||
$sql.= ", datep = ".(strval($this->datep)!='' ? "'".$this->db->idate($this->datep)."'" : 'null');
|
||||
$sql.= ", datep2 = ".(strval($this->datef)!='' ? "'".$this->db->idate($this->datef)."'" : 'null');
|
||||
$sql.= ", datea = ".(strval($this->date)!='' ? "'".$this->db->idate($this->date)."'" : 'null');
|
||||
$sql.= ", datea2 = ".(strval($this->dateend)!='' ? "'".$this->db->idate($this->dateend)."'" : 'null');
|
||||
$sql.= ", note = ".($this->note ? "'".addslashes($this->note)."'":"null");
|
||||
$sql.= ", fk_soc =". ($this->societe->id > 0 ? "'".$this->societe->id."'":"null");
|
||||
$sql.= ", fk_contact =". ($this->contact->id > 0 ? "'".$this->contact->id."'":"null");
|
||||
|
||||
@@ -171,13 +171,13 @@ if ($_POST["action"] == 'add_action')
|
||||
$actioncomm->duree=(($_POST["dureehour"] * 60) + $_POST["dureemin"]) * 60;
|
||||
|
||||
$usertodo=new User($db,$_POST["affectedto"]);
|
||||
if ($_POST["affectedto"])
|
||||
if ($_POST["affectedto"] > 0)
|
||||
{
|
||||
$usertodo->fetch();
|
||||
}
|
||||
$actioncomm->usertodo = $usertodo;
|
||||
$userdone=new User($db,$_POST["doneby"]);
|
||||
if ($_POST["doneby"])
|
||||
if ($_POST["doneby"] > 0)
|
||||
{
|
||||
$userdone->fetch();
|
||||
}
|
||||
@@ -243,13 +243,14 @@ if ($_POST["action"] == 'add_action')
|
||||
// Si erreur
|
||||
$db->rollback();
|
||||
$_GET["id"]=$idaction;
|
||||
$error='<div class="error">'.$actioncomm->error.'</div>';
|
||||
$error=$actioncomm->error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
$error='<div class="error">'.$actioncomm->error.'</div>';
|
||||
$_GET["id"]=$idaction;
|
||||
$error=$actioncomm->error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,6 +300,7 @@ if ($_POST["action"] == 'update')
|
||||
$_POST["apmonth"],
|
||||
$_POST["apday"],
|
||||
$_POST["apyear"]);
|
||||
|
||||
$datep2=dolibarr_mktime($_POST["p2hour"],
|
||||
$_POST["p2min"],
|
||||
0,
|
||||
@@ -317,14 +319,10 @@ if ($_POST["action"] == 'update')
|
||||
$_POST["a2month"],
|
||||
$_POST["a2day"],
|
||||
$_POST["a2year"]);
|
||||
// Si param incorrects, mktime renvoi false en PHP 5.1, -1 avant
|
||||
if (! ($datep > 0)) $datep='';
|
||||
if (! ($datep2 > 0)) $datep2='';
|
||||
if (! ($datea > 0)) $datea='';
|
||||
if (! ($datea2 > 0)) $datea2='';
|
||||
|
||||
//print $_POST["apmonth"].",".$_POST["apday"].",".$_POST["apyear"].",".$_POST["aphour"].",".$_POST["apmin"]."<br>\n";
|
||||
//print $actioncomm->datep;
|
||||
//print 'dddd'.$datep;
|
||||
$actioncomm->label = $_POST["label"];
|
||||
$actioncomm->datep = $datep;
|
||||
$actioncomm->datef = $datep2;
|
||||
|
||||
@@ -2642,7 +2642,7 @@ class Form
|
||||
$shour = $reg[4];
|
||||
$smin = $reg[5];
|
||||
}
|
||||
elseif ($set_time > 0)
|
||||
elseif (strval($set_time) != '')
|
||||
{
|
||||
// Date est un timestamps
|
||||
$syear = date("Y", $set_time);
|
||||
@@ -2669,7 +2669,7 @@ class Form
|
||||
if ($conf->use_javascript_ajax && $conf->use_popup_calendar)
|
||||
{
|
||||
//print "e".$set_time." t ".$conf->format_date_short;
|
||||
if ($set_time > 0)
|
||||
if (strval($set_time) != '')
|
||||
{
|
||||
$formated_date=dolibarr_print_date($set_time,$conf->format_date_short);
|
||||
}
|
||||
|
||||
@@ -402,20 +402,20 @@ function dolibarr_time_plus_duree($time,$duration_value,$duration_unit)
|
||||
|
||||
|
||||
/**
|
||||
\brief Formattage de la date en fonction de la langue $conf->langage
|
||||
\param time Date 'timestamp' ou format 'YYYY-MM-DD' ou 'YYYY-MM-DD HH:MM:SS'
|
||||
\param format Format d'affichage de la date
|
||||
"%d %b %Y",
|
||||
"%d/%m/%Y %H:%M",
|
||||
"%d/%m/%Y %H:%M:%S",
|
||||
"day", "daytext", "dayhour", "dayhourldap", "dayhourtext"
|
||||
\return string Date format<EFBFBD>e ou '' si time null
|
||||
* \brief Formattage de la date en fonction de la langue $conf->langage
|
||||
* \param time Date 'timestamp' ou format 'YYYY-MM-DD' ou 'YYYY-MM-DD HH:MM:SS'
|
||||
* \param format Format d'affichage de la date
|
||||
* "%d %b %Y",
|
||||
* "%d/%m/%Y %H:%M",
|
||||
* "%d/%m/%Y %H:%M:%S",
|
||||
* "day", "daytext", "dayhour", "dayhourldap", "dayhourtext"
|
||||
* \return string Date formatee ou '' si time null
|
||||
*/
|
||||
function dolibarr_print_date($time,$format='')
|
||||
function dolibarr_print_date($time,$format='',$to_gmt=false)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Si format non d<EFBFBD>fini, on prend $conf->format_date_text_short sinon %Y-%m-%d %H:%M:%S
|
||||
// Si format non defini, on prend $conf->format_date_text_short sinon %Y-%m-%d %H:%M:%S
|
||||
if (! $format) $format=(isset($conf->format_date_text_short) ? $conf->format_date_text_short : '%Y-%m-%d %H:%M:%S');
|
||||
|
||||
if ($format == 'day') $format=$conf->format_date_short;
|
||||
@@ -440,24 +440,24 @@ function dolibarr_print_date($time,$format='')
|
||||
$smin = $reg[5];
|
||||
$ssec = $reg[6];
|
||||
|
||||
return adodb_strftime($format,dolibarr_mktime($shour,$smin,$ssec,$smonth,$sday,$syear));
|
||||
return adodb_strftime($format,dolibarr_mktime($shour,$smin,$ssec,$smonth,$sday,$syear),$to_gmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Date est un timestamps
|
||||
return adodb_strftime($format,$time);
|
||||
return adodb_strftime($format,$time,$to_gmt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Retourne une date fabriqu<EFBFBD>e depuis une chaine
|
||||
\param string Date format<EFBFBD>e en chaine
|
||||
YYYYMMDD
|
||||
YYYYMMDDHHMMSS
|
||||
DD/MM/YY ou DD/MM/YYYY
|
||||
DD/MM/YY HH:MM:SS ou DD/MM/YYYY HH:MM:SS
|
||||
\return date Date
|
||||
* \brief Retourne une date fabrique depuis une chaine
|
||||
* \param string Date formate en chaine
|
||||
* YYYYMMDD
|
||||
* YYYYMMDDHHMMSS
|
||||
* DD/MM/YY ou DD/MM/YYYY
|
||||
* DD/MM/YY HH:MM:SS ou DD/MM/YYYY HH:MM:SS
|
||||
* \return date Date
|
||||
*/
|
||||
function dolibarr_stringtotime($string)
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ function build_calfile($format='vcal',$title,$desc,$events_array,$outputfile,$fi
|
||||
if ($eventqualified)
|
||||
{
|
||||
// See http://fr.wikipedia.org/wiki/ICalendar for format
|
||||
//$uid = dolibarr_print_date($now,'dayhourxcard').'-'.$event['uid']."-export@".$_SERVER["SERVER_NAME"];
|
||||
//$uid = dolibarr_print_date($now,'dayhourxcard',true).'-'.$event['uid']."-export@".$_SERVER["SERVER_NAME"];
|
||||
$uid = $event['uid'];
|
||||
$type = $event['type'];
|
||||
$startdate = $event['startdate'];
|
||||
@@ -136,11 +136,13 @@ function build_calfile($format='vcal',$title,$desc,$events_array,$outputfile,$fi
|
||||
if (! empty($location)) fwrite($calfileh,"LOCATION:".$location."\n");
|
||||
//fwrite($calfileh,"TRANSP:".$transparency."\n");
|
||||
//fwrite($calfileh,"CLASS:PUBLIC\n"); // PUBLIC, PRIVATE, CONFIDENTIAL
|
||||
fwrite($calfileh,"DTSTAMP:".dolibarr_print_date($now,'dayhourxcard')."\n");
|
||||
$startdatef = dolibarr_print_date($startdate,'dayhourxcard');
|
||||
|
||||
// Date must be GMT dates
|
||||
fwrite($calfileh,"DTSTAMP:".dolibarr_print_date($now,'dayhourxcard',true)."\n");
|
||||
$startdatef = dolibarr_print_date($startdate,'dayhourxcard',true);
|
||||
fwrite($calfileh,"DTSTART:".$startdatef."\n");
|
||||
if (empty($enddate)) $enddate=$startdate+$duration;
|
||||
$enddatef = dolibarr_print_date($enddate,'dayhourxcard');
|
||||
$enddatef = dolibarr_print_date($enddate,'dayhourxcard',true);
|
||||
fwrite($calfileh,"DTEND:".$enddatef."\n");
|
||||
fwrite($calfileh,"END:VEVENT\n");
|
||||
}
|
||||
@@ -171,7 +173,7 @@ function build_calfile($format='vcal',$title,$desc,$events_array,$outputfile,$fi
|
||||
fwrite($calfileh,"LOCATION:".$location."\n");
|
||||
fwrite($calfileh,"TRANSP:OPAQUE\n");
|
||||
fwrite($calfileh,"CLASS:CONFIDENTIAL\n");
|
||||
fwrite($calfileh,"DTSTAMP:".dolibarr_print_date($startdatef,'dayhourxcard')."\n");
|
||||
fwrite($calfileh,"DTSTAMP:".dolibarr_print_date($startdatef,'dayhourxcard',true)."\n");
|
||||
|
||||
fwrite($calfileh,"END:VJOURNAL\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user