From 9038549d0d41e5abb2ec8f79961a209bffc73da0 Mon Sep 17 00:00:00 2001 From: fhenry Date: Fri, 3 May 2013 11:50:13 +0200 Subject: [PATCH 01/52] fix margin calculation problem --- htdocs/install/mysql/tables/llx_facturedet.sql | 2 +- htdocs/margin/agentMargins.php | 11 ++++++----- htdocs/margin/customerMargins.php | 4 ++-- htdocs/margin/productMargins.php | 4 ++-- htdocs/margin/tabs/productMargins.php | 4 ++-- htdocs/margin/tabs/thirdpartyMargins.php | 3 ++- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_facturedet.sql b/htdocs/install/mysql/tables/llx_facturedet.sql index 949dee1933c..77204c29873 100644 --- a/htdocs/install/mysql/tables/llx_facturedet.sql +++ b/htdocs/install/mysql/tables/llx_facturedet.sql @@ -38,7 +38,7 @@ create table llx_facturedet remise real DEFAULT 0, -- Montant calcule de la remise % sur PU HT (exemple 20) fk_remise_except integer NULL, -- Lien vers table des remises fixes subprice double(24,8), -- P.U. HT (exemple 100) - price double(24,8), -- P.U. HT apres remise % de ligne + price double(24,8), -- Deprecated (Do not use) total_ht double(24,8), -- Total HT de la ligne toute quantite et incluant remise ligne et globale total_tva double(24,8), -- Total TVA de la ligne toute quantite et incluant remise ligne et globale total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1 for total quantity of line diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 6ca0879a88a..0e953422ef2 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -45,7 +45,7 @@ if (! $sortfield) if ($agentid > 0) $sortfield="s.nom"; else - $sortfield="u.name"; + $sortfield="u.lastname"; } $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } @@ -125,10 +125,10 @@ print ""; print ''; $sql = "SELECT s.nom, s.rowid as socid, s.code_client, s.client, u.rowid as agent,"; -$sql.= " u.login, u.name, u.firstname,"; +$sql.= " u.login, u.lastname, u.firstname,"; $sql.= " sum(d.total_ht) as selling_price,"; $sql.= $db->ifsql('f.type =2','sum(d.buy_price_ht * d.qty *-1)','sum(d.buy_price_ht * d.qty)')." as buying_price, "; -$sql.= $db->ifsql('f.type =2','sum((d.price + d.buy_price_ht) * d.qty)','sum((d.price - d.buy_price_ht) * d.qty)')." as marge" ; +$sql.= $db->ifsql('f.type =2','sum(((d.total_ht/d.qty) + d.buy_price_ht) * d.qty)','sum(((d.total_ht/d.qty) - d.buy_price_ht) * d.qty)')." as marge" ; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact e ON e.element_id = f.rowid and e.statut = 4 and e.fk_c_type_contact = ".(empty($conf->global->AGENT_CONTACT_TYPE)?-1:$conf->global->AGENT_CONTACT_TYPE); @@ -160,11 +160,12 @@ if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPr if ($agentid > 0) $sql.= " GROUP BY s.rowid"; else - $sql.= " GROUP BY u.rowid"; + $sql.= " GROUP BY u.rowid, s.nom, s.rowid, s.code_client, s.client, u.login, u.lastname, u.firstname, f.type "; $sql.= " ORDER BY $sortfield $sortorder "; // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); +dol_syslog('margin::agentMargins.php sql='.$sql,LOG_DEBUG); $result = $db->query($sql); if ($result) { @@ -180,7 +181,7 @@ if ($result) if ($agentid > 0) print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&agentid=".$agentid,'align="center"',$sortfield,$sortorder); else - print_liste_field_titre($langs->trans("CommercialAgent"),$_SERVER["PHP_SELF"],"u.name","","&agentid=".$agentid,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("CommercialAgent"),$_SERVER["PHP_SELF"],"u.lastname","","&agentid=".$agentid,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buying_price","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index a07d3192e9b..5fb491ea5c3 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -157,7 +157,7 @@ $sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client, s.client,"; $sql.= " f.facnumber, f.total as total_ht,"; $sql.= " sum(d.total_ht) as selling_price,"; $sql.= $db->ifsql('f.type =2','sum(d.buy_price_ht * d.qty *-1)','sum(d.buy_price_ht * d.qty)')." as buying_price, "; -$sql.= $db->ifsql('f.type =2','sum((d.price + d.buy_price_ht) * d.qty)','sum((d.price - d.buy_price_ht) * d.qty)')." as marge," ; +$sql.= $db->ifsql('f.type =2','sum(((d.total_ht/d.qty) + d.buy_price_ht) * d.qty)','sum(((d.total_ht/d.qty) - d.buy_price_ht) * d.qty)')." as marge," ; $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; @@ -178,7 +178,7 @@ if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPr if ($client) $sql.= " GROUP BY f.rowid"; else - $sql.= " GROUP BY s.rowid"; + $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, f.facnumber, f.total, f.datef, f.paye, f.fk_statut, f.rowid "; $sql.= " ORDER BY $sortfield $sortorder "; // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index e5896d1f1b3..d2e3198b5ee 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -159,7 +159,7 @@ $sql = "SELECT DISTINCT d.fk_product, p.label, p.rowid, p.fk_product_type, p.ref $sql.= " f.facnumber, f.total as total_ht,"; $sql.= " sum(d.total_ht) as selling_price,"; $sql.= $db->ifsql('f.type =2','sum(d.buy_price_ht * d.qty *-1)','sum(d.buy_price_ht * d.qty)')." as buying_price, "; -$sql.= $db->ifsql('f.type =2','sum((d.price + d.buy_price_ht) * d.qty)','sum((d.price - d.buy_price_ht) * d.qty)')." as marge," ; +$sql.= $db->ifsql('f.type =2','sum(((d.total_ht/d.qty) + d.buy_price_ht) * d.qty)','sum(((d.total_ht/d.qty) - d.buy_price_ht) * d.qty)')." as marge," ; $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."product as p"; @@ -186,7 +186,7 @@ else $sql.= " ORDER BY $sortfield $sortorder "; // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); -dol_syslog('margin::productMargin.php sql='.$sql,LOG_DEBUG); +dol_syslog('margin::productMargins.php sql='.$sql,LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index 326efc526d2..8eee225b42d 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -133,7 +133,7 @@ if ($id > 0 || ! empty($ref)) $sql.= " d.total_ht as selling_price,"; $sql.= $db->ifsql('f.type =2','(d.buy_price_ht * d.qty *-1)','(d.buy_price_ht * d.qty)')." as buying_price, "; $sql.= $db->ifsql('f.type =2','d.qty *-1','d.qty')." as qty,"; - $sql.= $db->ifsql('f.type =2','((d.price + d.buy_price_ht) * d.qty)','((d.price - d.buy_price_ht) * d.qty)')." as marge," ; + $sql.= $db->ifsql('f.type =2','(((d.total_ht/d.qty) + d.buy_price_ht) * d.qty)','(((d.total_ht/d.qty) - d.buy_price_ht) * d.qty)')." as marge," ; $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; @@ -153,7 +153,7 @@ if ($id > 0 || ! empty($ref)) $sql.= " ORDER BY $sortfield $sortorder "; // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); - + dol_syslog('margin:tabs:productMargins.php sql='.$sql,LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index b91955d28c0..fc319b17054 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -131,7 +131,7 @@ if ($socid > 0) $sql.= " sum(d.total_ht) as selling_price,"; $sql.= $db->ifsql('f.type =2','sum(d.buy_price_ht * d.qty *-1)','sum(d.buy_price_ht * d.qty)')." as buying_price, "; - $sql.= $db->ifsql('f.type =2','sum((d.price + d.buy_price_ht) * d.qty)','sum((d.price - d.buy_price_ht) * d.qty)')." as marge," ; + $sql.= $db->ifsql('f.type =2','sum(((d.total_ht/d.qty) + d.buy_price_ht) * d.qty)','sum(((d.total_ht/d.qty) - d.buy_price_ht) * d.qty)')." as marge," ; $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; @@ -149,6 +149,7 @@ if ($socid > 0) // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); + dol_syslog('margin:tabs:thirdpartyMargins.php sql='.$sql,LOG_DEBUG); $result = $db->query($sql); if ($result) { From 880daa4375f9a6d863037c71840b906d063b6caa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 May 2013 11:51:26 +0200 Subject: [PATCH 02/52] Fix: log file permission during install --- htdocs/core/modules/syslog/mod_syslog_file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index e6bbefb7295..e98bb96b8eb 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -147,7 +147,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface fwrite($filefd, $message."\n"); fclose($filefd); - @chmod($logfile, octdec($conf->global->MAIN_UMASK)); + @chmod($logfile, octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK)); } } } From c850d413f4bf87e63e9fb9a5b8dccbb026c0e7bb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 May 2013 12:00:55 +0200 Subject: [PATCH 03/52] Fix: [ bug #871 ] Erreur MAJ 3.2 -> 3.3 avec pgsql --- htdocs/install/upgrade2.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 3448e3a196c..e17b5a4d556 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -329,12 +329,17 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) { migrate_categorie_association($db,$langs,$conf); + } - // Reload modules - migrate_reload_modules($db,$langs,$conf); - - // Reload menus - migrate_reload_menu($db,$langs,$conf,$versionto); + $afterversionarray=explode('.','3.3.9'); + $beforeversionarray=explode('.','3.4.9'); + if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) + { + // Reload modules (this must be always and only into last targeted version) + migrate_reload_modules($db,$langs,$conf); + + // Reload menus (this must be always and only into last targeted version) + migrate_reload_menu($db,$langs,$conf,$versionto); } print '
'.$langs->trans("MigrationFinished").''; From b7f3f07fc78b306b11e1aedca7e5b2180021be24 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 May 2013 12:13:10 +0200 Subject: [PATCH 04/52] Fix: [ bug #840 ] fichetwothirdright 65% to 55% --- htdocs/core/lib/project.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 76323b4eb40..3a8bd016e21 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -721,7 +721,7 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0) print ''; print ''; print_liste_field_titre($langs->trans("Project"),"index.php","","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("NbOpenTasks"),"","","","",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Tasks"),"","","","",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),"","","","",'align="right"',$sortfield,$sortorder); print "\n"; @@ -775,7 +775,7 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0) print ''; + print ' - '.dol_trunc($objp->title,24).''; print ''; $projectstatic->statut = $objp->fk_statut; print ''; From ff80e3b031c5afdf8213c19a55bd55e932256642 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 May 2013 12:28:28 +0200 Subject: [PATCH 05/52] Fix: latin to utf8 --- dev/initdata/mysqldump_dolibarr_3.3.0.sql | 30 +++++----- dev/initdata/mysqldump_dolibarr_3.4.0.sql | 68 +++++++++++------------ 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/dev/initdata/mysqldump_dolibarr_3.3.0.sql b/dev/initdata/mysqldump_dolibarr_3.3.0.sql index 9cc783e1b80..83f224ddd99 100644 --- a/dev/initdata/mysqldump_dolibarr_3.3.0.sql +++ b/dev/initdata/mysqldump_dolibarr_3.3.0.sql @@ -34,7 +34,7 @@ CREATE TABLE `llx_accountingaccount` ( PRIMARY KEY (`rowid`), KEY `idx_accountingaccount_fk_pcg_version` (`fk_pcg_version`), CONSTRAINT `fk_accountingaccount_fk_pcg_version` FOREIGN KEY (`fk_pcg_version`) REFERENCES `llx_accountingsystem` (`pcg_version`) -) ENGINE=InnoDB AUTO_INCREMENT=439 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=439 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -86,7 +86,7 @@ CREATE TABLE `llx_accountingsystem` ( `active` smallint(6) DEFAULT '0', PRIMARY KEY (`rowid`), KEY `idx_accountingsystem_pcg_version` (`pcg_version`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -1075,7 +1075,7 @@ CREATE TABLE `llx_c_currencies` ( `unicode` varchar(32) DEFAULT NULL, `active` tinyint(4) NOT NULL DEFAULT '1', PRIMARY KEY (`code_iso`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2975,7 +2975,7 @@ CREATE TABLE `llx_element_tag` ( `element` varchar(64) NOT NULL, PRIMARY KEY (`rowid`), UNIQUE KEY `uk_element_tag` (`entity`,`lang`,`tag`,`fk_element`,`element`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3796,7 +3796,7 @@ CREATE TABLE `llx_holiday` ( KEY `idx_holiday_fk_user` (`fk_user`), KEY `idx_holiday_date_debut` (`date_debut`), KEY `idx_holiday_date_fin` (`date_fin`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3821,7 +3821,7 @@ CREATE TABLE `llx_holiday_config` ( `value` text, PRIMARY KEY (`rowid`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3848,7 +3848,7 @@ CREATE TABLE `llx_holiday_events` ( `value` text NOT NULL, PRIMARY KEY (`rowid`), UNIQUE KEY `uk_holiday_name` (`name`,`entity`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3876,7 +3876,7 @@ CREATE TABLE `llx_holiday_logs` ( `prev_solde` varchar(255) NOT NULL, `new_solde` varchar(255) NOT NULL, PRIMARY KEY (`rowid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3899,7 +3899,7 @@ CREATE TABLE `llx_holiday_users` ( `fk_user` int(11) NOT NULL, `nb_holiday` double NOT NULL DEFAULT '0', PRIMARY KEY (`fk_user`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4919,7 +4919,7 @@ CREATE TABLE `llx_product_price_by_qty` ( UNIQUE KEY `uk_product_price_by_qty_level` (`fk_product_price`,`qty_min`), KEY `idx_product_price_by_qty_fk_product_price` (`fk_product_price`), CONSTRAINT `fk_product_price_by_qty_fk_product_price` FOREIGN KEY (`fk_product_price`) REFERENCES `llx_product_price` (`rowid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5250,7 +5250,7 @@ CREATE TABLE `llx_publi_c_contact_list` ( `active` tinyint(4) NOT NULL DEFAULT '1', PRIMARY KEY (`rowid`), UNIQUE KEY `uk_contact_list_code` (`code`,`entity`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5279,7 +5279,7 @@ CREATE TABLE `llx_publi_c_dnd_list` ( `active` tinyint(4) NOT NULL DEFAULT '1', PRIMARY KEY (`rowid`), UNIQUE KEY `uk_dnd_list_code` (`code`,`entity`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5308,7 +5308,7 @@ CREATE TABLE `llx_publi_c_method_list` ( `active` tinyint(4) NOT NULL DEFAULT '1', PRIMARY KEY (`rowid`), UNIQUE KEY `uk_method_list_code` (`code`,`entity`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5760,7 +5760,7 @@ CREATE TABLE `llx_socpeople_extrafields` ( `import_key` varchar(14) DEFAULT NULL, PRIMARY KEY (`rowid`), KEY `idx_socpeople_extrafields` (`fk_object`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6060,7 +6060,7 @@ CREATE TABLE `llx_user_extrafields` ( `import_key` varchar(14) DEFAULT NULL, PRIMARY KEY (`rowid`), KEY `idx_user_extrafields` (`fk_object`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- diff --git a/dev/initdata/mysqldump_dolibarr_3.4.0.sql b/dev/initdata/mysqldump_dolibarr_3.4.0.sql index eaa2c8f1a89..1fa3bfe8791 100644 --- a/dev/initdata/mysqldump_dolibarr_3.4.0.sql +++ b/dev/initdata/mysqldump_dolibarr_3.4.0.sql @@ -30,7 +30,7 @@ CREATE TABLE `llx_accounting_system` ( `active` smallint(6) DEFAULT '0', PRIMARY KEY (`rowid`), UNIQUE KEY `uk_accounting_system_pcg_version` (`pcg_version`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -62,7 +62,7 @@ CREATE TABLE `llx_accountingaccount` ( PRIMARY KEY (`rowid`), KEY `idx_accountingaccount_fk_pcg_version` (`fk_pcg_version`), CONSTRAINT `fk_accountingaccount_fk_pcg_version` FOREIGN KEY (`fk_pcg_version`) REFERENCES `llx_accounting_system` (`pcg_version`) -) ENGINE=InnoDB AUTO_INCREMENT=439 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=439 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -198,7 +198,7 @@ CREATE TABLE `llx_actioncomm_extrafields` ( `import_key` varchar(14) DEFAULT NULL, PRIMARY KEY (`rowid`), KEY `idx_actioncomm_extrafields` (`fk_object`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -402,7 +402,7 @@ CREATE TABLE `llx_adherent_type_extrafields` ( `import_key` varchar(14) DEFAULT NULL, PRIMARY KEY (`rowid`), KEY `idx_adherent_type_extrafields` (`fk_object`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -826,7 +826,7 @@ CREATE TABLE `llx_c_action_trigger` ( PRIMARY KEY (`rowid`), UNIQUE KEY `uk_action_trigger_code` (`code`), KEY `idx_action_trigger_rang` (`rang`) -) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -996,7 +996,7 @@ CREATE TABLE `llx_c_currencies` ( `unicode` varchar(32) DEFAULT NULL, `active` tinyint(4) NOT NULL DEFAULT '1', PRIMARY KEY (`code_iso`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -1470,7 +1470,7 @@ CREATE TABLE `llx_c_revenuestamp` ( `accountancy_code_sell` varchar(15) DEFAULT NULL, `accountancy_code_buy` varchar(15) DEFAULT NULL, PRIMARY KEY (`rowid`) -) ENGINE=InnoDB AUTO_INCREMENT=105 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=105 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2583,7 +2583,7 @@ CREATE TABLE `llx_cronjob` ( `fk_user_mod` int(11) DEFAULT NULL, `note` text, PRIMARY KEY (`rowid`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2704,7 +2704,7 @@ CREATE TABLE `llx_dolicloud_emailstemplates` ( `content` text NOT NULL, PRIMARY KEY (`rowid`), UNIQUE KEY `uk_dolicloud_emailstemplates` (`emailtype`,`lang`) -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3006,7 +3006,7 @@ CREATE TABLE `llx_element_tag` ( `element` varchar(64) NOT NULL, PRIMARY KEY (`rowid`), UNIQUE KEY `uk_element_tag` (`entity`,`lang`,`tag`,`fk_element`,`element`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3418,7 +3418,7 @@ CREATE TABLE `llx_facture_extrafields` ( `import_key` varchar(14) DEFAULT NULL, PRIMARY KEY (`rowid`), KEY `idx_facture_extrafields` (`fk_object`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3864,7 +3864,7 @@ CREATE TABLE `llx_holiday` ( KEY `idx_holiday_fk_user` (`fk_user`), KEY `idx_holiday_date_debut` (`date_debut`), KEY `idx_holiday_date_fin` (`date_fin`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3890,7 +3890,7 @@ CREATE TABLE `llx_holiday_config` ( `value` text, PRIMARY KEY (`rowid`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3917,7 +3917,7 @@ CREATE TABLE `llx_holiday_events` ( `value` text NOT NULL, PRIMARY KEY (`rowid`), UNIQUE KEY `uk_holiday_name` (`name`,`entity`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3945,7 +3945,7 @@ CREATE TABLE `llx_holiday_logs` ( `prev_solde` varchar(255) NOT NULL, `new_solde` varchar(255) NOT NULL, PRIMARY KEY (`rowid`) -) ENGINE=InnoDB AUTO_INCREMENT=145 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=145 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3969,7 +3969,7 @@ CREATE TABLE `llx_holiday_users` ( `fk_user` int(11) NOT NULL, `nb_holiday` double NOT NULL DEFAULT '0', PRIMARY KEY (`fk_user`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4269,7 +4269,7 @@ CREATE TABLE `llx_milestone` ( UNIQUE KEY `uk_milestone_fk_element` (`fk_element`,`elementtype`), KEY `idx_milestone_fk_user_modif` (`fk_user_modif`), CONSTRAINT `fk_milestone_fk_user_modif` FOREIGN KEY (`fk_user_modif`) REFERENCES `llx_user` (`rowid`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4391,7 +4391,7 @@ CREATE TABLE `llx_opensurvey_comments` ( `comment` text NOT NULL, `usercomment` text, PRIMARY KEY (`id_comment`) -) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4425,7 +4425,7 @@ CREATE TABLE `llx_opensurvey_sondage` ( `origin` varchar(64) DEFAULT NULL, `tms` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id_sondage`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4448,7 +4448,7 @@ DROP TABLE IF EXISTS `llx_opensurvey_sujet_studs`; CREATE TABLE `llx_opensurvey_sujet_studs` ( `id_sondage` char(16) NOT NULL, `sujet` text -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4477,7 +4477,7 @@ CREATE TABLE `llx_opensurvey_user_studs` ( KEY `idx_id_users` (`id_users`), KEY `idx_nom` (`nom`), KEY `idx_id_sondage` (`id_sondage`) -) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4679,7 +4679,7 @@ CREATE TABLE `llx_pos_cash` ( `datea` datetime DEFAULT NULL, `is_closed` tinyint(4) DEFAULT '0', PRIMARY KEY (`rowid`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4714,7 +4714,7 @@ CREATE TABLE `llx_pos_control_cash` ( `amount_next_day` double(24,8) DEFAULT NULL, `comment` text, PRIMARY KEY (`rowid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4739,7 +4739,7 @@ CREATE TABLE `llx_pos_facture` ( `fk_facture` int(11) NOT NULL, `fk_control_cash` int(11) DEFAULT NULL, PRIMARY KEY (`rowid`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4769,7 +4769,7 @@ CREATE TABLE `llx_pos_moviments` ( `type` tinyint(4) DEFAULT NULL, `comment` text, PRIMARY KEY (`rowid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4794,7 +4794,7 @@ CREATE TABLE `llx_pos_paiement_ticket` ( `fk_ticket` int(11) DEFAULT NULL, `amount` double(24,8) DEFAULT '0.00000000', PRIMARY KEY (`rowid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4852,7 +4852,7 @@ CREATE TABLE `llx_pos_ticket` ( KEY `idx_ticket_fk_ticket_source` (`fk_ticket_source`), CONSTRAINT `fk_ticket_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`), CONSTRAINT `fk_ticket_fk_user_author` FOREIGN KEY (`fk_user_author`) REFERENCES `llx_user` (`rowid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4903,7 +4903,7 @@ CREATE TABLE `llx_pos_ticketdet` ( UNIQUE KEY `uk_fk_remise_except` (`fk_remise_except`,`fk_ticket`), KEY `idx_ticketdet_fk_ticket` (`fk_ticket`), KEY `idx_ticketdet_fk_product` (`fk_product`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5365,7 +5365,7 @@ CREATE TABLE `llx_product_price_by_qty` ( UNIQUE KEY `uk_product_price_by_qty_level` (`fk_product_price`,`qty_min`), KEY `idx_product_price_by_qty_fk_product_price` (`fk_product_price`), CONSTRAINT `fk_product_price_by_qty_fk_product_price` FOREIGN KEY (`fk_product_price`) REFERENCES `llx_product_price` (`rowid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5639,7 +5639,7 @@ CREATE TABLE `llx_propal_extrafields` ( `import_key` varchar(14) DEFAULT NULL, PRIMARY KEY (`rowid`), KEY `idx_propal_extrafields` (`fk_object`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6146,7 +6146,7 @@ CREATE TABLE `llx_socpeople_extrafields` ( `import_key` varchar(14) DEFAULT NULL, PRIMARY KEY (`rowid`), KEY `idx_socpeople_extrafields` (`fk_object`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6226,7 +6226,7 @@ CREATE TABLE `llx_submitew_message` ( `joined_file3` varchar(255) DEFAULT NULL, `joined_file4` varchar(255) DEFAULT NULL, PRIMARY KEY (`rowid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6498,7 +6498,7 @@ CREATE TABLE `llx_user_extrafields` ( `import_key` varchar(14) DEFAULT NULL, PRIMARY KEY (`rowid`), KEY `idx_user_extrafields` (`fk_object`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6665,7 +6665,7 @@ CREATE TABLE `llx_ventilation_achat` ( `ventilation` varchar(255) DEFAULT NULL, `qty` double DEFAULT NULL, PRIMARY KEY (`rowid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- From a35a44b23e73487d42c5eb4ab7994b7c6a49704a Mon Sep 17 00:00:00 2001 From: fhenry Date: Fri, 3 May 2013 15:22:41 +0200 Subject: [PATCH 06/52] Fix margin calculation problem --- htdocs/margin/agentMargins.php | 5 +++-- htdocs/margin/customerMargins.php | 5 +++-- htdocs/margin/productMargins.php | 6 +++--- htdocs/margin/tabs/productMargins.php | 5 +++-- htdocs/margin/tabs/thirdpartyMargins.php | 5 +++-- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 6ca0879a88a..572f2a10003 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -128,7 +128,7 @@ $sql = "SELECT s.nom, s.rowid as socid, s.code_client, s.client, u.rowid as agen $sql.= " u.login, u.name, u.firstname,"; $sql.= " sum(d.total_ht) as selling_price,"; $sql.= $db->ifsql('f.type =2','sum(d.buy_price_ht * d.qty *-1)','sum(d.buy_price_ht * d.qty)')." as buying_price, "; -$sql.= $db->ifsql('f.type =2','sum((d.price + d.buy_price_ht) * d.qty)','sum((d.price - d.buy_price_ht) * d.qty)')." as marge" ; +$sql.= $db->ifsql('f.type =2','sum(d.total_ht + (d.buy_price_ht * d.qty))','sum(d.total_ht - (d.buy_price_ht * d.qty))')." as marge" ; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact e ON e.element_id = f.rowid and e.statut = 4 and e.fk_c_type_contact = ".(empty($conf->global->AGENT_CONTACT_TYPE)?-1:$conf->global->AGENT_CONTACT_TYPE); @@ -160,11 +160,12 @@ if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPr if ($agentid > 0) $sql.= " GROUP BY s.rowid"; else - $sql.= " GROUP BY u.rowid"; + $sql.= " GROUP BY u.rowid, s.nom, s.rowid, s.code_client, s.client, u.login, u.name, u.firstname, f.type "; $sql.= " ORDER BY $sortfield $sortorder "; // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); +dol_syslog('margin::agentMargins.php sql='.$sql,LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index a07d3192e9b..982384e882c 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -157,7 +157,7 @@ $sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client, s.client,"; $sql.= " f.facnumber, f.total as total_ht,"; $sql.= " sum(d.total_ht) as selling_price,"; $sql.= $db->ifsql('f.type =2','sum(d.buy_price_ht * d.qty *-1)','sum(d.buy_price_ht * d.qty)')." as buying_price, "; -$sql.= $db->ifsql('f.type =2','sum((d.price + d.buy_price_ht) * d.qty)','sum((d.price - d.buy_price_ht) * d.qty)')." as marge," ; +$sql.= $db->ifsql('f.type =2','sum(d.total_ht + (d.buy_price_ht * d.qty))','sum(d.total_ht - (d.buy_price_ht * d.qty))')." as marge," ; $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; @@ -178,11 +178,12 @@ if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPr if ($client) $sql.= " GROUP BY f.rowid"; else - $sql.= " GROUP BY s.rowid"; + $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, f.facnumber, f.total, f.datef, f.paye, f.fk_statut, f.rowid "; $sql.= " ORDER BY $sortfield $sortorder "; // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); +dol_syslog('margin::customerMargins.php sql='.$sql,LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index 3b709559f28..26aaa953d78 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -159,7 +159,7 @@ $sql = "SELECT DISTINCT d.fk_product, p.label, p.rowid, p.fk_product_type, p.ref $sql.= " f.facnumber, f.total as total_ht,"; $sql.= " sum(d.total_ht) as selling_price,"; $sql.= $db->ifsql('f.type =2','sum(d.buy_price_ht * d.qty *-1)','sum(d.buy_price_ht * d.qty)')." as buying_price, "; -$sql.= $db->ifsql('f.type =2','sum((d.price + d.buy_price_ht) * d.qty)','sum((d.price - d.buy_price_ht) * d.qty)')." as marge," ; +$sql.= $db->ifsql('f.type =2','sum(d.total_ht + (d.buy_price_ht * d.qty))','sum(d.total_ht - (d.buy_price_ht * d.qty))')." as marge," ; $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."product as p"; @@ -182,11 +182,11 @@ if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPr if ($id > 0) $sql.= " GROUP BY f.rowid"; else - $sql.= " GROUP BY d.fk_product"; + $sql.= " GROUP BY d.fk_product, p.label, p.rowid, p.fk_product_type, p.ref, f.facnumber, f.total, f.datef, f.paye, f.fk_statut, f.rowid"; $sql.= " ORDER BY $sortfield $sortorder "; // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); - +dol_syslog('margin::productMargins.php sql='.$sql,LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index 326efc526d2..a0051d7a6e4 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -133,7 +133,7 @@ if ($id > 0 || ! empty($ref)) $sql.= " d.total_ht as selling_price,"; $sql.= $db->ifsql('f.type =2','(d.buy_price_ht * d.qty *-1)','(d.buy_price_ht * d.qty)')." as buying_price, "; $sql.= $db->ifsql('f.type =2','d.qty *-1','d.qty')." as qty,"; - $sql.= $db->ifsql('f.type =2','((d.price + d.buy_price_ht) * d.qty)','((d.price - d.buy_price_ht) * d.qty)')." as marge," ; + $sql.= $db->ifsql('f.type =2','d.total_ht + (d.buy_price_ht * d.qty)','d.total_ht - (d.buy_price_ht * d.qty)')." as marge," ; $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; @@ -153,7 +153,8 @@ if ($id > 0 || ! empty($ref)) $sql.= " ORDER BY $sortfield $sortorder "; // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); - + + dol_syslog('margin:tabs:productMargins.php sql='.$sql,LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 643d190d04d..04ac4d65d64 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -131,7 +131,7 @@ if ($socid > 0) $sql.= " sum(d.total_ht) as selling_price,"; $sql.= $db->ifsql('f.type =2','sum(d.buy_price_ht * d.qty *-1)','sum(d.buy_price_ht * d.qty)')." as buying_price, "; - $sql.= $db->ifsql('f.type =2','sum((d.price + d.buy_price_ht) * d.qty)','sum((d.price - d.buy_price_ht) * d.qty)')." as marge," ; + $sql.= $db->ifsql('f.type =2','sum(d.total_ht + (d.buy_price_ht * d.qty))','sum(d.total_ht - (d.buy_price_ht * d.qty))')." as marge," ; $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; @@ -144,11 +144,12 @@ if ($socid > 0) $sql .= " AND d.buy_price_ht IS NOT NULL"; if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; - $sql.= " GROUP BY f.rowid"; + $sql.= " GROUP BY f.rowid, s.nom, s.rowid, s.code_client, f.facnumber, f.total, f.datef, f.paye, f.fk_statut"; $sql.= " ORDER BY $sortfield $sortorder "; // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); + dol_syslog('margin:tabs:thirdpartyMargins.php sql='.$sql,LOG_DEBUG); $result = $db->query($sql); if ($result) { From 4a1eb1a58854c74e98bda8ad4c78081539f5d1cc Mon Sep 17 00:00:00 2001 From: fhenry Date: Fri, 3 May 2013 15:26:20 +0200 Subject: [PATCH 07/52] Fix margin calculation --- htdocs/margin/agentMargins.php | 2 +- htdocs/margin/customerMargins.php | 2 +- htdocs/margin/productMargins.php | 2 +- htdocs/margin/tabs/productMargins.php | 2 +- htdocs/margin/tabs/thirdpartyMargins.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 0e953422ef2..3b5b2d46ec5 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -128,7 +128,7 @@ $sql = "SELECT s.nom, s.rowid as socid, s.code_client, s.client, u.rowid as agen $sql.= " u.login, u.lastname, u.firstname,"; $sql.= " sum(d.total_ht) as selling_price,"; $sql.= $db->ifsql('f.type =2','sum(d.buy_price_ht * d.qty *-1)','sum(d.buy_price_ht * d.qty)')." as buying_price, "; -$sql.= $db->ifsql('f.type =2','sum(((d.total_ht/d.qty) + d.buy_price_ht) * d.qty)','sum(((d.total_ht/d.qty) - d.buy_price_ht) * d.qty)')." as marge" ; +$sql.= $db->ifsql('f.type =2','sum(d.total_ht + (d.buy_price_ht * d.qty))','sum(d.total_ht - (d.buy_price_ht * d.qty))')." as marge" ; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact e ON e.element_id = f.rowid and e.statut = 4 and e.fk_c_type_contact = ".(empty($conf->global->AGENT_CONTACT_TYPE)?-1:$conf->global->AGENT_CONTACT_TYPE); diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 5fb491ea5c3..6af526492fe 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -157,7 +157,7 @@ $sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client, s.client,"; $sql.= " f.facnumber, f.total as total_ht,"; $sql.= " sum(d.total_ht) as selling_price,"; $sql.= $db->ifsql('f.type =2','sum(d.buy_price_ht * d.qty *-1)','sum(d.buy_price_ht * d.qty)')." as buying_price, "; -$sql.= $db->ifsql('f.type =2','sum(((d.total_ht/d.qty) + d.buy_price_ht) * d.qty)','sum(((d.total_ht/d.qty) - d.buy_price_ht) * d.qty)')." as marge," ; +$sql.= $db->ifsql('f.type =2','sum(d.total_ht + (d.buy_price_ht * d.qty))','sum(d.total_ht - (d.buy_price_ht * d.qty))')." as marge," ; $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index d2e3198b5ee..26aaa953d78 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -159,7 +159,7 @@ $sql = "SELECT DISTINCT d.fk_product, p.label, p.rowid, p.fk_product_type, p.ref $sql.= " f.facnumber, f.total as total_ht,"; $sql.= " sum(d.total_ht) as selling_price,"; $sql.= $db->ifsql('f.type =2','sum(d.buy_price_ht * d.qty *-1)','sum(d.buy_price_ht * d.qty)')." as buying_price, "; -$sql.= $db->ifsql('f.type =2','sum(((d.total_ht/d.qty) + d.buy_price_ht) * d.qty)','sum(((d.total_ht/d.qty) - d.buy_price_ht) * d.qty)')." as marge," ; +$sql.= $db->ifsql('f.type =2','sum(d.total_ht + (d.buy_price_ht * d.qty))','sum(d.total_ht - (d.buy_price_ht * d.qty))')." as marge," ; $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."product as p"; diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index 8eee225b42d..6fc92f94860 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -133,7 +133,7 @@ if ($id > 0 || ! empty($ref)) $sql.= " d.total_ht as selling_price,"; $sql.= $db->ifsql('f.type =2','(d.buy_price_ht * d.qty *-1)','(d.buy_price_ht * d.qty)')." as buying_price, "; $sql.= $db->ifsql('f.type =2','d.qty *-1','d.qty')." as qty,"; - $sql.= $db->ifsql('f.type =2','(((d.total_ht/d.qty) + d.buy_price_ht) * d.qty)','(((d.total_ht/d.qty) - d.buy_price_ht) * d.qty)')." as marge," ; + $sql.= $db->ifsql('f.type =2','d.total_ht + (d.buy_price_ht * d.qty)','d.total_ht - (d.buy_price_ht * d.qty)')." as marge," ; $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index fc319b17054..04ac4d65d64 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -131,7 +131,7 @@ if ($socid > 0) $sql.= " sum(d.total_ht) as selling_price,"; $sql.= $db->ifsql('f.type =2','sum(d.buy_price_ht * d.qty *-1)','sum(d.buy_price_ht * d.qty)')." as buying_price, "; - $sql.= $db->ifsql('f.type =2','sum(((d.total_ht/d.qty) + d.buy_price_ht) * d.qty)','sum(((d.total_ht/d.qty) - d.buy_price_ht) * d.qty)')." as marge," ; + $sql.= $db->ifsql('f.type =2','sum(d.total_ht + (d.buy_price_ht * d.qty))','sum(d.total_ht - (d.buy_price_ht * d.qty))')." as marge," ; $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; From 723bd6f7500a13d2acada3ac6c11dbd0d1a9d0e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 May 2013 16:10:28 +0200 Subject: [PATCH 08/52] Fix: [ bug #872 ] Erreur sur page Accueil Commerciale avec pgsql (3.4-beta). Fix: Permission tab was not visible for external users. --- htdocs/comm/index.php | 2 +- htdocs/core/class/conf.class.php | 2 +- htdocs/core/lib/agenda.lib.php | 4 ++-- htdocs/filefunc.inc.php | 8 ++++---- htdocs/user/perms.php | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index cc420c48d15..86a4708b489 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 449ba902c26..0ca4bd9391e 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -410,7 +410,7 @@ class Conf $this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : $this->global->MAIN_UPLOAD_DOC * 1024); // Define list of limited modules - if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='facture,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda'; // '' means 'all'. Note that contact is added here as it should be a module later. + if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,facture,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda'; // '' means 'all'. Note that contact is added here as it should be a module later. // Timeouts if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) $this->global->MAIN_USE_CONNECT_TIMEOUT=10; diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index fa0c80ce4ae..0713430f66e 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -186,9 +186,9 @@ function show_array_actions_to_do($max=5) $sql.= " s.nom as sname, s.rowid, s.client"; $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c,"; $sql.= " ".MAIN_DB_PREFIX."actioncomm as a"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ")"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql.= " WHERE c.id = a.fk_action"; $sql.= " AND a.entity = ".$conf->entity; $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; @@ -285,9 +285,9 @@ function show_array_last_actions_done($max=5) $sql.= " s.rowid, s.nom as sname, s.client"; $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c,"; $sql.= " ".MAIN_DB_PREFIX."actioncomm as a"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.=")"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql.= " WHERE c.id = a.fk_action"; $sql.= " AND a.entity = ".$conf->entity; $sql.= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index dd3b9981fce..f3780d0876a 100755 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -150,11 +150,11 @@ if (! empty($dolibarr_main_document_root_alt)) // Define DOL_MAIN_URL_ROOT and DOL_URL_ROOT $tmp=''; $found=0; -$real_dolibarr_main_document_root=str_replace('\\','/',realpath($dolibarr_main_document_root)); -$pathroot=$_SERVER["DOCUMENT_ROOT"]; -$paths=explode('/',str_replace('\\','/',$_SERVER["SCRIPT_NAME"])); +$real_dolibarr_main_document_root=str_replace('\\','/',realpath($dolibarr_main_document_root)); // A) Ex: C:/xxx/dolibarr/htdocs +$pathroot=$_SERVER["DOCUMENT_ROOT"]; // B) Ex: C:/Program Files/wamp/www/ +$paths=explode('/',str_replace('\\','/',$_SERVER["SCRIPT_NAME"])); // C) Ex: /dolibarr/htdocs/admin/system/phpinfo.php $concatpath=''; -foreach($paths as $tmppath) +foreach($paths as $tmppath) // We check to find (B+start of C)=A { if ($tmppath) $concatpath.='/'.$tmppath; //print $_SERVER["SCRIPT_NAME"].'-'.$pathroot.'-'.$concatpath.'-'.$real_dolibarr_main_document_root.'-'.realpath($pathroot.$concatpath).'
'; diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 1c1c1b916fa..ef18e248010 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -63,6 +63,7 @@ if ($user->id == $id && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user- $feature2=''; $canreaduser=1; } + $result = restrictedArea($user, 'user', $id, '&user', $feature2); if ($user->id <> $id && ! $canreaduser) accessforbidden(); @@ -268,8 +269,7 @@ print '
'; $projectstatic->ref=$objp->ref; print $projectstatic->getNomUrl(1); - print ' - '.$objp->title.''.$objp->nb.''.$projectstatic->getLibStatut(3).'

'; if ($user->admin) print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules"), 0, 1).'
'; // Show warning about external users -print showModulesExludedForExternal($modules).'
'."\n"; -print "
\n"; +if (empty($user->societe_id)) print showModulesExludedForExternal($modules).'

'."\n"; // For multicompany transversal mode if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) From 1c9caeb0d31c9c2665808423bb5cd72ab2775ada Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 May 2013 18:33:23 +0200 Subject: [PATCH 09/52] Fix: CRLF --- htdocs/core/login/README.txt | 52 ++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/htdocs/core/login/README.txt b/htdocs/core/login/README.txt index 7c00a86887f..8128dfacd57 100644 --- a/htdocs/core/login/README.txt +++ b/htdocs/core/login/README.txt @@ -1,26 +1,26 @@ -README (english) ---------------------------------------------- -Decription of htdocs/core/login directory ---------------------------------------------- - -This directory contains files that handle way to validate passwords. - -If you want to add a new password checker function, just add a file in -this directory that follow example of already existing files. -This file must be called for example : -functions_mypasschecker.php - -Edit function name to call it: -check_user_mypasschecker - -Change code of this function to return true if couple -$usertotest / $passwordtotest is ok for you. - -Then, you must edit you conf.php file to change the value of -$dolibarr_main_authentication -parameter to set it to : -mypasschecker - -Once this is done, when you log in to Dolibarr, the function -check_user_mypasschecker in this file is called. -If the function return true and login exists, login is accepted. +README (english) +--------------------------------------------- +Decription of htdocs/core/login directory +--------------------------------------------- + +This directory contains files that handle way to validate passwords. + +If you want to add a new password checker function, just add a file in +this directory that follow example of already existing files. +This file must be called for example : +functions_mypasschecker.php + +Edit function name to call it: +check_user_mypasschecker + +Change code of this function to return true if couple +$usertotest / $passwordtotest is ok for you. + +Then, you must edit you conf.php file to change the value of +$dolibarr_main_authentication +parameter to set it to : +mypasschecker + +Once this is done, when you log in to Dolibarr, the function +check_user_mypasschecker in this file is called. +If the function return true and login exists, login is accepted. From 95e44749066eb05980b786255e33e22d0678fd6f Mon Sep 17 00:00:00 2001 From: fhenry Date: Fri, 3 May 2013 20:56:58 +0200 Subject: [PATCH 10/52] Fix bug on PgSQL if user in on another entity than 1 --- htdocs/core/modules/DolibarrModules.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 106ca4ba4ba..ba874f79c16 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -906,7 +906,9 @@ abstract class DolibarrModules dol_syslog(get_class($this)."::insert_permissions Add permission to user id=".$obj2->rowid); $tmpuser=new User($this->db); $tmpuser->fetch($obj2->rowid); - $tmpuser->addrights($r_id); + if (!empty($tmpuser->id)) { + $tmpuser->addrights($r_id); + } $i++; } if (! empty($user->admin)) // Reload permission for current user if defined From a5009fd555e13408152663aa60ac23f4f6b8693a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Sat, 4 May 2013 19:35:38 +0200 Subject: [PATCH 11/52] Corrected es_ES translations --- htdocs/install/mysql/data/llx_c_forme_juridique.sql | 4 ++-- htdocs/langs/es_ES/admin.lang | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_forme_juridique.sql b/htdocs/install/mysql/data/llx_c_forme_juridique.sql index 965064d019c..6c242da0cfd 100644 --- a/htdocs/install/mysql/data/llx_c_forme_juridique.sql +++ b/htdocs/install/mysql/data/llx_c_forme_juridique.sql @@ -222,8 +222,8 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (4, '4 INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (4, '404', 'Sociedad Colectiva', 1); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (4, '405', 'Sociedad Limitada', 1); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (4, '406', 'Sociedad Anónima', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (4, '407', 'Sociedad Comandataria por Acciones', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (4, '408', 'Sociedad Comandataria Simple', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (4, '407', 'Sociedad Comanditaria por Acciones', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (4, '408', 'Sociedad Comanditaria Simple', 1); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (4, '409', 'Sociedad Laboral', 1); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (4, '410', 'Sociedad Cooperativa', 1); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (4, '411', 'Sociedad de Garantía Recíproca', 1); diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index 15a055de27a..13052863068 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -51,7 +51,7 @@ DisableJavascript=Desactivar las funciones Javascript ConfirmAjax=Utilizar los popups de confirmación Ajax UseSearchToSelectCompany=Utilizar un formulario de búsqueda para buscar terceros (en vez de lista desplegable)

Tenga en cuenta que si tiene un gran número de productos o servicios (>100 000), puede mejorar el rendimiento mediante la constante SOCIETE_DONOTSEARCH_ANYWHERE a 1 en Configuración->Varios. La búsqueda se limitará entonces al inicio de la cadena. ActivityStateToSelectCompany=Agregar un filtro en la búsqueda para mostrar/ocultar los terceros en activo o que hayan dejado de ejercer -UseSearchToSelectContact=Utilizar un formulario de búsqueda (en vez de una lista desplegable).
Tenga en cuenta que si tiene un gran número de contactos (>100 000), puede mejorar el rendimiento mediante la constante CONTACT_DONOTSEARCH_ANYWHERE a 1 en Configuración->Varios. La búsqueda se limitará entonces al inicio de la cadena. +UseSearchToSelectContact=Utilizar un formulario de búsqueda para buscar contactos (en vez de una lista desplegable).
Tenga en cuenta que si tiene un gran número de contactos (>100 000), puede mejorar el rendimiento mediante la constante CONTACT_DONOTSEARCH_ANYWHERE a 1 en Configuración->Varios. La búsqueda se limitará entonces al inicio de la cadena. SearchFilter=Opciones filtros de búsqueda NumberOfKeyToSearch=Nº de caracteres para desencadenar la búsqueda: %s ViewFullDateActions=Ver las fechas de las acciones en su totalidad en la ficha de tercero From e2a73839bc00d4ed16757e08dc960f828a8d891b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Sat, 4 May 2013 20:17:05 +0200 Subject: [PATCH 12/52] Replaced addslashes with $this->db->escape --- htdocs/holiday/class/holiday.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 55971e64375..b790b9154e9 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -124,7 +124,7 @@ class Holiday extends CommonObject // User $sql.= "'".$this->fk_user."',"; $sql.= " '".$this->db->idate($now)."',"; - $sql.= " '".addslashes($this->description)."',"; + $sql.= " '".$this->db->escape($this->description)."',"; $sql.= " '".$this->db->idate($this->date_debut)."',"; $sql.= " '".$this->db->idate($this->date_fin)."',"; $sql.= " ".$this->halfday.","; @@ -473,7 +473,7 @@ class Holiday extends CommonObject // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."holiday SET"; - $sql.= " description= '".addslashes($this->description)."',"; + $sql.= " description= '".$this->db->escape($this->description)."',"; if(!empty($this->date_debut)) { $sql.= " date_debut = '".$this->db->idate($this->date_debut)."',"; @@ -527,7 +527,7 @@ class Holiday extends CommonObject $sql.= " fk_user_cancel = NULL,"; } if(!empty($this->detail_refuse)) { - $sql.= " detail_refuse = '".addslashes($this->detail_refuse)."'"; + $sql.= " detail_refuse = '".$this->db->escape($this->detail_refuse)."'"; } else { $sql.= " detail_refuse = NULL"; } @@ -1394,7 +1394,7 @@ class Holiday extends CommonObject $sql.= ") VALUES ("; - $sql.= " '".addslashes($this->optName)."',"; + $sql.= " '".$this->db->escape($this->optName)."',"; $sql.= " '".$this->optValue."'"; $sql.= ")"; @@ -1441,7 +1441,7 @@ class Holiday extends CommonObject function updateEventCP($rowid, $name, $value) { $sql = "UPDATE ".MAIN_DB_PREFIX."holiday_events SET"; - $sql.= " name = '".addslashes($name)."', value = '".$value."'"; + $sql.= " name = '".$this->db->escape($name)."', value = '".$value."'"; $sql.= " WHERE rowid = '".$rowid."'"; $result = $this->db->query($sql); @@ -1564,7 +1564,7 @@ class Holiday extends CommonObject */ function addLogCP($fk_user_action,$fk_user_update,$type,$new_solde) { - global $conf, $langs, $db; + global $conf, $langs; $error=0; @@ -1586,7 +1586,7 @@ class Holiday extends CommonObject $sql.= " NOW(), "; $sql.= " '".$fk_user_action."',"; $sql.= " '".$fk_user_update."',"; - $sql.= " '".addslashes($type)."',"; + $sql.= " '".$this->db->escape($type)."',"; $sql.= " '".$prev_solde."',"; $sql.= " '".$new_solde."'"; $sql.= ")"; From 8bd7c6a763b57461dc8316b6cceb70fd2987226f Mon Sep 17 00:00:00 2001 From: fhenry Date: Mon, 6 May 2013 09:53:23 +0200 Subject: [PATCH 13/52] Fix Trad Fr --- htdocs/langs/fr_FR/dict.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/fr_FR/dict.lang b/htdocs/langs/fr_FR/dict.lang index 649397eb3c8..e0a8fd6f2ef 100644 --- a/htdocs/langs/fr_FR/dict.lang +++ b/htdocs/langs/fr_FR/dict.lang @@ -274,8 +274,8 @@ CurrencyMAD=Dirham CurrencySingMAD=Dirham CurrencyMGA=Ariary CurrencySingMGA=Ariary -CurrencyMUR=Roupies mauritiennes -CurrencySingMUR=Roupie mauritienne +CurrencyMUR=Roupies mauriciennes +CurrencySingMUR=Roupie mauriciennes CurrencyNOK=Couronnes norvégiennes CurrencySingNOK=Couronne norvégienne CurrencySUR=Roubles From 441ad8c6d0709f7cb6aec907e91181f6d28df561 Mon Sep 17 00:00:00 2001 From: fhenry Date: Mon, 6 May 2013 09:53:58 +0200 Subject: [PATCH 14/52] Fix Trad Fr --- htdocs/langs/fr_FR/dict.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/fr_FR/dict.lang b/htdocs/langs/fr_FR/dict.lang index 649397eb3c8..e0a8fd6f2ef 100644 --- a/htdocs/langs/fr_FR/dict.lang +++ b/htdocs/langs/fr_FR/dict.lang @@ -274,8 +274,8 @@ CurrencyMAD=Dirham CurrencySingMAD=Dirham CurrencyMGA=Ariary CurrencySingMGA=Ariary -CurrencyMUR=Roupies mauritiennes -CurrencySingMUR=Roupie mauritienne +CurrencyMUR=Roupies mauriciennes +CurrencySingMUR=Roupie mauriciennes CurrencyNOK=Couronnes norvégiennes CurrencySingNOK=Couronne norvégienne CurrencySUR=Roubles From 0bb9ee158afb2461ff70961f9c69c8e924c96339 Mon Sep 17 00:00:00 2001 From: fhenry Date: Mon, 6 May 2013 13:47:33 +0200 Subject: [PATCH 15/52] Fix trigger call ficher inter create --- htdocs/fichinter/class/fichinter.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 98defa55406..b8422f23d74 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -167,7 +167,9 @@ class Fichinter extends CommonObject // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); - $result=$interface->run_triggers('FICHINTER_CREATE',$this,$user,$langs,$conf); + $tmpuser=new User($this->db); + $tmpuser->fetch($this->author); + $result=$interface->run_triggers('FICHINTER_CREATE',$this,$tmpuser,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } From d0635901a6eee54dcf5167a348cdf5d53b97e24a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Mon, 29 Apr 2013 22:51:07 +0200 Subject: [PATCH 16/52] Fixed bug with holidays log --- htdocs/holiday/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/fiche.php b/htdocs/holiday/fiche.php index aa3287bc81a..83523ea4557 100644 --- a/htdocs/holiday/fiche.php +++ b/htdocs/holiday/fiche.php @@ -380,7 +380,7 @@ if($action == 'confirm_valid') $newSolde = $soldeActuel - ($nbJour*$cp->getConfCP('nbHolidayDeducted')); // On ajoute la modification dans le LOG - $cp->addLogCP($userID,$cp->fk_user, $langs->trans('Event').': '.$langs->transnoentitiesnoconv("Holidays"),$newSolde); + $cp->addLogCP($user->id,$cp->fk_user, $langs->trans('Event').': '.$langs->transnoentitiesnoconv("Holidays"),$newSolde); // Mise à jour du solde $cp->updateSoldeCP($cp->fk_user,$newSolde); From d7a7f316d3f27b3823a6ad953c88c71bdc9bad51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Mon, 29 Apr 2013 22:02:53 +0200 Subject: [PATCH 17/52] Replaced "Jours" with DurationDays translation key --- htdocs/holiday/admin/holiday.php | 10 +++++----- htdocs/langs/bg_BG/holiday.lang | 1 - htdocs/langs/ca_ES/holiday.lang | 1 - htdocs/langs/en_US/holiday.lang | 1 - htdocs/langs/es_ES/holiday.lang | 1 - htdocs/langs/fr_FR/holiday.lang | 1 - htdocs/langs/tr_TR/holiday.lang | 1 - 7 files changed, 5 insertions(+), 11 deletions(-) diff --git a/htdocs/holiday/admin/holiday.php b/htdocs/holiday/admin/holiday.php index e3a20662f5d..174adbdf725 100644 --- a/htdocs/holiday/admin/holiday.php +++ b/htdocs/holiday/admin/holiday.php @@ -286,7 +286,7 @@ print ''."\n"; $var=!$var; print ''."\n"; print ''.$langs->trans('DelayForSubmitCP').''."\n"; -print ' '.$langs->trans('Jours').''."\n"; +print ' '.$langs->trans('DurationDays').''."\n"; print ''."\n"; $var=!$var; @@ -304,13 +304,13 @@ print ''."\n"; $var=!$var; print ''."\n"; print ''.$langs->trans('nbHolidayEveryMonthCP').''."\n"; -print ' '.$langs->trans('Jours').''."\n"; +print ' '.$langs->trans('DurationDays').''."\n"; print ''."\n"; $var=!$var; print ''."\n"; print ''.$langs->trans('nbHolidayDeductedCP').''."\n"; -print ' '.$langs->trans('Jours').''."\n"; +print ' '.$langs->trans('DurationDays').''."\n"; print ''."\n"; print ''."\n"; @@ -367,7 +367,7 @@ if($cp_events == 1) { print ''."\n"; print ''."\n"; - print ' '.$langs->trans('Jours').''."\n"; + print ' '.$langs->trans('DurationDays').''."\n"; print ''."\n"; print ''."\n"; print ''; @@ -400,7 +400,7 @@ print ''; print ''; print ''."\n"; -print ' '.$langs->trans('Jours').''."\n"; +print ' '.$langs->trans('DurationDays').''."\n"; print ''."\n"; print ''."\n"; diff --git a/htdocs/langs/bg_BG/holiday.lang b/htdocs/langs/bg_BG/holiday.lang index 614539960d5..f47b404400d 100644 --- a/htdocs/langs/bg_BG/holiday.lang +++ b/htdocs/langs/bg_BG/holiday.lang @@ -128,7 +128,6 @@ DeleteEventOptionCP=Изтриване UpdateEventOptionCP=Актуализация ErrorMailNotSend=Възникна грешка при изпращане на електронна поща: NoCPforMonth=Не оставяйте този месец. -Jours=ден nbJours=Брой дни TitleAdminCP=Конфигурация на празници Permission20001=/ Промяна на всички искания празници diff --git a/htdocs/langs/ca_ES/holiday.lang b/htdocs/langs/ca_ES/holiday.lang index 60adaa8faf3..3c51daaa2ed 100644 --- a/htdocs/langs/ca_ES/holiday.lang +++ b/htdocs/langs/ca_ES/holiday.lang @@ -129,7 +129,6 @@ DeleteEventOptionCP=Eliminar UpdateEventOptionCP=Actualitzar ErrorMailNotSend=S'ha produït un error en l'enviament del correu electrònic: NoCPforMonth=Sense vacances aquest mes. -Jours=dies nbJours=Número de dies TitleAdminCP=Configuració de les vacances diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 5453b2b88e6..dec1ca36aa8 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -129,7 +129,6 @@ DeleteEventOptionCP=Delete UpdateEventOptionCP=Update ErrorMailNotSend=An error occurred while sending email: NoCPforMonth=No leave this month. -Jours=days nbJours=Number days TitleAdminCP=Configuration of Holidays diff --git a/htdocs/langs/es_ES/holiday.lang b/htdocs/langs/es_ES/holiday.lang index 5c234575d25..520fd4454ae 100644 --- a/htdocs/langs/es_ES/holiday.lang +++ b/htdocs/langs/es_ES/holiday.lang @@ -129,7 +129,6 @@ DeleteEventOptionCP=Eliminar UpdateEventOptionCP=Actualizar ErrorMailNotSend=Se ha producido un error en el envío del e-mail : NoCPforMonth=Sin vacaciones este mes. -Jours=días nbJours=Número de días TitleAdminCP=Configuración de las vacaciones diff --git a/htdocs/langs/fr_FR/holiday.lang b/htdocs/langs/fr_FR/holiday.lang index 938ffaa155d..35a043504eb 100644 --- a/htdocs/langs/fr_FR/holiday.lang +++ b/htdocs/langs/fr_FR/holiday.lang @@ -127,7 +127,6 @@ DeleteEventOptionCP=Supprimer UpdateEventOptionCP=Mettre à jour ErrorMailNotSend=Une erreur est survenue lors de l'envoi du mail : NoCPforMonth=Aucun congé ce mois-ci. -Jours=jours nbJours=Nombre jours TitleAdminCP=Configuration des Congés diff --git a/htdocs/langs/tr_TR/holiday.lang b/htdocs/langs/tr_TR/holiday.lang index d9291737449..b02bea2fe92 100644 --- a/htdocs/langs/tr_TR/holiday.lang +++ b/htdocs/langs/tr_TR/holiday.lang @@ -126,7 +126,6 @@ DeleteEventOptionCP=Sil UpdateEventOptionCP=Güncelle ErrorMailNotSend=Eposta gönderilirken bir hata oluştu: NoCPforMonth=Bu ay hiç izin yok. -Jours=gün nbJours=Gün sayısı TitleAdminCP=Tatillerin Yapılandırması Permission20001=Bütün tatil isteklerini Oku / Değiştir From 7e11f7466a76f059687473de94135134ef2f8df0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Tue, 30 Apr 2013 00:26:37 +0200 Subject: [PATCH 18/52] Missing translations --- htdocs/holiday/define_holiday.php | 1 + htdocs/holiday/month_report.php | 2 ++ htdocs/holiday/view_log.php | 2 ++ 3 files changed, 5 insertions(+) diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 36e93d84271..82b8003a274 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -117,6 +117,7 @@ elseif($action == 'add_event') dol_htmloutput_mesg($message); } +$langs->load('users'); $var=true; $i = 0; diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index f184cdc201e..fc984971908 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -105,6 +105,8 @@ if($num == '0') { } else { + $langs->load('users'); + while ($holiday = $db->fetch_array($result)) { $user = new User($db); diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index 29c58c4dec7..2ff389925d0 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -39,6 +39,8 @@ if(!$user->rights->holiday->view_log) accessforbidden(); * View */ +$langs->load('users'); + llxHeader(array(),$langs->trans('CPTitreMenu')); From e1913f4a1338ce81d0ba6375a3958b75b7d6953a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Mon, 29 Apr 2013 22:09:47 +0200 Subject: [PATCH 19/52] Stetic fix: Select was not valigned --- htdocs/holiday/index.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/holiday/index.php b/htdocs/holiday/index.php index 8343a805081..4e85f261c3c 100644 --- a/htdocs/holiday/index.php +++ b/htdocs/holiday/index.php @@ -262,6 +262,7 @@ print_liste_field_titre($langs->trans("DateDebCP"),$_SERVER["PHP_SELF"],"cp.date print_liste_field_titre($langs->trans("DateFinCP"),$_SERVER["PHP_SELF"],"cp.date_fin","",'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Duration")); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cp.statut","",'','align="center"',$sortfield,$sortorder); +print ''; print "\n"; // FILTRES @@ -320,6 +321,9 @@ print ' '; // STATUT print ''; $holiday->selectStatutCP($search_statut); +print ''; +// ACTION +print ''; print ''; print "\n"; From 3aa049b6611d6de065fdc3c340bc5e2b62dc158b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 6 May 2013 17:57:33 +0200 Subject: [PATCH 20/52] Fix: regression --- htdocs/contact/class/contact.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index e0df3ac276f..205ae0063a8 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -246,11 +246,11 @@ class Contact extends CommonObject $sql .= ", poste='".$this->db->escape($this->poste)."'"; $sql .= ", fax='".$this->db->escape($this->fax)."'"; $sql .= ", email='".$this->db->escape($this->email)."'"; - $sql .= ", note='".(isset($this->note)?"'".$this->db->escape($this->note)."'":"null")."'"; - $sql .= ", phone = '".(isset($this->phone_pro)?"'".$this->db->escape($this->phone_pro)."'":"null")."'"; - $sql .= ", phone_perso = '".(isset($this->phone_perso)?"'".$this->db->escape($this->phone_perso)."'":"null")."'"; - $sql .= ", phone_mobile = '".(isset($this->phone_mobile)?"'".$this->db->escape($this->phone_mobile)."'":"null")."'"; - $sql .= ", jabberid = '".(isset($this->jabberid)?"'".$this->db->escape($this->jabberid)."'":"null")."'"; + $sql .= ", note = ".(isset($this->note)?"'".$this->db->escape($this->note)."'":"null"); + $sql .= ", phone = ".(isset($this->phone_pro)?"'".$this->db->escape($this->phone_pro)."'":"null"); + $sql .= ", phone_perso = ".(isset($this->phone_perso)?"'".$this->db->escape($this->phone_perso)."'":"null"); + $sql .= ", phone_mobile = ".(isset($this->phone_mobile)?"'".$this->db->escape($this->phone_mobile)."'":"null"); + $sql .= ", jabberid = ".(isset($this->jabberid)?"'".$this->db->escape($this->jabberid)."'":"null"); $sql .= ", priv = '".$this->priv."'"; $sql .= ", fk_user_modif=".($user->id > 0 ? "'".$user->id."'":"null"); $sql .= ", default_lang=".($this->default_lang?"'".$this->default_lang."'":"null"); From f9093e00bb5e113fbca505452181901eff7f48c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Mon, 6 May 2013 18:14:16 +0200 Subject: [PATCH 21/52] Missing es_ES translations --- htdocs/langs/es_ES/admin.lang | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index 13052863068..18f58bd0dae 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -480,6 +480,8 @@ Module2650Name=Ultimatepdf Module2650Desc=Gestión de la presentación de las plantillas pdf (presupuestos, facturas, pedidos, etc.) Module2700Name=Gravatar Module2700Desc=Utiliza el servicio en línea de Gravatar (www.gravatar.com) para mostrar fotos de los usuarios/miembros (que se encuentran en sus mensajes de correo electrónico). Necesita un acceso a Internet +Module2800Name=FTP +Module2800Desc=Cliente FTP Module2900Name=GeoIPMaxmind Module2900Desc=Capacidades de conversión GeoIP Maxmind Module5000Name=Multi-empresa From 20e0fe4b2493612e5ba97820352b92a40d822055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Mon, 6 May 2013 22:24:05 +0200 Subject: [PATCH 22/52] Corrected translation key --- htdocs/contact/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 505992341de..aa7923926e0 100755 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -262,7 +262,7 @@ if ($result) print_liste_field_titre($langs->trans("PostOrFunction"),$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder); if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom", $begin, $param, '', $sortfield,$sortorder); print_liste_field_titre($langs->trans("Phone"),$_SERVER["PHP_SELF"],"p.phone", $begin, $param, '', $sortfield,$sortorder); - print_liste_field_titre($langs->trans("Mobile"),$_SERVER["PHP_SELF"],"p.phone_mob", $begin, $param, '', $sortfield,$sortorder); + print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mob", $begin, $param, '', $sortfield,$sortorder); print_liste_field_titre($langs->trans("Fax"),$_SERVER["PHP_SELF"],"p.fax", $begin, $param, '', $sortfield,$sortorder); print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email", $begin, $param, '', $sortfield,$sortorder); print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"p.tms", $begin, $param, 'align="center"', $sortfield,$sortorder); From c81cf6364a34891719dd9f52dc1ff26d13d8aa77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Mon, 6 May 2013 22:59:50 +0200 Subject: [PATCH 23/52] Removed innecesary whitespace when no picto is displayed --- htdocs/core/menus/standard/eldy.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 6c423d7d2f7..857b23c5466 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -462,16 +462,16 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) { $langs->load("errors"); - $warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete")); + $warnpicto =' '.img_warning($langs->trans("WarningMandatorySetupNotComplete")); } - $newmenu->add("/admin/company.php?mainmenu=home", $langs->trans("MenuCompanySetup").' '.$warnpicto,1); + $newmenu->add("/admin/company.php?mainmenu=home", $langs->trans("MenuCompanySetup").$warnpicto,1); $warnpicto=''; if (count($conf->modules) <= 1) // If only user module enabled { $langs->load("errors"); - $warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete")); + $warnpicto = ' '.img_warning($langs->trans("WarningMandatorySetupNotComplete")); } - $newmenu->add("/admin/modules.php?mainmenu=home", $langs->trans("Modules").' '.$warnpicto,1); + $newmenu->add("/admin/modules.php?mainmenu=home", $langs->trans("Modules").$warnpicto,1); $newmenu->add("/admin/menus.php?mainmenu=home", $langs->trans("Menus"),1); $newmenu->add("/admin/ihm.php?mainmenu=home", $langs->trans("GUISetup"),1); if (! in_array($langs->defaultlang,array('en_US','en_GB','en_NZ','en_AU','fr_FR','fr_BE','es_ES','ca_ES'))) From 0a90af0b9905ae79830653b3c2d263205121d7c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Mon, 6 May 2013 23:31:19 +0200 Subject: [PATCH 24/52] Fixed untranslated string --- htdocs/societe/admin/societe.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index d4bc91b6b65..400d9b17a20 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; $langs->load("admin"); +$langs->load('other'); $action=GETPOST('action','alpha'); $value=GETPOST('value','alpha'); From b3f40b900b0e552ee899b2b6713766a456173fc5 Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 7 May 2013 09:26:31 +0200 Subject: [PATCH 25/52] Make constraint SQL unique name (Mandatory for PgSQL) --- .../install/mysql/tables/llx_opensurvey_user_studs.key.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_opensurvey_user_studs.key.sql b/htdocs/install/mysql/tables/llx_opensurvey_user_studs.key.sql index 041b2d0593d..810080e3466 100755 --- a/htdocs/install/mysql/tables/llx_opensurvey_user_studs.key.sql +++ b/htdocs/install/mysql/tables/llx_opensurvey_user_studs.key.sql @@ -15,6 +15,6 @@ -- along with this program. If not, see . -- ============================================================================ -ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_id_users (id_users); -ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_nom (nom); -ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_id_sondage (id_sondage); +ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_opensurvey_user_studs_id_users (id_users); +ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_opensurvey_user_studs_nom (nom); +ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_opensurvey_user_studs_id_sondage (id_sondage); From 642712948058280781b0929077bde3d8db998586 Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 7 May 2013 12:25:32 +0200 Subject: [PATCH 26/52] Fix extrafields update/save on User/fiche.php --- htdocs/user/fiche.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 7769a9da06c..53de51df268 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -7,6 +7,7 @@ * Copyright (C) 2005 Lionel Cousteix * Copyright (C) 2011 Herve Prot * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2013 Florian Henry * * 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 @@ -85,6 +86,9 @@ $form = new Form($db); $object = new User($db); $extrafields = new ExtraFields($db); +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('usercard')); @@ -560,9 +564,6 @@ if ($action == 'adduserldap') * View */ -// fetch optionals attributes and labels -$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); - llxHeader('',$langs->trans("UserCard")); $form = new Form($db); From c28ef8a5578e56c309e5ce0ba31b0b86bde9a34a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 May 2013 12:51:45 +0200 Subject: [PATCH 27/52] Fix: Delete deprecated files during install as they create conflicts when migrating from old versions. --- htdocs/install/upgrade2.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index e17b5a4d556..e477ec3b6a5 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -3526,6 +3526,10 @@ function migrate_delete_old_files($db,$langs,$conf) DOL_DOCUMENT_ROOT.'/core/menus/smartphone/iphone.lib.php', DOL_DOCUMENT_ROOT.'/core/menus/smartphone/iphone_backoffice.php', DOL_DOCUMENT_ROOT.'/core/menus/smartphone/iphone_frontoffice.php', + DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria_backoffice.php', + DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria_frontoffice.php', + DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy_backoffice.php', + DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy_frontoffice.php', DOL_DOCUMENT_ROOT.'/core/modules/mailings/dolibarr_services_expired.modules.php', DOL_DOCUMENT_ROOT.'/core/modules/mailings/peche.modules.php', DOL_DOCUMENT_ROOT.'/core/modules/mailings/poire.modules.php', From 094a7e5ea94888690d0adc205fa6a7f3becf9a63 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 May 2013 13:20:50 +0200 Subject: [PATCH 28/52] Fix: Bad constant --- scripts/invoices/email_unpaid_invoices_to_customers.php | 2 +- scripts/invoices/email_unpaid_invoices_to_representatives.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/invoices/email_unpaid_invoices_to_customers.php b/scripts/invoices/email_unpaid_invoices_to_customers.php index 0c069d04683..972cbb7d429 100755 --- a/scripts/invoices/email_unpaid_invoices_to_customers.php +++ b/scripts/invoices/email_unpaid_invoices_to_customers.php @@ -174,7 +174,7 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldcustomer) $subject = "[".(empty($conf->global->MAIN_APPLICATION_TITLE)?'Dolibarr':$conf->global->MAIN_APPLICATION_TITLE)."] ".$newlangs->trans("ListOfYourUnpaidInvoices"); $sendto = $oldemail; - $from = $conf->global->MAIN_EMAIL_FROM; + $from = $conf->global->MAIN_MAIL_EMAIL_FROM; $errorsto = $conf->global->MAIN_MAIL_ERRORS_TO; $msgishtml = 0; diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index 77bd9ee6402..8999d41604c 100755 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -177,7 +177,7 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldsalerepresenta $subject = "[".(empty($conf->global->MAIN_APPLICATION_TITLE)?'Dolibarr':$conf->global->MAIN_APPLICATION_TITLE)."] ".$newlangs->trans("ListOfYourUnpaidInvoices"); $sendto = $oldemail; - $from = $conf->global->MAIN_EMAIL_FROM; + $from = $conf->global->MAIN_MAIL_EMAIL_FROM; $errorsto = $conf->global->MAIN_MAIL_ERRORS_TO; $msgishtml = 0; From 6ec81375c4142c0905edd55f2d012742f9dfe5bf Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 7 May 2013 14:26:11 +0200 Subject: [PATCH 29/52] Fix: missing rename note to note_private and add note_public --- htdocs/core/modules/modSociete.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 8f66f2b9572..6bb15f60a38 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2012 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -248,10 +248,10 @@ class modSociete extends DolibarrModules $this->export_label[$r]='ExportDataset_company_1'; $this->export_icon[$r]='company'; $this->export_permission[$r]=array(array("societe","export")); - $this->export_fields_array[$r]=array('s.rowid'=>"Id",'s.nom'=>"Name",'s.status'=>"Status",'s.client'=>"Customer",'s.fournisseur'=>"Supplier",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.code_compta'=>"AccountancyCode",'s.code_compta_fournisseur'=>"SupplierAccountancyCode",'s.address'=>"Address",'s.zip'=>"Zip",'s.town'=>"Town",'p.libelle'=>"Country",'p.code'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.default_lang'=>"DefaultLang",'s.siren'=>"ProfId1",'s.siret'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.idprof5'=>"ProfId5",'s.idprof6'=>"ProfId6",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'t.libelle'=>"ThirdPartyType",'ce.code'=>"Staff","cfj.libelle"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','d.nom'=>'State'); + $this->export_fields_array[$r]=array('s.rowid'=>"Id",'s.nom'=>"Name",'s.status'=>"Status",'s.client'=>"Customer",'s.fournisseur'=>"Supplier",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.code_compta'=>"AccountancyCode",'s.code_compta_fournisseur'=>"SupplierAccountancyCode",'s.address'=>"Address",'s.zip'=>"Zip",'s.town'=>"Town",'p.libelle'=>"Country",'p.code'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.default_lang'=>"DefaultLang",'s.siren'=>"ProfId1",'s.siret'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.idprof5'=>"ProfId5",'s.idprof6'=>"ProfId6",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note_private'=>"NotePrivate",'s.note_public'=>"NotePublic",'t.libelle'=>"ThirdPartyType",'ce.code'=>"Staff","cfj.libelle"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','d.nom'=>'State'); if (! empty($conf->global->SOCIETE_USEPREFIX)) $this->export_fields_array[$r]['s.prefix']='Prefix'; //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>"Text",'s.status'=>"Text",'s.client'=>"Boolean",'s.fournisseur'=>"Boolean",'s.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'p.libelle'=>"List:c_pays:libelle:rowid",'p.code'=>"Text",'s.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.default_lang'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text",'s.idprof5'=>"Text",'s.idprof6'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Number",'s.note'=>"Text",'t.libelle'=>"Text",'ce.code'=>"List:c_effectif:libelle:code","cfj.libelle"=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code','s.fk_stcomm'=>'List:c_stcomm:libelle:code','d.nom'=>'List:c_departements:nom:rowid'); - $this->export_TypeFields_array[$r]=array('s.nom'=>"Text",'s.status'=>"Number",'s.client'=>"Boolean",'s.fournisseur'=>"Boolean",'s.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text",'s.code_compta'=>"Text",'s.code_compta_fournisseur'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'p.libelle'=>"List:c_pays:libelle:rowid",'p.code'=>"Text",'s.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.default_lang'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text",'s.idprof5'=>"Text",'s.idprof6'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Number",'s.note'=>"Text",'t.libelle'=>"Text",'ce.code'=>"List:c_effectif:libelle:code","cfj.libelle"=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code','s.fk_stcomm'=>'List:c_stcomm:libelle:code','d.nom'=>'Text'); + $this->export_TypeFields_array[$r]=array('s.nom'=>"Text",'s.status'=>"Number",'s.client'=>"Boolean",'s.fournisseur'=>"Boolean",'s.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text",'s.code_compta'=>"Text",'s.code_compta_fournisseur'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'p.libelle'=>"List:c_pays:libelle:rowid",'p.code'=>"Text",'s.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.default_lang'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text",'s.idprof5'=>"Text",'s.idprof6'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Number",'s.note_private'=>"Text",'s.note_public'=>"Text",'t.libelle'=>"Text",'ce.code'=>"List:c_effectif:libelle:code","cfj.libelle"=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code','s.fk_stcomm'=>'List:c_stcomm:libelle:code','d.nom'=>'Text'); $this->export_entities_array[$r]=array(); // We define here only fields that use another picto // Add extra fields $sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'company'"; @@ -343,7 +343,7 @@ class modSociete extends DolibarrModules $this->import_icon[$r]='company'; $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon $this->import_tables_array[$r]=array('s'=>MAIN_DB_PREFIX.'societe','extra'=>MAIN_DB_PREFIX.'societe_extrafields'); // List of tables to insert into (insert done in same order) - $this->import_fields_array[$r]=array('s.nom'=>"Name*",'s.status'=>"Status",'s.client'=>"Customer*",'s.fournisseur'=>"Supplier*",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.code_compta'=>"CustomerAccountancyCode",'s.code_compta_fournisseur'=>"SupplierAccountancyCode",'s.address'=>"Address",'s.zip'=>"Zip",'s.town'=>"Town",'s.fk_pays'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'s.fk_typent'=>"ThirdPartyType",'s.fk_effectif'=>"Staff","s.fk_forme_juridique"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','s.default_lang'=>'DefaultLanguage','s.barcode'=>'BarCode','s.datec'=>"DateCreation"); + $this->import_fields_array[$r]=array('s.nom'=>"Name*",'s.status'=>"Status",'s.client'=>"Customer*",'s.fournisseur'=>"Supplier*",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.code_compta'=>"CustomerAccountancyCode",'s.code_compta_fournisseur'=>"SupplierAccountancyCode",'s.address'=>"Address",'s.zip'=>"Zip",'s.town'=>"Town",'s.fk_pays'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note_private'=>"NotePrivate",'s.note_public'=>"NotePublic",'s.fk_typent'=>"ThirdPartyType",'s.fk_effectif'=>"Staff","s.fk_forme_juridique"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','s.default_lang'=>'DefaultLanguage','s.barcode'=>'BarCode','s.datec'=>"DateCreation"); // Add extra fields $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'company'"; $resql=$this->db->query($sql); @@ -369,7 +369,7 @@ class modSociete extends DolibarrModules ); //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); $this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.fk_typent'=>'id@'.MAIN_DB_PREFIX.'c_typent','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); - $this->import_examplevalues_array[$r]=array('s.nom'=>"MyBigCompany",'s.status'=>"0 (closed) or 1 (active)",'s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(dol_now(),'%Y-%m-%d'),'s.code_client'=>"CU01-0001 or auto",'s.code_fournisseur'=>"SU01-0001 or auto",'s.address'=>"61 jump street",'s.zip'=>"123456",'s.town'=>"Big town",'s.fk_pays'=>'US, FR, DE...','s.phone'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note'=>"This is an example of note for record",'s.fk_typent'=>"2",'s.fk_effectif'=>"3","s.fk_forme_juridique"=>"1",'s.fk_prospectlevel'=>'PL_MEDIUM','s.fk_stcomm'=>'0','s.default_lang'=>'en_US','s.barcode'=>'123456789'); + $this->import_examplevalues_array[$r]=array('s.nom'=>"MyBigCompany",'s.status'=>"0 (closed) or 1 (active)",'s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(dol_now(),'%Y-%m-%d'),'s.code_client'=>"CU01-0001 or auto",'s.code_fournisseur'=>"SU01-0001 or auto",'s.address'=>"61 jump street",'s.zip'=>"123456",'s.town'=>"Big town",'s.fk_pays'=>'US, FR, DE...','s.phone'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note_private'=>"This is an example of private note for record",'s.note_public'=>"This is an example of public note for record",'s.fk_typent'=>"2",'s.fk_effectif'=>"3","s.fk_forme_juridique"=>"1",'s.fk_prospectlevel'=>'PL_MEDIUM','s.fk_stcomm'=>'0','s.default_lang'=>'en_US','s.barcode'=>'123456789'); // Import list of contact and attributes $r++; @@ -378,7 +378,7 @@ class modSociete extends DolibarrModules $this->import_icon[$r]='contact'; $this->import_entities_array[$r]=array('s.fk_soc'=>'company'); // We define here only fields that use another icon that the one defined into import_icon $this->import_tables_array[$r]=array('s'=>MAIN_DB_PREFIX.'socpeople','extra'=>MAIN_DB_PREFIX.'socpeople_extrafields'); // List of tables to insert into (insert done in same order) - $this->import_fields_array[$r]=array('s.fk_soc'=>'ThirdPartyName*','s.civilite'=>'UserTitle','s.lastname'=>"Name*",'s.firstname'=>"Firstname",'s.address'=>"Address",'s.zip'=>"Zip",'s.town'=>"Town",'s.fk_pays'=>"CountryCode",'s.birthday'=>"BirthdayDate",'s.poste'=>"Role",'s.phone'=>"Phone",'s.phone_perso'=>"PhonePerso",'s.phone_mobile'=>"PhoneMobile",'s.fax'=>"Fax",'s.email'=>"Email",'s.note'=>"Note",'s.datec'=>"DateCreation"); + $this->import_fields_array[$r]=array('s.fk_soc'=>'ThirdPartyName*','s.civilite'=>'UserTitle','s.lastname'=>"Name*",'s.firstname'=>"Firstname",'s.address'=>"Address",'s.zip'=>"Zip",'s.town'=>"Town",'s.fk_pays'=>"CountryCode",'s.birthday'=>"BirthdayDate",'s.poste'=>"Role",'s.phone'=>"Phone",'s.phone_perso'=>"PhonePerso",'s.phone_mobile'=>"PhoneMobile",'s.fax'=>"Fax",'s.email'=>"Email",'s.note_private'=>"Note",'s.note_public'=>"Note",'s.datec'=>"DateCreation"); // Add extra fields $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'contact'"; $resql=$this->db->query($sql); @@ -399,7 +399,7 @@ class modSociete extends DolibarrModules ); //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); $this->import_regex_array[$r]=array('s.birthday'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); - $this->import_examplevalues_array[$r]=array('s.fk_soc'=>'MyBigCompany','s.civilite'=>"MR",'s.name'=>"Smith",'s.firstname'=>'John','s.address'=>'61 jump street','s.zip'=>'75000','s.town'=>'Bigtown','s.fk_pays'=>'US, FR, DE...','s.datec'=>'1972-10-10','s.poste'=>"Director",'s.phone'=>"5551122",'s.phone_perso'=>"5551133",'s.phone_mobile'=>"5551144",'s.fax'=>"5551155",'s.email'=>"johnsmith@email.com",'s.note'=>"My comments"); + $this->import_examplevalues_array[$r]=array('s.fk_soc'=>'MyBigCompany','s.civilite'=>"MR",'s.name'=>"Smith",'s.firstname'=>'John','s.address'=>'61 jump street','s.zip'=>'75000','s.town'=>'Bigtown','s.fk_pays'=>'US, FR, DE...','s.datec'=>'1972-10-10','s.poste'=>"Director",'s.phone'=>"5551122",'s.phone_perso'=>"5551133",'s.phone_mobile'=>"5551144",'s.fax'=>"5551155",'s.email'=>"johnsmith@email.com",'s.note_private'=>"My private note",'s.note_public'=>"My public note"); // Import Bank Accounts $r++; From c623e7913bc721ef1ca9c2981ac04b6c9ff313f4 Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 7 May 2013 14:31:11 +0200 Subject: [PATCH 30/52] Update migration script with new idx index unique name opensurvey --- htdocs/install/mysql/migration/3.3.0-3.4.0.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index 9a3f073f40d..7d3b69345b8 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -346,9 +346,9 @@ ALTER TABLE llx_opensurvey_comments ADD INDEX idx_id_comment (id_comment); ALTER TABLE llx_opensurvey_comments ADD INDEX idx_id_sondage (id_sondage); ALTER TABLE llx_opensurvey_sondage ADD INDEX idx_id_sondage_admin (id_sondage_admin); ALTER TABLE llx_opensurvey_sondage ADD INDEX idx_date_fin (date_fin); -ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_id_users (id_users); -ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_nom (nom); -ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_id_sondage (id_sondage); +ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_opensurvey_user_studs_id_users (id_users); +ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_opensurvey_user_studs_nom (nom); +ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_opensurvey_user_studs_id_sondage (id_sondage); ALTER TABLE llx_boxes ADD COLUMN params varchar(255); From de4b9b01bfe281349156b54469fff5862cd19356 Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 7 May 2013 15:34:40 +0200 Subject: [PATCH 31/52] Fix Bug [ bug #880 ] Prelevement section is broken --- htdocs/compta/prelevement/bons.php | 2 +- htdocs/compta/prelevement/create.php | 2 +- htdocs/compta/prelevement/demandes.php | 2 +- htdocs/compta/prelevement/factures.php | 2 +- htdocs/compta/prelevement/fiche-rejet.php | 2 +- htdocs/compta/prelevement/fiche-stat.php | 2 +- htdocs/compta/prelevement/fiche.php | 2 +- htdocs/compta/prelevement/index.php | 4 +++- htdocs/compta/prelevement/ligne.php | 2 +- htdocs/compta/prelevement/lignes.php | 2 +- htdocs/compta/prelevement/liste.php | 2 +- htdocs/compta/prelevement/rejets.php | 2 +- htdocs/compta/prelevement/stats.php | 2 +- 13 files changed, 15 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index 218d8fb9523..ce33322d03a 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -24,7 +24,7 @@ * \brief Page liste des bons de prelevements */ -require('../../../main.inc.php'); +require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 5be91cb8044..f9d770111a7 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -24,7 +24,7 @@ * \brief Prelevement creation page */ -require('../../../main.inc.php'); +require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index 4d83076c600..3012a70bd55 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -24,7 +24,7 @@ * \brief Page to list withdraw requests */ -require('../../../main.inc.php'); +require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/core/modules/modPrelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index 94f96b04f9d..ec8eaa51479 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -24,7 +24,7 @@ * \brief Page liste des factures prelevees */ -require('../../../main.inc.php'); +require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php'; diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index e89a5fa2fcd..c77a0ab6682 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -24,7 +24,7 @@ * \brief Withdraw reject */ -require('../../../main.inc.php'); +require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php'; diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index 9cb29ad8d26..161df078aae 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -23,7 +23,7 @@ * \brief Prelevement statistics */ -require('../../../main.inc.php'); +require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; diff --git a/htdocs/compta/prelevement/fiche.php b/htdocs/compta/prelevement/fiche.php index fee2f1ecc24..a7ebf00c950 100644 --- a/htdocs/compta/prelevement/fiche.php +++ b/htdocs/compta/prelevement/fiche.php @@ -23,7 +23,7 @@ * \brief Fiche prelevement */ -require('../../../main.inc.php'); +require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index c1d0a0aaa3f..d3823cc130e 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2013 Florian Henry * * 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 @@ -24,7 +25,8 @@ * \brief Prelevement index page */ -require('../../../main.inc.php'); + +require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; diff --git a/htdocs/compta/prelevement/ligne.php b/htdocs/compta/prelevement/ligne.php index 5f7e17fb679..45dc325f5c1 100644 --- a/htdocs/compta/prelevement/ligne.php +++ b/htdocs/compta/prelevement/ligne.php @@ -24,7 +24,7 @@ * \brief card of withdraw line */ -require('../../../main.inc.php'); +require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php'; diff --git a/htdocs/compta/prelevement/lignes.php b/htdocs/compta/prelevement/lignes.php index 055574a2c06..445f1e66755 100644 --- a/htdocs/compta/prelevement/lignes.php +++ b/htdocs/compta/prelevement/lignes.php @@ -24,7 +24,7 @@ * \brief Prelevement lines */ -require('../../../main.inc.php'); +require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; diff --git a/htdocs/compta/prelevement/liste.php b/htdocs/compta/prelevement/liste.php index 1410b177ff2..d3d8634d64a 100644 --- a/htdocs/compta/prelevement/liste.php +++ b/htdocs/compta/prelevement/liste.php @@ -23,7 +23,7 @@ * \ingroup prelevement * \brief Page liste des prelevements */ -require('../../../main.inc.php'); +require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php index 274e55084f4..27a2ab59f38 100644 --- a/htdocs/compta/prelevement/rejets.php +++ b/htdocs/compta/prelevement/rejets.php @@ -24,7 +24,7 @@ * \brief Reject page */ -require('../../../main.inc.php'); +require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php index 419fb7eb3e8..34ffdb168b5 100644 --- a/htdocs/compta/prelevement/stats.php +++ b/htdocs/compta/prelevement/stats.php @@ -24,7 +24,7 @@ * \brief Page de stats des prelevements */ -require('../../../main.inc.php'); +require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; From 16e06736e65ade5ed24daad9035e6e00dd3ef77f Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 7 May 2013 16:50:27 +0200 Subject: [PATCH 32/52] =?UTF-8?q?Fix=20bug=20[=20bug=20#882=20]=20[3.4.0]?= =?UTF-8?q?=20Can't=20open=20WithdrawalReceipt=20/=20fichier=20de=20pr?= =?UTF-8?q?=C3=A9l=C3=A8vement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/core/lib/files.lib.php | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 83af9f60871..cad4d4c3d52 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1244,7 +1244,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity) if (empty($modulepart)) return 'ErrorBadParameter'; if (empty($entity)) $entity=0; - + dol_syslog('$modulepart='.$modulepart.' $original_file= '.$original_file); // We define $accessallowed and $sqlprotectagainstexternals $accessallowed=0; $sqlprotectagainstexternals=''; @@ -1364,9 +1364,12 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity) } // Wrapping pour les prelevements elseif ($modulepart == 'prelevement') - { - if ($user->rights->prelevement->bons->lire) $accessallowed=1; - $original_file=$conf->prelevement->dir_output.'/receipts/'.$original_file; + { + if ($user->rights->prelevement->bons->lire || preg_match('/^specimen/i',$original_file)) + { + $accessallowed=1; + } + $original_file=$conf->prelevement->dir_output.'/'.$original_file; } // Wrapping pour les graph energie elseif ($modulepart == 'graph_stock') @@ -1466,17 +1469,6 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity) $original_file=$conf->deplacement->dir_output.'/'.$original_file; //$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$refname."' AND entity=".$conf->entity; } - - // Wrapping pour les prelevements - else if ($modulepart == 'prelevement') - { - if ($user->rights->prelevement->bons->lire || preg_match('/^specimen/i',$original_file)) - { - $accessallowed=1; - } - $original_file=$conf->prelevement->dir_output.'/'.$original_file; - } - // Wrapping pour les propales else if ($modulepart == 'propal') { @@ -1767,7 +1759,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity) eval('$sqlprotectagainstexternals = "'.$conf->global->$sqlProtectConstName.'";'); } } - + $ret = array( 'accessallowed' => $accessallowed, 'sqlprotectagainstexternals'=>$sqlprotectagainstexternals, From 207f6cea2850a4fa35c5c0169b1fae543b7e83f2 Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 7 May 2013 16:59:27 +0200 Subject: [PATCH 33/52] Fix [ bug #883 ] Silent pgsql errors in comm/index.php --- htdocs/core/lib/agenda.lib.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index b3ac9a0c8dc..f7b189a5c9a 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -184,13 +184,12 @@ function show_array_actions_to_do($max=5) $sql = "SELECT a.id, a.label, a.datep as dp, a.datep2 as dp2, a.fk_user_author, a.percent,"; $sql.= " c.code, c.libelle,"; $sql.= " s.nom as sname, s.rowid, s.client"; - $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c,"; - $sql.= " ".MAIN_DB_PREFIX."actioncomm as a"; + $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c LEFT JOIN "; + $sql.= " ".MAIN_DB_PREFIX."actioncomm as a ON c.id = a.fk_action"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ")"; - $sql.= " WHERE c.id = a.fk_action"; - $sql.= " AND a.entity = ".$conf->entity; + $sql.= " WHERE a.entity = ".$conf->entity; $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = ".$socid; @@ -283,13 +282,12 @@ function show_array_last_actions_done($max=5) $sql = "SELECT a.id, a.percent, a.datep as da, a.datep2 as da2, a.fk_user_author, a.label,"; $sql.= " c.code, c.libelle,"; $sql.= " s.rowid, s.nom as sname, s.client"; - $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c,"; - $sql.= " ".MAIN_DB_PREFIX."actioncomm as a"; + $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c LEFT JOIN "; + $sql.= " ".MAIN_DB_PREFIX."actioncomm as a ON c.id = a.fk_action "; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.=")"; - $sql.= " WHERE c.id = a.fk_action"; - $sql.= " AND a.entity = ".$conf->entity; + $sql.= " WHERE a.entity = ".$conf->entity; $sql.= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = ".$socid; From 37a9686921bfdb5ab619ccbb9cb35f9153ec96a2 Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 7 May 2013 17:06:10 +0200 Subject: [PATCH 34/52] Fix bug [ bug #884 ] Warnings on /compta/bank/index.php --- htdocs/compta/bank/class/account.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index e740ea0e387..01ec205564a 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005-2010 Regis Houssin + * Copytight (C) 2013 Florian Henry * * 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 @@ -804,7 +805,7 @@ class Account extends CommonObject $sql = "SELECT sum(amount) as amount"; $sql.= " FROM ".MAIN_DB_PREFIX."bank"; $sql.= " WHERE fk_account = ".$this->id; - if ($option == 1) $sql.= " AND dateo <= ".$this->db->idate(time()); + if ($option == 1) $sql.= " AND dateo <= '".$this->db->idate(dol_now())."'"; $resql = $this->db->query($sql); if ($resql) From 68259c51ebf6b657a80ef05b19eb247055460848 Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 7 May 2013 17:09:31 +0200 Subject: [PATCH 35/52] Fix [ bug #886 ] Silent pgsql errors in /fourn/commande/fiche.php?action=create --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 5b3c9d6c8d3..dbd23b2f465 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -947,7 +947,7 @@ class CommandeFournisseur extends CommonOrder $sql.= ", '".$this->note_public."'"; $sql.= ", ".$conf->entity; $sql.= ", ".$this->socid; - $sql.= ", ".$this->db->idate($now); + $sql.= ", '".$this->db->idate($now)."'"; //$sql.= ", ".$this->db->idate($now); $sql.= ", ".$user->id; $sql.= ", 0"; From 8c37063541e06646009a3f9186cc0f35517d3267 Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 7 May 2013 18:59:28 +0200 Subject: [PATCH 36/52] Fix bug [ bug #881 ] some errors --- htdocs/projet/class/project.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index e6376bbe7eb..dc438d2b929 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1292,9 +1292,11 @@ class Project extends CommonObject switch ($Tablename) { case "facture": - case "facture_fourn": $sql = "SELECT rowid, facnumber as ref"; break; + case "facture_fourn": + $sql = "SELECT rowid, ref"; + break; case "facture_rec": $sql = "SELECT rowid, titre as ref"; break; @@ -1309,7 +1311,9 @@ class Project extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX.$Tablename; $sql.= " WHERE ".$projectkey." is null"; - $sql.= " AND fk_soc=".$this->societe->id; + if (!empty($this->societe->id)) { + $sql.= " AND fk_soc=".$this->societe->id; + } $sql.= " ORDER BY ref DESC"; dol_syslog("Project.Lib::select_element sql=".$sql); From e18eb3a6b38ff546984b7b28b5d0a77c85e539d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Wed, 8 May 2013 17:20:20 +0200 Subject: [PATCH 37/52] Added missing translations --- htdocs/admin/dict.php | 1 + htdocs/langs/en_US/main.lang | 1 + htdocs/langs/es_ES/main.lang | 1 + htdocs/langs/fr_FR/main.lang | 1 + 4 files changed, 4 insertions(+) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index d82169b7be3..217dc10fed6 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -440,6 +440,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) if ($fieldnamekey == 'type') $fieldnamekey = 'Type'; if ($fieldnamekey == 'position') $fieldnamekey = 'Position'; if ($fieldnamekey == 'unicode') $fieldnamekey = 'Unicode'; + if ($fieldnamekey == 'deductible') $fieldnamekey = 'Deductible'; $msg.=$langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)).'
'; } diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 5f140d5ef72..64f8fbd44cf 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -646,6 +646,7 @@ Test=Test Element=Element NoPhotoYet=No pictures available yet HomeDashboard=Home summary +Deductible=Deductible # Week day Monday=Monday diff --git a/htdocs/langs/es_ES/main.lang b/htdocs/langs/es_ES/main.lang index aece1ad9d15..a428c94d615 100644 --- a/htdocs/langs/es_ES/main.lang +++ b/htdocs/langs/es_ES/main.lang @@ -646,6 +646,7 @@ ModulesSystemTools=Módulos utilidades View=Ver Test=Prueba Element=Elemento +Deductible=Deducible # Week day Monday=Lunes diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index b15ea321c51..605df460347 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -650,6 +650,7 @@ Test=Test Element=Élément NoPhotoYet=Pas de photo disponible pour l'instant HomeDashboard=Synthèse accueil +Deductible=Déductible # Week day Monday=Lundi From 661071286e5817e937e828e65250160ca885c248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Wed, 8 May 2013 17:23:41 +0200 Subject: [PATCH 38/52] Typo in skeleton module class --- dev/skeletons/modMyModule.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index 149228d5ce4..db7a4b81711 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -178,7 +178,7 @@ class modMyModule extends DolibarrModules // Main menu entries - $this->menus = array(); // List of menus to add + $this->menu = array(); // List of menus to add $r=0; // Add here entries to declare new menus From 5e059fb15dcab7f2eb300d460a9ecd2556a9cde4 Mon Sep 17 00:00:00 2001 From: simnandez Date: Wed, 8 May 2013 17:59:16 +0200 Subject: [PATCH 39/52] Trad: Added missing translations --- htdocs/langs/ca_ES/main.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/ca_ES/main.lang b/htdocs/langs/ca_ES/main.lang index b4689f1537d..8459becff3e 100644 --- a/htdocs/langs/ca_ES/main.lang +++ b/htdocs/langs/ca_ES/main.lang @@ -646,6 +646,7 @@ ModulesSystemTools=Mòduls utilitats View=Veure Test=Prova Element=Element +Deductible=Deduïble # Week day Monday=Dilluns From 30fb1e5e0558e9675b37e7c3f2077173510c4674 Mon Sep 17 00:00:00 2001 From: fhenry Date: Thu, 9 May 2013 10:26:04 +0200 Subject: [PATCH 40/52] Fix bug [ bug #885 ] silent pgsql errors with click2dial --- htdocs/install/mysql/migration/3.3.0-3.4.0.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index 7d3b69345b8..46affb6327a 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -374,3 +374,5 @@ create table llx_facture_fourn_extrafields import_key varchar(14) -- import key ) ENGINE=innodb; ALTER TABLE llx_facture_fourn_extrafields ADD INDEX idx_facture_fourn_extrafields (fk_object); + +ALTER TABLE llx_user_clicktodial ADD COLUMN url varchar(255) AFTER fk_user; From cc500cceba677a430240a69cb17bf670a1c1cee6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 May 2013 22:39:31 +0200 Subject: [PATCH 41/52] Fix: form into table is not W3C (broken with some uncommon browsers). --- htdocs/adherents/admin/mailman.php | 30 +++++++------- htdocs/adherents/admin/spip.php | 1 + htdocs/core/lib/admin.lib.php | 63 ++++++++++++++++------------- htdocs/langs/fr_FR/mailmanspip.lang | 4 +- htdocs/langs/fr_FR/members.lang | 2 +- 5 files changed, 54 insertions(+), 46 deletions(-) diff --git a/htdocs/adherents/admin/mailman.php b/htdocs/adherents/admin/mailman.php index 29b2099ccfc..9e0b859db67 100644 --- a/htdocs/adherents/admin/mailman.php +++ b/htdocs/adherents/admin/mailman.php @@ -51,14 +51,17 @@ $testunsubscribeemail = GETPOST("testunsubscribeemail"); // Action mise a jour ou ajout d'une constante if ($action == 'update' || $action == 'add') { - $constname=GETPOST("constname"); - $constvalue=GETPOST("constvalue"); - $consttype=GETPOST("consttype"); - $constnote=GETPOST("constnote"); - $res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity); - - if (! $res > 0) $error++; - + foreach($_POST['constname'] as $key => $val) + { + $constname=$_POST["constname"][$key]; + $constvalue=$_POST["constvalue"][$key]; + $consttype=$_POST["consttype"][$key]; + $constnote=$_POST["constnote"][$key]; + $res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity); + + if (! $res > 0) $error++; + } + if (! $error) { $mesg = '
'.$langs->trans("SetupSaved").'
'; @@ -159,9 +162,6 @@ dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user'); dol_htmloutput_mesg($mesg); -/* - * Mailman - */ $var=!$var; if (! empty($conf->global->ADHERENT_USE_MAILMAN)) { @@ -180,6 +180,8 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN)) print_fiche_titre($langs->trans('MailmanTitle'), $lien,''); + print '
'; + // JQuery activity print ''; - form_constantes($constantes); + form_constantes($constantes,1); print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'
'; print '%LISTE%, %MAILMAN_ADMINPW%, %EMAIL%
'; @@ -217,12 +219,12 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN)) print '
'; print ''; print $langs->trans("TestSubscribe").'
'; - print $langs->trans("EMail").'
'; + print $langs->trans("EMail").'
'; print '
'; print '
'; print ''; print $langs->trans("TestUnSubscribe").'
'; - print $langs->trans("EMail").'
'; + print $langs->trans("EMail").'
'; print '
'; } diff --git a/htdocs/adherents/admin/spip.php b/htdocs/adherents/admin/spip.php index abc795bcce2..9bbb95c2697 100644 --- a/htdocs/adherents/admin/spip.php +++ b/htdocs/adherents/admin/spip.php @@ -139,6 +139,7 @@ if (! empty($conf->global->ADHERENT_USE_SPIP)) ); print_fiche_titre($langs->trans('SPIPTitle'), $lien, ''); + print '
'; form_constantes($constantes); print '
'; } diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 0d4bbcf6d7a..434ffc7d7fb 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1001,20 +1001,22 @@ function complete_dictionnary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsq * Show array with constants to edit * * @param array $tableau Array of constants + * @param int $strictw3c Respect W3C (no form into table) * @return void */ -function form_constantes($tableau) +function form_constantes($tableau,$strictw3c=0) { global $db,$bc,$langs,$conf,$_Avery_Labels; $form = new Form($db); + if (! empty($strictw3c)) print "\n".'
'; + print ''; print ''; print ''; print ''; - print ''; - print ''; + if (empty($strictw3c)) print ''; print "\n"; $var=true; @@ -1044,17 +1046,17 @@ function form_constantes($tableau) $obj = (object) array('rowid'=>'','name'=>'','value'=>'','type'=>'','note'=>''); } - print "\n".''; + if (empty($strictw3c)) print "\n".''; print ""; - // Affiche nom constante + // Show constant print '\n"; + // Value if ($const == 'ADHERENT_CARD_TYPE' || $const == 'ADHERENT_ETIQUETTE_TYPE') { print ''; } else { print ''; } - print '"; - print "\n"; - print "\n"; + // Submit + if (empty($strictw3c)) + { + print '"; + } + print "\n"; + if (empty($strictw3c)) print "\n"; } } print '
'.$langs->trans("Description").''.$langs->trans("Value").'* '.$langs->trans("Action").''.$langs->trans("Action").'
'; print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print $langs->trans('Desc'.$const); @@ -1077,6 +1079,7 @@ function form_constantes($tableau) print "'; @@ -1087,55 +1090,57 @@ function form_constantes($tableau) { $arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name']; } - print $form->selectarray('constvalue',$arrayoflabels,($obj->value?$obj->value:'CARD'),1,0,0); - print ''; + print $form->selectarray('constvalue'.(empty($strictw3c)?'':'[]'),$arrayoflabels,($obj->value?$obj->value:'CARD'),1,0,0); print ''; print ''; - //print 'aa'.$const; if (in_array($const,array('ADHERENT_CARD_TEXT','ADHERENT_CARD_TEXT_RIGHT','ADHERENT_ETIQUETTE_TEXT'))) { - print '\n"; - print ''; print ''; } else if (in_array($const,array('ADHERENT_AUTOREGISTER_NOTIF_MAIL','ADHERENT_AUTOREGISTER_MAIL','ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL'))) { require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('constvalue_'.$const,$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,5,60); + $doleditor=new DolEditor('constvalue_'.$const.(empty($strictw3c)?'':'[]'),$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,5,60); $doleditor->Create(); - - print ''; - print ''; + print ''; } else if ($obj->type == 'yesno') { - print $form->selectyesno('constvalue',$obj->value,1); - print ''; - print ''; + print $form->selectyesno('constvalue'.(empty($strictw3c)?'':'[]'),$obj->value,1); + print ''; } else { - print ''; - print ''; - print ''; + print ''; + print ''; } print ''; - print '  '; - // print ''.img_delete().''; - print "
'; + print ''; + print "
'; + + if (! empty($strictw3c)) + { + print '
'; + print "\n"; + } } diff --git a/htdocs/langs/fr_FR/mailmanspip.lang b/htdocs/langs/fr_FR/mailmanspip.lang index 3f27ae0d9c9..1118fbbff90 100644 --- a/htdocs/langs/fr_FR/mailmanspip.lang +++ b/htdocs/langs/fr_FR/mailmanspip.lang @@ -1,6 +1,6 @@ # Dolibarr language file - fr_FR - mailmanspip CHARSET=UTF-8 -MailmanTitle=Système de listes de diffusion Mailman +MailmanTitle=Interfacer avec le système de listes de diffusion Mailman MailmanSpipSetup=Configuration du module Mailman et SPIP TestSubscribe=Pour tester l'inscription aux listes mailman TestUnSubscribe=Pour tester la désincritpion aux listes mailman @@ -11,7 +11,7 @@ SynchroSpipEnabled=Une alimentation de Spip sera réalisée DescADHERENT_MAILMAN_ADMINPW=Mot de passe administrateur Mailman DescADHERENT_MAILMAN_URL=URL d'inscription aux listes Mailman DescADHERENT_MAILMAN_UNSUB_URL=URL de désinscription aux listes Mailman -SPIPTitle=Gestion de contenu SPIP +SPIPTitle=Interfacer avec le sytème de gestion de contenu SPIP DescADHERENT_SPIP_SERVEUR=Serveur SPIP DescADHERENT_SPIP_DB=Nom base SPIP DescADHERENT_SPIP_USER=Login connexion base SPIP diff --git a/htdocs/langs/fr_FR/members.lang b/htdocs/langs/fr_FR/members.lang index 5cd7890df1e..7f30ddd3fd5 100644 --- a/htdocs/langs/fr_FR/members.lang +++ b/htdocs/langs/fr_FR/members.lang @@ -153,7 +153,7 @@ DescADHERENT_CARD_HEADER_TEXT=Texte imprimé sur le haut des cartes d'adhérent DescADHERENT_CARD_TEXT=Texte imprimé sur les cartes d'adhérent (Aligné à gauche) DescADHERENT_CARD_TEXT_RIGHT=Texte imprimé sur les cartes d'adhérent (Aligné à droite) DescADHERENT_CARD_FOOTER_TEXT=Texte imprimé sur le bas des cartes d'adhérent -DescADHERENT_MAILMAN_LISTS=Liste(s) à la quelle (auxquelles) inscrire les nouveaux adhérents (séparés par une virgule) +DescADHERENT_MAILMAN_LISTS=Liste(s) à la quelle (auxquelles) inscrire automatiquement les adhérents validés (séparés par une virgule) GlobalConfigUsedIfNotDefined=Le texte défini dans la configuration du module Adhérent sera utilisé si cette valeur est non définie ici. MayBeOverwrited=Cette valeur peut être écrasée par le texte défini au niveau du type d'adhérent ShowTypeCard=Voir type '%s' From e5ef27b168c586f9787e0285a813e09395819ebc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 May 2013 22:43:01 +0200 Subject: [PATCH 42/52] Fix: no underline onto link that are disabled. --- htdocs/theme/eldy/style.css.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 39a9292531c..b5b380f5158 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -514,6 +514,7 @@ a.tmenudisabled:link, a.tmenudisabled:visited, a.tmenudisabled:hover, a.tmenudis cursor: not-allowed; font-weight: normal; white-space: nowrap; + text-decoration: none; } a.tmenu:link, a.tmenu:visited, a.tmenu:hover, a.tmenu:active { From a4e8e8eb4bcf30a1966b2a44e8e386781fa7be6e Mon Sep 17 00:00:00 2001 From: fhenry Date: Fri, 10 May 2013 12:03:27 +0200 Subject: [PATCH 43/52] Add fecth extrafield into fetch user class --- htdocs/user/class/user.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 0d50e08e0fd..32dafcef617 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -219,6 +219,15 @@ class User extends CommonObject $this->contact_id = $obj->fk_socpeople; $this->fk_member = $obj->fk_member; $this->fk_user = $obj->fk_user; + + // Retreive all extrafield for thirdparty + // fetch optionals attributes and labels + require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); + $extrafields=new ExtraFields($this->db); + $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); + if (count($extralabels)>0) { + $this->fetch_optionals($this->id,$extralabels); + } $this->db->free($result); } From 9b30f116f11250762f22a6031d1e47cc3d2f29fb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 May 2013 12:48:11 +0200 Subject: [PATCH 44/52] Fix: Some lib missing when jmobile enabled. --- htdocs/categories/fiche.php | 2 +- htdocs/core/class/html.formother.class.php | 24 +++++++++++++--------- htdocs/main.inc.php | 8 +++++++- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index 34a036156a3..c97d023f5b8 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -211,7 +211,7 @@ if ($user->rights->categorie->creer) // Ref print ''; - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print''; // Description diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index c87f2df36dd..c3157c07124 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -1004,11 +1004,13 @@ class FormOther } } - $emptybox->box_id='A'; - $emptybox->info_box_head=array(); - $emptybox->info_box_contents=array(); - $emptybox->showBox(array(),array()); - + if (empty($conf->browser->phone)) + { + $emptybox->box_id='A'; + $emptybox->info_box_head=array(); + $emptybox->info_box_contents=array(); + $emptybox->showBox(array(),array()); + } print "\n"; print "\n"; @@ -1033,11 +1035,13 @@ class FormOther } } - $emptybox->box_id='B'; - $emptybox->info_box_head=array(); - $emptybox->info_box_contents=array(); - $emptybox->showBox(array(),array()); - + if (empty($conf->browser->phone)) + { + $emptybox->box_id='B'; + $emptybox->info_box_head=array(); + $emptybox->info_box_contents=array(); + $emptybox->showBox(array(),array()); + } print "\n"; print "\n"; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 6e03a9ac2ce..6bee9a606ca 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -984,7 +984,10 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs if (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || ! empty($conf->dol_use_jmobile)) { print ''."\n"; - } + //$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); + print ''."\n"; + } + } print ''."\n"; @@ -1148,6 +1151,9 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs if (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || (! empty($conf->dol_use_jmobile) && $conf->dol_use_jmobile > 0)) { print ''."\n"; + //$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); + print ''."\n"; + print ''."\n"; } } From 9427e32e2ed54c1a2bc519a88c057207836df489 Mon Sep 17 00:00:00 2001 From: fhenry Date: Fri, 10 May 2013 15:04:16 +0200 Subject: [PATCH 45/52] Fix security breach (SQL injection) --- htdocs/adherents/fiche.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index 02e0af3a768..57aa72e70ca 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -958,10 +958,11 @@ else $adht = new AdherentType($db); $adht->fetch($object->typeid); + $country=GETPOST('pays','int'); // We set country_id, and country_code, country of the chosen country - if (isset($_POST["pays"]) || $object->country_id) + if (!empty($country) || $object->country_id) { - $sql = "SELECT rowid, code, libelle as label from ".MAIN_DB_PREFIX."c_pays where rowid = ".(isset($_POST["pays"])?$_POST["pays"]:$object->country_id); + $sql = "SELECT rowid, code, libelle as label from ".MAIN_DB_PREFIX."c_pays where rowid = ".(!empty($country)?$country:$object->country_id); $resql=$db->query($sql); if ($resql) { From 0a26be3f04559f5f49a9b84d3cfefa9adf256478 Mon Sep 17 00:00:00 2001 From: fhenry Date: Fri, 10 May 2013 15:11:49 +0200 Subject: [PATCH 46/52] Fix security leak --- htdocs/adherents/fiche.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index 52f2c3fb13e..05833bbce10 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -931,9 +931,10 @@ else $adht->fetch($object->typeid); // We set country_id, and country_code, country of the chosen country - if (isset($_POST["country"]) || $object->country_id) + $country=GETPOST('country','int'); + if (!empty($country) || $object->country_id) { - $sql = "SELECT rowid, code, libelle as label from ".MAIN_DB_PREFIX."c_pays where rowid = ".(isset($_POST["country"])?$_POST["country"]:$object->country_id); + $sql = "SELECT rowid, code, libelle as label from ".MAIN_DB_PREFIX."c_pays where rowid = ".(!empty($country)?$country:$object->country_id); $resql=$db->query($sql); if ($resql) { From aab3e0a8a5e2d886bbbfc08a1930d3d81a1fd733 Mon Sep 17 00:00:00 2001 From: fhenry Date: Fri, 10 May 2013 15:33:28 +0200 Subject: [PATCH 47/52] Fix Extrafield problem on propal pages --- htdocs/comm/propal.php | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 9cde868a97a..075c3879aa1 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1837,30 +1837,56 @@ else if ($action == 'edit_extras') { - print ''; print '
'; print ''; print ''; print ''; - print ''; } - print $object->showOptionals($extrafields,'edit'); + foreach($extrafields->attribute_label as $key=>$label) + { + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); + if ($extrafields->attribute_type[$key] == 'separate') + { + print $extrafields->showSeparator($key); + } + else + { + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''."\n"; + } + } if(count($extrafields->attribute_label) > 0) { if ($action == 'edit_extras' && $user->rights->propal->creer) { - print ''; - print '
'; + // Convert date into timestamp format + if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) + { + $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key]; + } + + if ($action == 'edit_extras' && $user->rights->propal->creer) + { + print $extrafields->showInputField($key,$value); + } + else + { + print $extrafields->showOutputField($key,$value); + } + print '
'; + print '
'; print ''; + print ''; print '
'; - print ''; + } else { if ($object->statut == 0 && $user->rights->propal->creer) { - print ''; + print ''; } } } @@ -1923,6 +1949,7 @@ else include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; } + /* * Lines */ From cdc1e55b26df20950338ad494c56232309b4dc6f Mon Sep 17 00:00:00 2001 From: fhenry Date: Fri, 10 May 2013 15:39:54 +0200 Subject: [PATCH 48/52] Fix bug on Extrafield order and propal --- htdocs/comm/propal.php | 1 - htdocs/commande/fiche.php | 112 +++++++++++++++++++++++--------------- 2 files changed, 67 insertions(+), 46 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 075c3879aa1..0c95d919d2f 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1834,7 +1834,6 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - if ($action == 'edit_extras') { print '
'; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 99168cdc6a0..a7d04670961 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1,34 +1,34 @@ * Copyright (C) 2004-2013 Laurent Destailleur - * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2013 Regis Houssin - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2011 Philippe Grand - * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2012 Marcos García - * Copyright (C) 2013 Florian Henry - * - * 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +* Copyright (C) 2005 Marc Barilley / Ocebo +* Copyright (C) 2005-2013 Regis Houssin +* Copyright (C) 2006 Andre Cianfarani +* Copyright (C) 2010-2013 Juanjo Menent +* Copyright (C) 2011 Philippe Grand +* Copyright (C) 2012 Christophe Battarel +* Copyright (C) 2012 Marcos García +* Copyright (C) 2013 Florian Henry +* +* 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 +* the Free Software Foundation; either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ /** * \file htdocs/commande/fiche.php - * \ingroup commande - * \brief Page to show customer order - */ +* \ingroup commande +* \brief Page to show customer order +*/ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; @@ -2135,34 +2135,56 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { + if ($action == 'edit_extras') + { + print ''; + print ''; + print ''; + print ''; + } + + foreach($extrafields->attribute_label as $key=>$label) + { + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); + if ($extrafields->attribute_type[$key] == 'separate') + { + print $extrafields->showSeparator($key); + } + else + { + print '
attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''."\n"; + } + } + if(count($extrafields->attribute_label) > 0) { - if ($action == 'edit_extras') + if ($action == 'edit_extras' && $user->rights->commande->creer) { - print ''; - print ''; - print ''; - print ''; - } - - - if ($action == 'edit_extras' && $user->rights->propal->creer) { - print $object->showOptionals($extrafields,'edit'); - } - else { - print $object->showOptionals($extrafields); - } - - if ($action == 'edit_extras' && $user->rights->propal->creer) - { - print ''; } else { - if ($object->statut == 0 && $user->rights->propal->creer) + if ($object->statut == 0 && $user->rights->commande->creer) { print ''; } @@ -2320,7 +2342,7 @@ else if ($object->statut > 0 && $object->statut < 3 && $object->getNbOfProductsLines() > 0) { if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) - || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer)) + || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer)) { if ($user->rights->expedition->creer) { From b2a4f5d1bb01a462ceda1664ea7b7dd55ce64a32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Wed, 8 May 2013 17:23:41 +0200 Subject: [PATCH 49/52] Typo in skeleton module class --- dev/skeletons/modMyModule.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index 4bb936ba339..17fa97ec523 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -176,7 +176,7 @@ class modMyModule extends DolibarrModules // Main menu entries - $this->menus = array(); // List of menus to add + $this->menu = array(); // List of menus to add $r=0; // Add here entries to declare new menus From fa4fc8495b6f4ae12ad6c6d939c35354498a45d7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 May 2013 02:12:34 +0200 Subject: [PATCH 50/52] Fix: Missing translation key Fix: Minor css style missing Fix: Create draft proposal return error if no contact defined. Fix: W3C --- htdocs/comm/propal.php | 3 +- htdocs/comm/propal/class/propal.class.php | 5 +- htdocs/core/search_page.php | 2 +- .../core/tpl/freeproductline_create.tpl.php | 134 +++++++++--------- .../tpl/predefinedproductline_create.tpl.php | 38 ++--- htdocs/langs/en_US/errors.lang | 1 + htdocs/langs/fr_FR/errors.lang | 1 + htdocs/theme/cameleo/style.css.php | 9 +- htdocs/theme/eldy/style.css.php | 2 +- 9 files changed, 100 insertions(+), 95 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 9cde868a97a..b41311c3458 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -351,7 +351,7 @@ else if ($action == 'add' && $user->rights->propal->creer) if ($id > 0) { // Insertion contact par defaut si defini - if (GETPOST('contactidp')) + if (GETPOST('contactidp') > 0) { $result=$object->add_contact(GETPOST('contactidp'),'CUSTOMER','external'); if ($result < 0) @@ -1347,6 +1347,7 @@ if ($action == 'create') $numprojet=select_projects($soc->id,$projectid); if ($numprojet==0) { + $langs->load("projects"); print '   '.$langs->trans("AddProject").''; } print ''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index dc2c708cbec..7dc63fdace9 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -648,8 +648,7 @@ class Propal extends CommonObject dol_syslog(get_class($this)."::create"); // Check parameters - $soc = new Societe($this->db); - $result=$soc->fetch($this->socid); + $result=$this->fetch_thirdparty(); if ($result < 0) { $this->error="Failed to fetch company"; @@ -670,8 +669,6 @@ class Propal extends CommonObject $this->db->begin(); - $this->fetch_thirdparty(); - // Insert into database $sql = "INSERT INTO ".MAIN_DB_PREFIX."propal ("; $sql.= "fk_soc"; diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php index cf44cccce2b..1ea6138873e 100644 --- a/htdocs/core/search_page.php +++ b/htdocs/core/search_page.php @@ -102,7 +102,7 @@ else $searchform=$hookmanager->resPrint; print "\n"; print "\n"; -print '
'; +print '
'; print ''; //print '
'; print '
'."\n"; diff --git a/htdocs/core/tpl/freeproductline_create.tpl.php b/htdocs/core/tpl/freeproductline_create.tpl.php index ad0b0eeb426..328b8d9a69b 100644 --- a/htdocs/core/tpl/freeproductline_create.tpl.php +++ b/htdocs/core/tpl/freeproductline_create.tpl.php @@ -30,6 +30,13 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob ?> + +
"> + + + +
-"> - - - - - > - global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>> - > + global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>> + '; echo $form->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1); @@ -90,66 +91,69 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob $doleditor=new DolEditor('dp_desc',GETPOST('dp_desc'),'',100,'dolibarr_details','',false,true,$enabled,$nbrows,70); $doleditor->Create(); ?> - + - - - - - - - global->DISPLAY_MARGIN_RATES)) $colspan++; - if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; - } - ?> - - - - service->enabled) && $dateSelector) - { - if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) $colspan = 10; - else $colspan = 9; - - if (! empty($usemargins)) - { - $colspan++; // For the buying price - if($conf->global->DISPLAY_MARGIN_RATES) $colspan++; - if($conf->global->DISPLAY_MARK_RATES) $colspan++; - } + > - + + + + + - - + global->DISPLAY_MARGIN_RATES)) $colspan++; + if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; + } + ?> + + + +service->enabled) && $dateSelector) +{ + if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) $colspan = 10; + else $colspan = 9; + + if (! empty($usemargins)) + { + $colspan++; // For the buying price + if($conf->global->DISPLAY_MARGIN_RATES) $colspan++; + if($conf->global->DISPLAY_MARK_RATES) $colspan++; + } +?> + +> + + + \ No newline at end of file diff --git a/htdocs/core/tpl/predefinedproductline_create.tpl.php b/htdocs/core/tpl/predefinedproductline_create.tpl.php index ae8491784e6..b435d40be64 100644 --- a/htdocs/core/tpl/predefinedproductline_create.tpl.php +++ b/htdocs/core/tpl/predefinedproductline_create.tpl.php @@ -32,6 +32,21 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob +"> + + + + + + + global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="4"' : ' colspan="3"'); ?>> ">  -"> - - - - - - > global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="4"' : ' colspan="3"'); ?>> Create(); ?> - - + + global->DISPLAY_MARK_RATES)) $colspan++; ?> service->enabled) && $dateSelector) if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; } ?> + >
'.img_picto('','edit').' '.$langs->trans('Modify').'
'.img_picto('','edit').' '.$langs->trans('Modify').'
'; + // Convert date into timestamp format + if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) + { + $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key]; + } + + if ($action == 'edit_extras' && $user->rights->commande->creer) + { + print $extrafields->showInputField($key,$value); + } + else + { + print $extrafields->showOutputField($key,$value); + } + print '
'; + print '
'; print ''; print ''; print '
'.img_picto('','edit').' '.$langs->trans('Modify').'
global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
margin->enabled) && ! empty($object->element) && in_array($ob
 
tva_assuj == "0") echo '0'; - else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?$_POST["tva_tx"]:-1), $seller, $buyer); - ?> - "> - ">%"> -
tva_assuj == "0") echo '0'; + else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?$_POST["tva_tx"]:-1), $seller, $buyer); ?> -
element) && $object->element == 'contrat') - { - print $langs->trans("DateStartPlanned").' '; - $form->select_date('',"date_start_sl",$usehm,$usehm,1,"addline_sl"); - print '   '.$langs->trans("DateEndPlanned").' '; - $form->select_date('',"date_end_sl",$usehm,$usehm,1,"addline_sl"); - } - else - { - echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; - echo $form->select_date('','date_start',empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,1,"addproduct"); - echo ' '.$langs->trans('to').' '; - echo $form->select_date('','date_end',empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,1,"addproduct"); - } + "> + ">%">
element) && $object->element == 'contrat') + { + print $langs->trans("DateStartPlanned").' '; + $form->select_date('',"date_start_sl",$usehm,$usehm,1,"addline_sl"); + print '   '.$langs->trans("DateEndPlanned").' '; + $form->select_date('',"date_end_sl",$usehm,$usehm,1,"addline_sl"); + } + else + { + echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; + echo $form->select_date('','date_start',empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,1,"addproduct"); + echo ' '.$langs->trans('to').' '; + echo $form->select_date('','date_end',empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,1,"addproduct"); + } + ?> +
%% - - "> + + ">
; text-align: ; } th.liste_titre, td.liste_titre { padding-left: 6px; padding-right: 6px; - /*vertical-align: text-top;*/ + white-space: ; } th.liste_titre_sel, td.liste_titre_sel { background-position: top right; color: #A51B00; font-weight: bold; - white-space: nowrap; + white-space: ; } input.liste_titre { diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index b5b380f5158..1fbca3e51a0 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -238,7 +238,7 @@ input, input.flat, textarea, textarea.flat, form.flat select, select.flat { background: #FDFDFD; border: 1px solid #C0C0C0; - padding: 1px 1px 1px 1px; + /*padding: 1px 1px 1px 1px; */ margin: 0px 0px 0px 0px; } From 526a80dd202bbca396687a502d52c27e06e97fff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 May 2013 15:04:17 +0200 Subject: [PATCH 51/52] Sec: Param not escaped Fix: Bad return error --- htdocs/core/lib/barcode.lib.php | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/htdocs/core/lib/barcode.lib.php b/htdocs/core/lib/barcode.lib.php index f83ea5f433c..67b51748d3e 100644 --- a/htdocs/core/lib/barcode.lib.php +++ b/htdocs/core/lib/barcode.lib.php @@ -74,11 +74,11 @@ function barcode_print($code, $encoding="ANY", $scale = 2 ,$mode = "png") dol_syslog("barcode.lib.php::barcode_print $code $encoding $scale $mode"); $bars=barcode_encode($code,$encoding); - - if (! $bars) + if (! $bars || ! empty($bars['error'])) { // DOLCHANGE LDR Return error message instead of array - $error='Bad Value '.$code.' for encoding '.$encoding; + if (empty($bars['error'])) $error='Bad Value '.$code.' for encoding '.$encoding; + else $error=$bars['error']; dol_syslog('barcode.lib.php::barcode_print '.$error, LOG_ERR); return $error; } @@ -133,7 +133,7 @@ function barcode_encode($code,$encoding) dol_syslog("barcode.lib.php::barcode_encode Use barcode_encode_ean"); $bars=barcode_encode_ean($code, $encoding); } - else if (file_exists($genbarcode_loc)) + else if (file_exists($genbarcode_loc)) // For example C39 { /* use genbarcode */ dol_syslog("barcode.lib.php::barcode_encode Use genbarcode ".$genbarcode_loc." code=".$code." encoding=".$encoding); @@ -252,10 +252,11 @@ function barcode_encode_genbarcode($code,$encoding) $code=preg_replace("/[\\\|]/", "_", $code); $command=escapeshellarg($genbarcode_loc); - $paramclear=" \"".str_replace("\"", "\\\"",$code)."\" \"".str_replace("\"", "\\\"",strtoupper($encoding))."\""; - + //$paramclear=" \"".str_replace("\"", "\\\"",$code)."\" \"".str_replace("\"", "\\\"",strtoupper($encoding))."\""; + $paramclear=" ".escapeshellarg($code)." ".escapeshellarg(strtoupper($encoding)); + $fullcommandclear=$command." ".$paramclear." 2>&1"; - //print $fullcommandclear."
\n"; + //print $fullcommandclear."
\n";exit; dol_syslog("Run command ".$fullcommandclear); $fp=popen($fullcommandclear, "r"); @@ -273,14 +274,20 @@ function barcode_encode_genbarcode($code,$encoding) } //var_dump($bars); $ret=array( - "encoding" => trim($encoding), "bars" => trim($bars), - "text" => trim($text) + "text" => trim($text), + "encoding" => trim($encoding), + "error" => "" ); //var_dump($ret); - if (!$ret['encoding']) return false; + if (preg_match('/permission denied/i',$ret['bars'])) + { + $ret['error']=$ret['bars']; $ret['bars']=''; + return $ret; + } if (!$ret['bars']) return false; if (!$ret['text']) return false; + if (!$ret['encoding']) return false; return $ret; } From 8a90598b23e1b2689848187941f7a96b04907005 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 May 2013 15:12:42 +0200 Subject: [PATCH 52/52] Fix: Escape entities --- htdocs/core/lib/functions.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 71dbfbc1b2b..bacda98845d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2100,10 +2100,10 @@ function dol_print_error($db='',$error='') $out.="".$langs->trans("PHP").": ".phpversion()."
\n"; //phpinfo(); // This is to show location of php.ini file } - $out.="".$langs->trans("Server").": ".$_SERVER["SERVER_SOFTWARE"]."
\n";; + $out.="".$langs->trans("Server").": ".$_SERVER["SERVER_SOFTWARE"]."
\n"; $out.="
\n"; - $out.="".$langs->trans("RequestedUrl").": ".$_SERVER["REQUEST_URI"]."
\n";; - $out.="".$langs->trans("Referer").": ".(isset($_SERVER["HTTP_REFERER"])?$_SERVER["HTTP_REFERER"]:'')."
\n";; + $out.="".$langs->trans("RequestedUrl").": ".dol_htmlentities($_SERVER["REQUEST_URI"],ENT_COMPAT,'UTF-8')."
\n"; + $out.="".$langs->trans("Referer").": ".(isset($_SERVER["HTTP_REFERER"])?dol_htmlentities($_SERVER["HTTP_REFERER"],ENT_COMPAT,'UTF-8'):'')."
\n"; $out.="".$langs->trans("MenuManager").": ".$conf->top_menu."
\n"; $out.="
\n"; $syslog.="url=".$_SERVER["REQUEST_URI"];