diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index c56bdf347e7..aa835cdd96e 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2007 Rodolphe Quiedeville * @@ -178,14 +178,14 @@ $var=true; $var=!$var; print ' '.$langs->trans("SyslogSimpleFile").''; -print ''.$langs->trans("SyslogFilename").': '; +print ''.$langs->trans("SyslogFilename").': '; print ''; print "".$form->textwithpicto('',$langs->trans("YouCanUseDOL_DATA_ROOT")); print ''; $var=!$var; print ' '.$langs->trans("SyslogSyslog").''; -print ''.$langs->trans("SyslogFacility").': '; +print ''.$langs->trans("SyslogFacility").': '; print ''; print "".$form->textwithpicto('','Only LOG_USER supported on Windows'); print ''; @@ -202,7 +202,7 @@ try if (! class_exists('FirePHP')) print ' disabled="disabled"'; else print ($syslog_firephp_on?' checked="checked"':""); print '> '.$langs->trans("FirePHP").''; - print ''; + print ''; print ''; print "".$form->textwithpicto('','FirePHP must be installed onto PHP and FirePHP plugin for Firefox must also be installed'); print ''; @@ -232,7 +232,7 @@ print '\n"; $var=true; $var=!$var; -print ''.$langs->trans("SyslogLevel").''; +print ''.$langs->trans("SyslogLevel").''; print ''; print ''; - print ''; + if ($backtopage) print ''; 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 ''; print ''; print ''; - print ''; + if ($backtopage) print ''; print ''; @@ -741,7 +741,7 @@ if ($id) // Contact print ''; // Project diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 27dca55e1e4..64dc2ec393e 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -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) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index a1c9418ef8a..e9b7067853b 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -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; } } diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index c3f307f6b34..0f8f82b6507 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke @@ -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); diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php index 15b359c8ff5..e8ed38b57cb 100644 --- a/htdocs/contact/ldap.php +++ b/htdocs/contact/ldap.php @@ -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 '
'.$langs->trans("Contact").''; - 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 '
'; print ''; -if ($message) { print $message; } +dol_htmloutput_mesg($message); /* diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index dbb26219f2f..9ca0b596792 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -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; } } diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index cf087ec072c..786464ef2cf 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -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)) { diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index f535ab2ae29..cdf8cc1b9b8 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -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; } -?> \ No newline at end of file +?> diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a745e8e10a3..897fc62383b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -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 diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 459adc66517..d028322987a 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -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") . '
'; + { + 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 '
'; + } // 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") . '
'; + { + 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 '
'; + } // 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") . '
'; + { + 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 '
'; + } + + // 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 '
'; + } + + // 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 '
'; + } // 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") . '
'; + { + 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 '
'; + } // 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") . '
'; + { + 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 '
'; + } //Date send if (isset($object->date_envoi)) - print $langs->trans("DateLastSend")." : " . dol_print_date($object->date_envoi,"dayhourtext") . '
'; + { + 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 '
'; + } } /** diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php index ccc7d65af6d..3d6c7b01333 100755 --- a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2012 Laurent Destailleur * * 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 diff --git a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql index 321e7ff1348..155c87fc722 100755 --- a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql +++ b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql @@ -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); diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index d4ed30f7ce9..815343e162e 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -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; + diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index b5609136087..ede2a5145d0 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -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 diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 38b3fe7728e..46bdacba818 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -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) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 0dfb6cb9eac..527526d9268 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -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: diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 6561c3b9749..860ed1816c1 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -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) diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index f6582df07fd..591a4aabccf 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -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 ?> diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 6d0e732fede..f53e2551ba2 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -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; diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index 365367f33b1..df90863d786 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -1261,7 +1261,7 @@ padding: 0px; } .boxhandle { - margin: 1px 4px 0px 0px; + margin: 1px 1px 0px 0px; } .notopnoleft { diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php index 4e09c1c61c0..63ee093b245 100644 --- a/htdocs/theme/cameleo/style.css.php +++ b/htdocs/theme/cameleo/style.css.php @@ -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: ; diff --git a/scripts/invoices/rebuild_merge_pdf.php b/scripts/invoices/rebuild_merge_pdf.php index 842bf467e2f..45f112e071b 100644 --- a/scripts/invoices/rebuild_merge_pdf.php +++ b/scripts/invoices/rebuild_merge_pdf.php @@ -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)) diff --git a/test/phpunit/ContactTest.php b/test/phpunit/ContactTest.php index cd2c0c1f18e..00c5c99985a 100755 --- a/test/phpunit/ContactTest.php +++ b/test/phpunit/ContactTest.php @@ -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); diff --git a/test/phpunit/FunctionsTest.php b/test/phpunit/FunctionsTest.php index 2a81b2e6d4e..2952389ba76 100755 --- a/test/phpunit/FunctionsTest.php +++ b/test/phpunit/FunctionsTest.php @@ -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); } } -?> \ No newline at end of file +?>