Merge branch '3.2' of https://github.com/Dolibarr/dolibarr into 3.2
This commit is contained in:
commit
f7476d5727
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
@ -178,14 +178,14 @@ $var=true;
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="140"><input '.$bc[$var].' type="checkbox" name="SYSLOG_FILE_ON" '.$option.' value="1" '.($syslog_file_on?' checked="checked"':'').'> '.$langs->trans("SyslogSimpleFile").'</td>';
|
||||
print '<td width="250" nowrap="nowrap">'.$langs->trans("SyslogFilename").': <input type="text" class="flat" name="filename" '.$option.' size="60" value="'.$defaultsyslogfile.'">';
|
||||
print '<td nowrap="nowrap">'.$langs->trans("SyslogFilename").': <input type="text" class="flat" name="filename" '.$option.' size="60" value="'.$defaultsyslogfile.'">';
|
||||
print '</td>';
|
||||
print "<td align=\"left\">".$form->textwithpicto('',$langs->trans("YouCanUseDOL_DATA_ROOT"));
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="140"><input '.$bc[$var].' type="checkbox" name="SYSLOG_SYSLOG_ON" '.$option.' value="1" '.($syslog_syslog_on?' checked="checked"':'').'> '.$langs->trans("SyslogSyslog").'</td>';
|
||||
print '<td width="250" nowrap="nowrap">'.$langs->trans("SyslogFacility").': <input type="text" class="flat" name="facility" '.$option.' value="'.$defaultsyslogfacility.'">';
|
||||
print '<td nowrap="nowrap">'.$langs->trans("SyslogFacility").': <input type="text" class="flat" name="facility" '.$option.' value="'.$defaultsyslogfacility.'">';
|
||||
print '</td>';
|
||||
print "<td align=\"left\">".$form->textwithpicto('','Only LOG_USER supported on Windows');
|
||||
print '</td></tr>';
|
||||
@ -202,7 +202,7 @@ try
|
||||
if (! class_exists('FirePHP')) print ' disabled="disabled"';
|
||||
else print ($syslog_firephp_on?' checked="checked"':"");
|
||||
print '> '.$langs->trans("FirePHP").'</td>';
|
||||
print '<td width="250" nowrap="nowrap">';
|
||||
print '<td nowrap="nowrap">';
|
||||
print '</td>';
|
||||
print "<td align=\"left\">".$form->textwithpicto('','FirePHP must be installed onto PHP and FirePHP plugin for Firefox must also be installed');
|
||||
print '</td></tr>';
|
||||
@ -232,7 +232,7 @@ print '<td align="right"><input type="submit" class="button" '.$option.' value="
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width=\"140\">'.$langs->trans("SyslogLevel").'</td>';
|
||||
print '<tr '.$bc[$var].'><td width="140">'.$langs->trans("SyslogLevel").'</td>';
|
||||
print '<td colspan="2"><select class="flat" name="level" '.$option.'>';
|
||||
print '<option value="'.LOG_EMERG.'" '.($conf->global->SYSLOG_LEVEL==LOG_EMERG?'SELECTED':'').'>LOG_EMERG ('.LOG_EMERG.')</option>';
|
||||
print '<option value="'.LOG_ALERT.'" '.($conf->global->SYSLOG_LEVEL==LOG_ALERT?'SELECTED':'').'>LOG_ALERT ('.LOG_ALERT.')</option>';
|
||||
|
||||
@ -157,10 +157,16 @@ $txt =$langs->trans("OSTZ").' (variable system TZ): '.($_ENV["TZ"]?$_ENV["TZ"]:$
|
||||
$txt.=$langs->trans("PHPTZ").' (php.ini date.timezone): '.(ini_get("date.timezone")?ini_get("date.timezone"):$langs->trans("NotDefined")).''."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentTimeZone").'</td><td>'; // Timezone server PHP
|
||||
$a=getServerTimeZoneString();
|
||||
$a.=' '.(getServerTimeZoneInt()>=0?'+':'').getServerTimeZoneInt();
|
||||
$a.=' ('.(getServerTimeZoneInt()>=0?'+':'').(getServerTimeZoneInt()*3600).')';
|
||||
print $form->textwithtooltip($a,$txt,2,1,img_info(''));
|
||||
$a=getServerTimeZoneInt('now');
|
||||
$b=getServerTimeZoneInt('winter');
|
||||
$c=getServerTimeZoneInt('summer');
|
||||
$daylight=(is_numeric($c) && is_numeric($b))?round($c-$b):'unknown';
|
||||
//print $a." ".$b." ".$c." ".$daylight;
|
||||
$val=($a>=0?'+':'').$a;
|
||||
$val.=' ('.($a==='unknown'?'unknown':($a>=0?'+':'').($a*3600)).')';
|
||||
$val.=' '.getServerTimeZoneString().' '.($b>=0?'+':'').$b.' ('.($b>=0?'+':'').($b*3600).')';
|
||||
$val.=' '.$langs->trans("DaylingSavingTime").': '.($daylight==='unknown'?'unknown':yn($daylight));
|
||||
print $form->textwithtooltip($val,$txt,2,1,img_info(''));
|
||||
print '</td></tr>'."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="300"> => '.$langs->trans("CurrentHour").'</td><td>'.dol_print_date(dol_now(),'dayhour','tzserver').'</td></tr>'."\n";
|
||||
|
||||
@ -420,7 +420,7 @@ if ($action == 'create')
|
||||
print '<form name="formaction" action="'.DOL_URL_ROOT.'/comm/action/fiche.php" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add_action">';
|
||||
print '<input type="hidden" name="backtopage" value="'.((! empty($backtopage) && $backtopage != '1') ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
|
||||
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
|
||||
|
||||
if (GETPOST("actioncode") == 'AC_RDV') print_fiche_titre($langs->trans("AddActionRendezVous"));
|
||||
else print_fiche_titre($langs->trans("AddAnAction"));
|
||||
@ -673,7 +673,7 @@ if ($id)
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '<input type="hidden" name="ref_ext" value="'.$act->ref_ext.'">';
|
||||
print '<input type="hidden" name="backtopage" value="'.((! empty($backtopage) && $backtopage != '1')? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
|
||||
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1'? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -741,7 +741,7 @@ if ($id)
|
||||
|
||||
// Contact
|
||||
print '<td>'.$langs->trans("Contact").'</td><td width="30%">';
|
||||
print $form->selectarray("contactid", $act->societe->contact_array(), $act->contact->id, 1);
|
||||
print $form->selectarray("contactid", (empty($act->societe->id)?array():$act->societe->contact_array()), $act->contact->id, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Project
|
||||
|
||||
@ -1519,7 +1519,7 @@ class Facture extends CommonObject
|
||||
$now=dol_now();
|
||||
|
||||
$error=0;
|
||||
dol_syslog(get_class($this).'::validate force_number='.$force_number,' idwarehouse='.$idwarehouse, LOG_WARNING);
|
||||
dol_syslog(get_class($this).'::validate force_number='.$force_number.', idwarehouse='.$idwarehouse, LOG_WARNING);
|
||||
|
||||
// Check parameters
|
||||
if (! $this->brouillon)
|
||||
|
||||
@ -131,7 +131,7 @@ class Contact extends CommonObject
|
||||
$sql.= "'".$this->db->idate($now)."',";
|
||||
if ($this->socid > 0) $sql.= " ".$this->socid.",";
|
||||
else $sql.= "null,";
|
||||
$sql.= "'".$this->db->escape($this->name)."',";
|
||||
$sql.= "'".$this->db->escape($this->lastname)."',";
|
||||
$sql.= "'".$this->db->escape($this->firstname)."',";
|
||||
$sql.= " ".($user->id > 0 ? "'".$user->id."'":"null").",";
|
||||
$sql.= " ".$this->priv.",";
|
||||
@ -330,7 +330,7 @@ class Contact extends CommonObject
|
||||
|
||||
// Fields
|
||||
if ($this->fullname && $conf->global->LDAP_CONTACT_FIELD_FULLNAME) $info[$conf->global->LDAP_CONTACT_FIELD_FULLNAME] = $this->fullname;
|
||||
if ($this->name && $conf->global->LDAP_CONTACT_FIELD_NAME) $info[$conf->global->LDAP_CONTACT_FIELD_NAME] = $this->name;
|
||||
if ($this->lastname && $conf->global->LDAP_CONTACT_FIELD_NAME) $info[$conf->global->LDAP_CONTACT_FIELD_NAME] = $this->lastname;
|
||||
if ($this->firstname && $conf->global->LDAP_CONTACT_FIELD_FIRSTNAME) $info[$conf->global->LDAP_CONTACT_FIELD_FIRSTNAME] = $this->firstname;
|
||||
|
||||
if ($this->poste) $info["title"] = $this->poste;
|
||||
@ -744,6 +744,7 @@ class Contact extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
dol_syslog("Error ".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
@ -159,13 +159,13 @@ if (empty($reshook))
|
||||
$error++; $errors[]=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname").' / '.$langs->transnoentities("Label"));
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$id = $object->create($user);
|
||||
if ($id <= 0)
|
||||
{
|
||||
$error++; $errors[]=($object->error?array($object->error):$object->errors);
|
||||
$error++; $errors=array_merge($errors,($object->error?array($object->error):$object->errors));
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
@ -199,7 +199,7 @@ if (empty($reshook))
|
||||
}
|
||||
else
|
||||
{
|
||||
$error=$object->error; $errors[]=$object->errors;
|
||||
$error=$object->error; $errors=$object->errors;
|
||||
}
|
||||
}
|
||||
|
||||
@ -355,7 +355,7 @@ else
|
||||
print_fiche_titre($title);
|
||||
|
||||
// Affiche les erreurs
|
||||
dol_htmloutput_errors($error,$errors);
|
||||
dol_htmloutput_errors(is_numeric($error)?'':$error,$errors);
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
@ -689,7 +689,7 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($id) && $action != 'edit')
|
||||
if (! empty($id) && $action != 'edit' && $action != 'create')
|
||||
{
|
||||
$objsoc = new Societe($db);
|
||||
|
||||
|
||||
@ -32,6 +32,8 @@ $langs->load("companies");
|
||||
$langs->load("ldap");
|
||||
$langs->load("admin");
|
||||
|
||||
$action=GETPOST('action');
|
||||
|
||||
// Security check
|
||||
$contactid = isset($_GET["id"])?$_GET["id"]:'';
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
@ -45,7 +47,7 @@ $contact->fetch($_GET["id"], $user);
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($_GET["action"] == 'dolibarr2ldap')
|
||||
if ($action == 'dolibarr2ldap')
|
||||
{
|
||||
$message="";
|
||||
|
||||
@ -133,7 +135,7 @@ print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
if ($message) { print $message; }
|
||||
dol_htmloutput_mesg($message);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -411,7 +411,7 @@ class Ldap
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog("Ldap::add dn=".$dn." info=".join(',',$info));
|
||||
dol_syslog(get_class($this)."::add dn=".$dn." info=".join(',',$info));
|
||||
|
||||
// Check parameters
|
||||
if (! $this->connection)
|
||||
@ -439,13 +439,14 @@ class Ldap
|
||||
|
||||
if ($result)
|
||||
{
|
||||
dol_syslog("Ldap::add successfull", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::add successfull", LOG_DEBUG);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=@ldap_error($this->connection);
|
||||
dol_syslog("Ldap::add failed: ".$this->error, LOG_ERR);
|
||||
$this->errno=@ldap_errno($this->connection);
|
||||
dol_syslog(get_class($this)."::add failed: ".$this->errno." ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@ class DoliDBPgsql
|
||||
}
|
||||
|
||||
// We remove end of requests "AFTER fieldxxx"
|
||||
$line=preg_replace('/AFTER [a-z0-9_]+/i','',$line);
|
||||
$line=preg_replace('/\sAFTER [a-z0-9_]+/i','',$line);
|
||||
|
||||
// We remove start of requests "ALTER TABLE tablexxx" if this is a DROP INDEX
|
||||
$line=preg_replace('/ALTER TABLE [a-z0-9_]+ DROP INDEX/i','DROP INDEX',$line);
|
||||
@ -258,7 +258,7 @@ class DoliDBPgsql
|
||||
}
|
||||
|
||||
// alter table add primary key (field1, field2 ...) -> We remove the primary key name not accepted by PostGreSQL
|
||||
// ALTER TABLE llx_dolibarr_modules ADD PRIMARY KEY pk_dolibarr_modules (numero, entity);
|
||||
// ALTER TABLE llx_dolibarr_modules ADD PRIMARY KEY pk_dolibarr_modules (numero, entity)
|
||||
if (preg_match('/ALTER\s+TABLE\s*(.*)\s*ADD\s+PRIMARY\s+KEY\s*(.*)\s*\((.*)$/i',$line,$reg))
|
||||
{
|
||||
$line = "-- ".$line." replaced by --\n";
|
||||
@ -266,14 +266,22 @@ class DoliDBPgsql
|
||||
}
|
||||
|
||||
// Translate order to drop foreign keys
|
||||
// ALTER TABLE llx_dolibarr_modules DROP FOREIGN KEY fk_xxx;
|
||||
// ALTER TABLE llx_dolibarr_modules DROP FOREIGN KEY fk_xxx
|
||||
if (preg_match('/ALTER\s+TABLE\s*(.*)\s*DROP\s+FOREIGN\s+KEY\s*(.*)$/i',$line,$reg))
|
||||
{
|
||||
$line = "-- ".$line." replaced by --\n";
|
||||
$line.= "ALTER TABLE ".$reg[1]." DROP CONSTRAINT ".$reg[2];
|
||||
}
|
||||
|
||||
// alter table add [unique] [index] (field1, field2 ...)
|
||||
// Translate order to add foreign keys
|
||||
// ALTER TABLE llx_tablechild ADD CONSTRAINT fk_tablechild_fk_fieldparent FOREIGN KEY (fk_fieldparent) REFERENCES llx_tableparent (rowid)
|
||||
if (preg_match('/ALTER\s+TABLE\s+(.*)\s*ADD CONSTRAINT\s+(.*)\s*FOREIGN\s+KEY\s*(.*)$/i',$line,$reg))
|
||||
{
|
||||
$line=preg_replace('/;$/','',$line);
|
||||
$line.=" DEFERRABLE INITIALLY IMMEDIATE;";
|
||||
}
|
||||
|
||||
// alter table add [unique] [index] (field1, field2 ...)
|
||||
// ALTER TABLE llx_accountingaccount ADD INDEX idx_accountingaccount_fk_pcg_version (fk_pcg_version)
|
||||
if (preg_match('/ALTER\s+TABLE\s*(.*)\s*ADD\s+(UNIQUE INDEX|INDEX|UNIQUE)\s+(.*)\s*\(([\w,\s]+)\)/i',$line,$reg))
|
||||
{
|
||||
|
||||
@ -77,7 +77,7 @@ function getServerTimeZoneString()
|
||||
* Return server timezone int.
|
||||
* If $conf->global->MAIN_NEW_DATE is set, we use new behaviour: All convertions take care of dayling saving time.
|
||||
*
|
||||
* @param string $refgmtdate Reference date for timezone (timezone differs on winter and summer)
|
||||
* @param string $refgmtdate Reference period for timezone (timezone differs on winter and summer. May be 'now', 'winter' or 'summer')
|
||||
* @return int An offset in hour (+1 for Europe/Paris on winter and +2 for Europe/Paris on summer)
|
||||
*/
|
||||
function getServerTimeZoneInt($refgmtdate='now')
|
||||
@ -86,16 +86,39 @@ function getServerTimeZoneInt($refgmtdate='now')
|
||||
if (class_exists('DateTime') && ! empty($conf->global->MAIN_NEW_DATE))
|
||||
{
|
||||
// Method 1 (include daylight)
|
||||
$gmtnow=dol_now('gmt'); $yearref=dol_print_date($gmtnow,'%Y'); $monthref=dol_print_date($gmtnow,'%m'); $dayref=dol_print_date($gmtnow,'%d');
|
||||
if ($refgmtdate == 'now') $newrefgmtdate=$yearref.'-'.$monthref.'-'.$dayref;
|
||||
elseif ($refgmtdate == 'summer') $newrefgmtdate=$yearref.'-05-15';
|
||||
else $newrefgmtdate=$yearref.'-01-01';
|
||||
$localtz = new DateTimeZone(getServerTimeZoneString());
|
||||
$localdt = new DateTime($refgmtdate, $localtz);
|
||||
$localdt = new DateTime($newrefgmtdate, $localtz);
|
||||
$tmp=-1*$localtz->getOffset($localdt);
|
||||
//print $refgmtdate.'='.$tmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Method 2 (does not include daylight)
|
||||
$tmp=dol_mktime(0,0,0,1,1,1970);
|
||||
// Method 2 (does not include daylight, not supported by adodb)
|
||||
if ($refgmtdate == 'now')
|
||||
{
|
||||
// We don't know server timezone string, so we don't know location, so we can't guess daylight. We assume we use same than client. Fix is to use MAIN_NEW_DATE.
|
||||
$gmtnow=dol_now('gmt'); $yearref=dol_print_date($gmtnow,'%Y'); $monthref=dol_print_date($gmtnow,'%m'); $dayref=dol_print_date($gmtnow,'%d');
|
||||
if (dol_stringtotime($_SESSION['dol_dst_first']) <= $gmtnow && $gmtnow < dol_stringtotime($_SESSION['dol_dst_second'])) $daylight=1;
|
||||
else $daylight=0;
|
||||
$tmp=dol_mktime(0,0,0,$monthref,$dayref,$yearref,false,0)-dol_mktime(0,0,0,$monthref,$dayref,$yearref,true,0)-($daylight*3600);
|
||||
return 'unknown';
|
||||
}
|
||||
elseif ($refgmtdate == 'summer')
|
||||
{
|
||||
// We don't know server timezone string, so we don't know location, so we can't guess daylight. We assume we use same than client. Fix is to use MAIN_NEW_DATE.
|
||||
$gmtnow=dol_now('gmt'); $yearref=dol_print_date($gmtnow,'%Y'); $monthref='08'; $dayref='01';
|
||||
if (dol_stringtotime($_SESSION['dol_dst_first']) <= dol_stringtotime($yearref.'-'.$monthref.'-'.$dayref) && dol_stringtotime($yearref.'-'.$monthref.'-'.$dayref) < dol_stringtotime($_SESSION['dol_dst_second'])) $daylight=1;
|
||||
else $daylight=0;
|
||||
$tmp=dol_mktime(0,0,0,$monthref,$dayref,$yearref,false,0)-dol_mktime(0,0,0,$monthref,$dayref,$yearref,true,0)-($daylight*3600);
|
||||
return 'unknown';
|
||||
}
|
||||
else $tmp=dol_mktime(0,0,0,1,1,1970);
|
||||
}
|
||||
$tz=($tmp<0?1:-1)*abs($tmp/3600);
|
||||
$tz=round(($tmp<0?1:-1)*abs($tmp/3600));
|
||||
return $tz;
|
||||
}
|
||||
|
||||
@ -781,4 +804,4 @@ function monthArray($outputlangs)
|
||||
return $montharray;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@ -1007,7 +1007,7 @@ function dol_now($mode='gmt')
|
||||
else if ($mode == 'tzserver') // Time for now with PHP server timezone added
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php');
|
||||
$tzsecond=getServerTimeZoneInt(); // Contains tz+dayling saving time
|
||||
$tzsecond=getServerTimeZoneInt('now'); // Contains tz+dayling saving time
|
||||
$ret=dol_now('gmt')+($tzsecond*3600);
|
||||
}
|
||||
/*else if ($mode == 'tzref') // Time for now with parent company timezone is added
|
||||
|
||||
@ -91,6 +91,7 @@ function dol_print_file($langs,$filename,$searchalt=0)
|
||||
|
||||
/**
|
||||
* Show informations on an object
|
||||
* TODO Move this into html.formother
|
||||
*
|
||||
* @param Object $object Objet to show
|
||||
* @return void
|
||||
@ -99,6 +100,15 @@ function dol_print_object_info($object)
|
||||
{
|
||||
global $langs,$db;
|
||||
$langs->load("other");
|
||||
$langs->load("admin");
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php');
|
||||
|
||||
$deltadateforserver=getServerTimeZoneInt('now');
|
||||
$deltadateforclient=((int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']);
|
||||
//$deltadateforcompany=((int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']);
|
||||
$deltadateforuser=round($deltadateforclient-$deltadateforserver);
|
||||
//print "x".$deltadateforserver." - ".$deltadateforclient." - ".$deltadateforuser;
|
||||
|
||||
// Import key
|
||||
if (isset($object->import_key))
|
||||
@ -123,7 +133,11 @@ function dol_print_object_info($object)
|
||||
|
||||
// Date
|
||||
if (isset($object->date_creation))
|
||||
print $langs->trans("DateCreation")." : " . dol_print_date($object->date_creation,"dayhourtext") . '<br>';
|
||||
{
|
||||
print $langs->trans("DateCreation")." : " . dol_print_date($object->date_creation,"dayhour");
|
||||
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_creation+($deltadateforuser*3600),"dayhour").' '.$langs->trans("ClientHour");
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
// User change
|
||||
if (isset($object->user_modification))
|
||||
@ -144,7 +158,11 @@ function dol_print_object_info($object)
|
||||
|
||||
// Date
|
||||
if (isset($object->date_modification))
|
||||
print $langs->trans("DateLastModification")." : " . dol_print_date($object->date_modification,"dayhourtext") . '<br>';
|
||||
{
|
||||
print $langs->trans("DateLastModification")." : " . dol_print_date($object->date_modification,"dayhour");
|
||||
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_modification+($deltadateforuser*3600),"dayhour").' '.$langs->trans("ClientHour");
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
// User validation
|
||||
if (isset($object->user_validation))
|
||||
@ -165,7 +183,36 @@ function dol_print_object_info($object)
|
||||
|
||||
// Date
|
||||
if (isset($object->date_validation))
|
||||
print $langs->trans("DateValidation")." : " . dol_print_date($object->date_validation,"dayhourtext") . '<br>';
|
||||
{
|
||||
print $langs->trans("DateValidation")." : " . dol_print_date($object->date_validation,"dayhour");
|
||||
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_validation+($deltadateforuser*3600),"dayhour").' '.$langs->trans("ClientHour");
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
// User approve
|
||||
if (isset($object->user_approve))
|
||||
{
|
||||
print $langs->trans("ApprovedBy")." : ";
|
||||
if (is_object($object->user_approve))
|
||||
{
|
||||
print $object->user_approve->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$userstatic=new User($db);
|
||||
$userstatic->fetch($object->user_approve);
|
||||
print $userstatic->getNomUrl(1);
|
||||
}
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
// Date approve
|
||||
if (isset($object->date_approve))
|
||||
{
|
||||
print $langs->trans("DateApprove")." : " . dol_print_date($object->date_approve,"dayhour");
|
||||
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_approve+($deltadateforuser*3600),"dayhour").' '.$langs->trans("ClientHour");
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
// User close
|
||||
if (isset($object->user_cloture))
|
||||
@ -186,7 +233,11 @@ function dol_print_object_info($object)
|
||||
|
||||
// Date
|
||||
if (isset($object->date_cloture))
|
||||
print $langs->trans("DateClosing")." : " . dol_print_date($object->date_cloture,"dayhourtext") . '<br>';
|
||||
{
|
||||
print $langs->trans("DateClosing")." : " . dol_print_date($object->date_cloture,"dayhour");
|
||||
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_cloture+($deltadateforuser*3600),"dayhour").' '.$langs->trans("ClientHour");
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
// User conciliate
|
||||
if (isset($object->user_rappro))
|
||||
@ -207,11 +258,19 @@ function dol_print_object_info($object)
|
||||
|
||||
// Date
|
||||
if (isset($object->date_rappro))
|
||||
print $langs->trans("DateConciliating")." : " . dol_print_date($object->date_rappro,"dayhourtext") . '<br>';
|
||||
{
|
||||
print $langs->trans("DateConciliating")." : " . dol_print_date($object->date_rappro,"dayhour");
|
||||
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_rappro+($deltadateforuser*3600),"dayhour").' '.$langs->trans("ClientHour");
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
//Date send
|
||||
if (isset($object->date_envoi))
|
||||
print $langs->trans("DateLastSend")." : " . dol_print_date($object->date_envoi,"dayhourtext") . '<br>';
|
||||
{
|
||||
print $langs->trans("DateLastSend")." : " . dol_print_date($object->date_envoi,"dayhour");
|
||||
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_envoi+($deltadateforuser*3600),"dayhour").' '.$langs->trans("ClientHour");
|
||||
print '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@ -268,11 +268,6 @@ ALTER TABLE llx_actioncomm DROP COLUMN fk_supplier_order;
|
||||
ALTER TABLE llx_actioncomm DROP COLUMN fk_supplier_invoice;
|
||||
ALTER TABLE llx_actioncomm DROP COLUMN fk_commande;
|
||||
ALTER TABLE llx_product_stock DROP COLUMN location;
|
||||
-- DROP TABLE llx_c_methode_commande_fournisseur;
|
||||
-- DROP TABLE llx_c_source;
|
||||
-- DROP TABLE llx_cond_reglement;
|
||||
-- DROP TABLE llx_expedition_methode;
|
||||
-- DROP TABLE llx_product_fournisseur;
|
||||
|
||||
ALTER TABLE llx_adherent_extrafields ADD COLUMN import_key varchar(14);
|
||||
ALTER TABLE llx_product_extrafields ADD COLUMN import_key varchar(14);
|
||||
|
||||
@ -48,3 +48,12 @@ DELETE FROM llx_boxes where box_id NOT IN (SELECT rowid FROM llx_boxes_def);
|
||||
-- VPGSQL8.2 DELETE FROM llx_boxes_def as T1 WHERE rowid NOT IN (SELECT min(rowid) FROM llx_boxes_def GROUP BY file, entity, note)
|
||||
|
||||
|
||||
-- Requests to clean old tables or fields
|
||||
|
||||
-- DROP TABLE llx_c_methode_commande_fournisseur;
|
||||
-- DROP TABLE llx_c_source;
|
||||
-- DROP TABLE llx_cond_reglement;
|
||||
-- DROP TABLE llx_expedition_methode;
|
||||
-- DROP TABLE llx_product_fournisseur;
|
||||
-- ALTER TABLE llx_product_fournisseur_price DROP COLUMN fk_product_fournisseur;
|
||||
|
||||
|
||||
@ -49,8 +49,11 @@ CREATE OR REPLACE FUNCTION DAY(DATE) RETURNS INTEGER AS $$ SELECT EXTRACT(DAY FR
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION update_modified_column() RETURNS TRIGGER AS $$ BEGIN NEW.tms = now(); RETURN NEW; END; $$ LANGUAGE 'PLPGSQL';
|
||||
|
||||
CREATE OR REPLACE FUNCTION rebuilt_sequences() RETURNS integer as $body$ DECLARE sequencedefs RECORD; c integer ; BEGIN FOR sequencedefs IN SELECT DISTINCT constraint_column_usage.table_name as tablename, constraint_column_usage.table_name as tablename, constraint_column_usage.column_name as columnname, replace(replace(columns.column_default,'''::regclass)',''),'nextval(''','') as sequencename from information_schema.constraint_column_usage, information_schema.columns where constraint_column_usage.table_schema ='public' AND columns.table_schema = 'public' AND columns.table_name=constraint_column_usage.table_name AND constraint_column_usage.column_name IN ('rowid','id') AND constraint_column_usage.column_name = columns.column_name AND columns.column_default is not null LOOP EXECUTE 'select max('||sequencedefs.columnname||') from ' || sequencedefs.tablename INTO c; IF c is null THEN c = 0; END IF; IF c is not null THEN c = c+ 1; END IF; EXECUTE 'alter sequence ' || sequencedefs.sequencename ||' restart with ' || c; END LOOP; RETURN 1; END; $body$ LANGUAGE 'PLPGSQL';
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION dol_util_rebuild_sequences() RETURNS integer as $body$ DECLARE sequencedefs RECORD; c integer ; BEGIN FOR sequencedefs IN SELECT DISTINCT constraint_column_usage.table_name as tablename, constraint_column_usage.table_name as tablename, constraint_column_usage.column_name as columnname, replace(replace(columns.column_default,'''::regclass)',''),'nextval(''','') as sequencename from information_schema.constraint_column_usage, information_schema.columns where constraint_column_usage.table_schema ='public' AND columns.table_schema = 'public' AND columns.table_name=constraint_column_usage.table_name AND constraint_column_usage.column_name IN ('rowid','id') AND constraint_column_usage.column_name = columns.column_name AND columns.column_default is not null LOOP EXECUTE 'select max('||sequencedefs.columnname||') from ' || sequencedefs.tablename INTO c; IF c is null THEN c = 0; END IF; IF c is not null THEN c = c+ 1; END IF; EXECUTE 'alter sequence ' || sequencedefs.sequencename ||' restart with ' || c; END LOOP; RETURN 1; END; $body$ LANGUAGE 'PLPGSQL';
|
||||
|
||||
CREATE OR REPLACE FUNCTION dol_util_triggerall(DoEnable boolean) RETURNS integer AS $BODY$ DECLARE mytables RECORD; BEGIN FOR mytables IN SELECT relname FROM pg_class WHERE relhastriggers IS TRUE AND relkind = 'r' AND NOT relname LIKE 'pg_%' LOOP IF DoEnable THEN EXECUTE 'ALTER TABLE ' || mytables.relname || ' ENABLE TRIGGER ALL'; ELSE EXECUTE 'ALTER TABLE ' || mytables.relname || ' DISABLE TRIGGER ALL'; END IF; END LOOP; RETURN 1; END; $BODY$ LANGUAGE 'PLPGSQL';
|
||||
|
||||
|
||||
-- Add triggers
|
||||
|
||||
@ -107,7 +107,7 @@ OSTZ=Time Zone OS server
|
||||
PHPTZ=Time Zone PHP server
|
||||
PHPServerOffsetWithGreenwich=PHP server offset width Greenwich (seconds)
|
||||
ClientOffsetWithGreenwich=Client/Browser offset width Greenwich (seconds)
|
||||
DaylingSavingTime=Daylight saving time (user)
|
||||
DaylingSavingTime=Daylight saving time
|
||||
CurrentHour=Hour PHP (server)
|
||||
CompanyTZ= Time Zone company (main company)
|
||||
CompanyHour= Hour company (main company)
|
||||
|
||||
@ -104,7 +104,7 @@ BarCode=Barcode
|
||||
BarcodeType=Barcode type
|
||||
SetDefaultBarcodeType=Set barcode type
|
||||
BarcodeValue=Barcode value
|
||||
GenbarcodeLocation=Bar code generation command line tool (used by phpbarcode engine for some bar code types)
|
||||
GenbarcodeLocation=Bar code generation command line tool (used by internal engine for some bar code types)
|
||||
NoteNotVisibleOnBill=Note (not visible on invoices, proposals...)
|
||||
CreateCopy=Create copy
|
||||
ServiceLimitedDuration=If product is a service with limited duration:
|
||||
|
||||
@ -108,7 +108,7 @@ OSTZ= Time Zone OS
|
||||
PHPTZ= Time Zone config PHP
|
||||
PHPServerOffsetWithGreenwich= Offset serveur PHP avec Greenwich (secondes)
|
||||
ClientOffsetWithGreenwich= Offset client/navigateur avec Greenwich (secondes)
|
||||
DaylingSavingTime=Heure d'été (utilisateur)
|
||||
DaylingSavingTime=Heure d'été
|
||||
CurrentHour= Heure PHP (serveur)
|
||||
CompanyTZ= Time Zone société (maison mère)
|
||||
CompanyHour= Heure société (maison mère)
|
||||
|
||||
@ -267,6 +267,6 @@ if (! defined('NOREQUIRETRAN'))
|
||||
if (! defined('MAIN_LABEL_MENTION_NPR') ) define('MAIN_LABEL_MENTION_NPR','NPR');
|
||||
|
||||
// We force feature to help debug
|
||||
$conf->global->MAIN_JS_ON_PAYMENT=1;
|
||||
//$conf->global->MAIN_JS_ON_PAYMENT=0; // We disable this. See bug #402 on doliforge
|
||||
|
||||
?>
|
||||
|
||||
@ -77,14 +77,14 @@ $demoprofiles[]=array('default'=>'0', 'key'=>'profdemomed', 'lang'=>'cabinetmed@
|
||||
|
||||
$alwayscheckedmodules=array('barcode','bookmark','externalrss','fckeditor','geoipmaxmind','gravatar','memcached','syslog','user','webservices'); // Technical module we always want
|
||||
$alwaysuncheckedmodules=array('paybox','paypal','google','scanner','workflow'); // Module we never want
|
||||
$alwayshiddencheckedmodules=array('accounting','barcode','bookmark','clicktodial','comptabilite','document','domain','externalrss','externalsite','fckeditor','geoipmaxmind','gravatar','label','ldap','mailmanspip','notification',
|
||||
'syslog','user','webservices',
|
||||
$alwayshiddencheckedmodules=array('accounting','barcode','bookmark','clicktodial','comptabilite','document','domain','externalrss','externalsite','fckeditor','geoipmaxmind','gravatar','label','ldap',
|
||||
'mailmanspip','notification','syslog','user','webservices',
|
||||
// Extended modules
|
||||
'memcached','numberwords','zipautofillfr');
|
||||
$alwayshiddenuncheckedmodules=array('boutique','ftp',
|
||||
// Extended modules
|
||||
'awstats','bittorrent','cabinetmed','concatpdf','filemanager','mantis','monitoring','nltechno','ovh','phenix','phpsysinfo','postnuke','skincoloreditor','submiteverywhere',
|
||||
'survey','thomsonphonebook','voyage','webcalendar','webmail');
|
||||
'awstats','bittorrent','cabinetmed','cmcic','concatpdf','dolicloud','filemanager','mantis','monitoring','moretemplates','nltechno','numberingpack','openstreetmap',
|
||||
'ovh','phenix','phpsysinfo','pibarcode','postnuke','skincoloreditor','submiteverywhere','survey','thomsonphonebook','topten','tvacerfa','voyage','webcalendar','webmail');
|
||||
|
||||
// Search modules
|
||||
$dirlist=$conf->file->dol_document_root;
|
||||
|
||||
@ -1261,7 +1261,7 @@ padding: 0px;
|
||||
}
|
||||
|
||||
.boxhandle {
|
||||
margin: 1px 4px 0px 0px;
|
||||
margin: 1px 1px 0px 0px;
|
||||
}
|
||||
|
||||
.notopnoleft {
|
||||
|
||||
@ -357,7 +357,7 @@ ul.tmenu { /* t r b l */
|
||||
margin: 0px 0px 0px 6px;
|
||||
list-style: none;
|
||||
}
|
||||
li.tmenu {
|
||||
li.tmenu, li.tmenusel {
|
||||
text-align: center;
|
||||
vertical-align: top;
|
||||
float: <?php print $left; ?>;
|
||||
|
||||
@ -181,8 +181,8 @@ if (in_array('date',$filter))
|
||||
if (empty($sqlwhere)) $sqlwhere=' WHERE ';
|
||||
else $sqlwhere.=" AND";
|
||||
$sqlwhere.= " f.fk_statut > 0";
|
||||
$sqlwhere.= " AND f.datef >= ".$db->idate($dateafterdate);
|
||||
$sqlwhere.= " AND f.datef <= ".$db->idate($datebeforedate);
|
||||
$sqlwhere.= " AND f.datef >= '".$db->idate($dateafterdate)."'";
|
||||
$sqlwhere.= " AND f.datef <= '".$db->idate($datebeforedate)."'";
|
||||
$sqlorder = " ORDER BY f.datef ASC";
|
||||
}
|
||||
if (in_array('nopayment',$filter))
|
||||
@ -202,8 +202,8 @@ if (in_array('payments',$filter))
|
||||
$sqlwhere.= " f.fk_statut > 0";
|
||||
$sqlwhere.= " AND f.rowid = pf.fk_facture";
|
||||
$sqlwhere.= " AND pf.fk_paiement = p.rowid";
|
||||
$sqlwhere.= " AND p.datep >= ".$db->idate($paymentdateafter);
|
||||
$sqlwhere.= " AND p.datep <= ".$db->idate($paymentdatebefore);
|
||||
$sqlwhere.= " AND p.datep >= '".$db->idate($paymentdateafter)."'";
|
||||
$sqlwhere.= " AND p.datep <= '".$db->idate($paymentdatebefore)."'";
|
||||
$sqlorder = " ORDER BY p.datep ASC";
|
||||
}
|
||||
if (in_array('nodeposit',$filter))
|
||||
|
||||
@ -181,6 +181,8 @@ class ContactTest extends PHPUnit_Framework_TestCase
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$localobject->oldcopy=dol_clone($localobject);
|
||||
|
||||
$localobject->note='New note after update';
|
||||
//$localobject->note_public='New note public after update';
|
||||
$localobject->lastname='New name';
|
||||
@ -304,7 +306,7 @@ class ContactTest extends PHPUnit_Framework_TestCase
|
||||
$localobject=new Contact($this->savdb);
|
||||
$result=$localobject->fetch($id);
|
||||
|
||||
$result=$localobject->delete($id);
|
||||
$result=$localobject->delete(0);
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
|
||||
|
||||
@ -322,9 +322,9 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(7261,$result);
|
||||
|
||||
$result=dol_mktime(2,0,0,1,1,1970,0); // 1970-01-01 02:00:00 in local area Europe/Paris -> 3600 GMT
|
||||
$result=dol_mktime(2,0,0,1,1,1970,0); // 1970-01-01 02:00:00 = 7200 in local area Europe/Paris = 3600 GMT
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$tz=getServerTimeZoneInt('1970-01-01 02:00:00'); // +1 in Europe/Paris at this time (this time is winter)
|
||||
$tz=getServerTimeZoneInt('winter'); // +1 in Europe/Paris at this time (this time is winter)
|
||||
$this->assertEquals(7200-($tz*3600),$result); // Should be 7200 if we are at greenwich winter
|
||||
}
|
||||
|
||||
@ -337,8 +337,8 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
$now=dol_now('gmt');
|
||||
$nowtzserver=dol_now('tzserver');
|
||||
print __METHOD__."getServerTimeZoneInt=".(getServerTimeZoneInt()*3600)."\n";
|
||||
$this->assertEquals(getServerTimeZoneInt()*3600,($nowtzserver-$now));
|
||||
print __METHOD__."getServerTimeZoneInt=".(getServerTimeZoneInt('now')*3600)."\n";
|
||||
$this->assertEquals(getServerTimeZoneInt('now')*3600,($nowtzserver-$now));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -395,4 +395,4 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($arraytotest,$decoded);
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user