From 7e0b500d75e0f7c43e7915dd456cab14a590bde1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Aug 2012 03:57:55 +0200 Subject: [PATCH 01/40] Update doc --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index f9ef57c2d07ef..63572dbd95c0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,9 @@ English Dolibarr ChangeLog - Fix: Allows to use a comma decimal separator in supplier invoices payments. - Fix: Translation for tr_TR, es_ES, pt_BR. - Fix: Products with no prices not visible. +- Fix: Access to product card created with very old version of Dolibarr. +- Fix: Delete temporary files after validating an invoice. +- Fix: preview of supplier order and invoice template. From ff2dc246eb75e5f7319185c2f446f380a7a7f2eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Aug 2012 13:02:44 +0200 Subject: [PATCH 02/40] Update pad files --- build/pad/DoliWamp.pml | 2 +- build/pad/Dolibarr.pml | 2 +- build/pad/pad_dolibarr.xml | 6 +++--- build/pad/pad_doliwamp.xml | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build/pad/DoliWamp.pml b/build/pad/DoliWamp.pml index 6173d13eb8d46..85ce4490c41d6 100644 --- a/build/pad/DoliWamp.pml +++ b/build/pad/DoliWamp.pml @@ -4,7 +4,7 @@ DoliWamp - 3.2..0 + 3.2.1 05 10 2012 diff --git a/build/pad/Dolibarr.pml b/build/pad/Dolibarr.pml index 7656ab96a220c..a52f8dc1d7665 100644 --- a/build/pad/Dolibarr.pml +++ b/build/pad/Dolibarr.pml @@ -4,7 +4,7 @@ Dolibarr - 3.2.0 + 3.2.1 05 10 2012 diff --git a/build/pad/pad_dolibarr.xml b/build/pad/pad_dolibarr.xml index 8b85e501dd7f0..32cbc5f923345 100644 --- a/build/pad/pad_dolibarr.xml +++ b/build/pad/pad_dolibarr.xml @@ -34,9 +34,9 @@ Dolibarr - 3.2.0 - 06 - 18 + 3.2.1 + 08 + 10 2012 diff --git a/build/pad/pad_doliwamp.xml b/build/pad/pad_doliwamp.xml index 84f9d2eee9655..1060275c53581 100644 --- a/build/pad/pad_doliwamp.xml +++ b/build/pad/pad_doliwamp.xml @@ -34,9 +34,9 @@ DoliWamp - 3.2.0 - 06 - 18 + 3.2.1 + 08 + 10 2012 From 78a26d61ad80e45599f8fea70dd8afc31b503fe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Tue, 14 Aug 2012 09:57:03 +0200 Subject: [PATCH 03/40] Fixed bug #485 Merged patch from J. Fernando Lagrange (lowmemory) https://doliforge.org/tracker/?func=detail&aid=485&atid=246&group_id=144 --- htdocs/public/members/new.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index a20fb716f6eb9..561a06db79bf0 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -3,6 +3,7 @@ * Copyright (C) 2001-2002 Jean-Louis Bergamo * Copyright (C) 2006-2011 Laurent Destailleur * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2012 J. Fernando Lagrange * * 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 @@ -537,6 +538,10 @@ function initturnover() { { // $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount $amount=0; + if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { + $amount=$conf->global->MEMBER_NEWFORM_AMOUNT; + } + if (! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { $amount=GETPOST('amount')?GETPOST('amount'):$conf->global->MEMBER_NEWFORM_AMOUNT; From cb1e1be0d3714232fd44fc5caabc0949dd6d417f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Tue, 14 Aug 2012 11:06:16 +0200 Subject: [PATCH 04/40] Missing changelog entry --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 63572dbd95c0d..a50bc23430b8f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,7 +21,7 @@ English Dolibarr ChangeLog - Fix: Access to product card created with very old version of Dolibarr. - Fix: Delete temporary files after validating an invoice. - Fix: preview of supplier order and invoice template. - +- Fix: [ bug #485 ] Configurated amount for public auto-subscription form is not taken into account ***** ChangeLog for 3.2.0 compared to 3.1.3 ***** From 640f001bbad43d079b4a270158e5e0b91d657800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Tue, 14 Aug 2012 16:30:16 +0200 Subject: [PATCH 05/40] Propal stats weren't showing average total for more than 1 year Conflicts: htdocs/comm/propal/stats/index.php htdocs/core/class/stats.class.php --- htdocs/comm/propal/stats/index.php | 16 +++------ htdocs/core/class/stats.class.php | 53 ++++++++++++++++++++++++++++-- 2 files changed, 54 insertions(+), 15 deletions(-) diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index ea786ed80c79d..8e96c9982cfc2 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -1,7 +1,8 @@ * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 Marcos García * * 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 @@ -66,7 +67,6 @@ // Build graphic number of object $data = $stats->getNbByMonthWithPrevYear($endyear,$startyear); -//var_dump($data); // $data = array(array('Lib',val1,val2,val3),...) @@ -110,7 +110,6 @@ // Build graphic amount of object $data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear); -//var_dump($data); // $data = array(array('Lib',val1,val2,val3),...) if (!$user->rights->societe->client->voir || $user->societe_id) @@ -151,13 +150,7 @@ $px2->draw($filenameamount,$fileurlamount); } - -$res = $stats->getAverageByMonth($year); -$data = array(); -for ($i = 1 ; $i < 13 ; $i++) -{ - $data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]); -} +$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { @@ -177,8 +170,7 @@ if (! $mesg) { $px3->SetData($data); - //$i=$startyear;$legend=array(); - $i=$endyear;$legend=array(); + $i=$startyear;$legend=array(); while ($i <= $endyear) { $legend[]=$i; diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index f9a0ef83b66e9..7c62d36e5bfed 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -1,6 +1,8 @@ - * Copyright (c) 2008-2012 Laurent Destailleur +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (c) 2008-2012 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2012 Marcos García * * 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 @@ -103,6 +105,42 @@ function getAmountByMonthWithPrevYear($endyear,$startyear) return $data; } + /** + * Return average of entity by month for several years + * + * @param int $endyear Start year + * @param int $startyear End year + * @return array Array of values + */ + function getAverageByMonthWithPrevYear($endyear,$startyear) + { + if ($startyear > $endyear) return -1; + + $datay=array(); + + $year=$startyear; + while($year <= $endyear) + { + $datay[$year] = $this->getAverageByMonth($year); + $year++; + } + + $data = array(); + + for ($i = 0 ; $i < 12 ; $i++) + { + $data[$i][]=$datay[$endyear][$i][0]; + $year=$startyear; + while($year <= $endyear) + { + $data[$i][]=$datay[$year][$i][1]; + $year++; + } + } + + return $data; + } + /** * Return nb of elements by year @@ -295,7 +333,16 @@ function _getAverageByMonth($year, $sql) $res[$i] = $result[$i] + 0; } - return $res; + $data = array(); + + for ($i = 1 ; $i < 13 ; $i++) + { + $month=dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"); + $month=dol_substr($month,0,3); + $data[$i-1] = array(ucfirst($month), $res[$i]); + } + + return $data; } } From f1cbb10edccd3bacd3e622fd375e7a1cf8fa6f24 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 14 Aug 2012 19:52:51 +0200 Subject: [PATCH 06/40] Fix: wrong user count --- htdocs/user/class/user.class.php | 6 +++--- htdocs/user/fiche.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index db53b5252172e..b5337425376df 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1984,10 +1984,10 @@ function getNbOfEMailings() * Return number of existing users * * @param string $limitTo Limit to 'active' or 'superadmin' users - * @param int $all Return for all entities + * @param bool $all Return for all entities * @return int Number of users */ - function getNbOfUsers($limitTo='',$all=0) + function getNbOfUsers($limitTo='active', $all=false) { global $conf; @@ -1999,7 +1999,7 @@ function getNbOfUsers($limitTo='',$all=0) } else { - if ($all) $sql.= " WHERE entity IS NOT NULL"; // all users except superadmin + if ($all) $sql.= " WHERE entity > 0"; // all users except superadmins else $sql.= " WHERE entity = ".$conf->entity; if ($limitTo == 'active') $sql.= " AND statut = 1"; } diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 3c46bd0fdc6fa..7605e58755e44 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -123,7 +123,7 @@ if (!empty($conf->file->main_limit_users)) { - $nb = $edituser->getNbOfUsers("active",1); + $nb = $edituser->getNbOfUsers("active"); if ($nb >= $conf->file->main_limit_users) { $message='
'.$langs->trans("YourQuotaOfUsersIsReached").'
'; @@ -178,7 +178,7 @@ if (! empty($conf->file->main_limit_users)) // If option to limit users is set { - $nb = $edituser->getNbOfUsers("active",1); + $nb = $edituser->getNbOfUsers("active"); if ($nb >= $conf->file->main_limit_users) { $message='
'.$langs->trans("YourQuotaOfUsersIsReached").'
'; From 40660482d4163d20bdc1eeb3371a377a932eb789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Wed, 15 Aug 2012 07:30:28 +0200 Subject: [PATCH 07/40] Fixed more average amount graph stats. They include: * Customer's orders * Supplier's orders * Customer's invoices * Trips and expense Conflicts: htdocs/commande/stats/index.php --- htdocs/commande/stats/index.php | 12 ++++-------- htdocs/compta/deplacement/stats/index.php | 11 +++-------- htdocs/compta/facture/stats/index.php | 11 +++-------- 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 722a8a3f35fe5..f12d5bb309d81 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -1,6 +1,8 @@ * Copyright (c) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 Marcos García * * 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 @@ -168,12 +170,7 @@ } -$res = $stats->getAverageByMonth($year); -$data = array(); -for ($i = 1 ; $i < 13 ; $i++) -{ - $data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]); -} +$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { @@ -193,8 +190,7 @@ if (! $mesg) { $px3->SetData($data); - //$i=$startyear;$legend=array(); - $i=$endyear;$legend=array(); + $i=$startyear;$legend=array(); while ($i <= $endyear) { $legend[]=$i; diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index d07f816f1bc7b..7f4ba7a4681d7 100755 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -1,6 +1,7 @@ * Copyright (c) 2004-2012 Laurent Destailleur + * Copyright (C) 2012 Marcos García * * 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 @@ -137,12 +138,7 @@ } -$res = $stats->getAverageByMonth($year); -$data = array(); -for ($i = 1 ; $i < 13 ; $i++) -{ - $data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]); -} +$res = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { @@ -162,8 +158,7 @@ if (! $mesg) { $px3->SetData($data); - //$i=$startyear;$legend=array(); - $i=$endyear;$legend=array(); + $i = $startyear;$legend=array(); while ($i <= $endyear) { $legend[]=$i; diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 510091c4832aa..36923cdf7caf9 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -1,6 +1,7 @@ * Copyright (c) 2004-2012 Laurent Destailleur + * Copyright (C) 2012 Marcos García * * 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 @@ -148,12 +149,7 @@ } -$res = $stats->getAverageByMonth($year); -$data = array(); -for ($i = 1 ; $i < 13 ; $i++) -{ - $data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]); -} +$res = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { @@ -173,8 +169,7 @@ if (! $mesg) { $px3->SetData($data); - //$i=$startyear;$legend=array(); - $i=$endyear;$legend=array(); + $i = $startyear;$legend=array(); while ($i <= $endyear) { $legend[]=$i; From acb9380f1c0e784e0c8eaef5287d805f5740b7bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Wed, 15 Aug 2012 07:31:55 +0200 Subject: [PATCH 08/40] Fixed a problem with supplier's orders stats They were showing orders even if they were not approved or ordered Conflicts: htdocs/commande/class/commandestats.class.php --- htdocs/commande/class/commandestats.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index e8aa6c6ffea8f..aca6e1a1ab8df 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -1,7 +1,8 @@ * Copyright (c) 2005 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 Marcos García * * 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 @@ -73,7 +74,7 @@ function CommandeStats($db, $socid, $mode, $userid=0) $this->from = MAIN_DB_PREFIX.$object->table_element." as c"; $this->from.= ", ".MAIN_DB_PREFIX."societe as s"; $this->field='total_ht'; - $this->where.= " c.fk_statut > 0"; // Not draft and not cancelled + $this->where.= " c.fk_statut > 2"; // Only approved & ordered } $this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity; From f03e0965e244f8615ded5fff201c88ccc5d5fd4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Wed, 15 Aug 2012 01:20:53 +0200 Subject: [PATCH 09/40] Forgot to rename the variable --- htdocs/compta/deplacement/stats/index.php | 2 +- htdocs/compta/facture/stats/index.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 7f4ba7a4681d7..a5aa5ccf86455 100755 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -138,7 +138,7 @@ } -$res = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); +$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 36923cdf7caf9..9ba9672b17606 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -149,7 +149,7 @@ } -$res = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); +$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { From b2ff7b5ea16753e3278e1b3995f587214d3b99f0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 15 Aug 2012 10:31:45 +0200 Subject: [PATCH 10/40] Fix: limit to products and services --- htdocs/compta/journal/sellsjournal.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 54763392ef741..79a8c154322a6 100755 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -87,16 +87,21 @@ $p = explode(":", $conf->global->MAIN_INFO_SOCIETE_PAYS); $idpays = $p[0]; -$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client , fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,"; -$sql.= " p.accountancy_code_sell, s.code_compta , ct.accountancy_code"; +$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,"; +$sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,"; +$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,"; +$sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,"; +$sql.= " ct.accountancy_code"; $sql.= " FROM ".MAIN_DB_PREFIX."facturedet fd"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product"; $sql.= " JOIN ".MAIN_DB_PREFIX."facture f ON f.rowid = fd.fk_facture"; $sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '".$idpays."'"; -$sql.= " WHERE f.fk_statut > 0 AND f.entity = ".$conf->entity; +$sql.= " WHERE f.entity = ".$conf->entity; +$sql.= " AND f.fk_statut > 0"; +$sql.= " AND fd.product_type IN (0,1)"; if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; -$sql .= " order by f.rowid"; +$sql.= " ORDER BY f.rowid"; $result = $db->query($sql); if ($result) From 2130b9715cfed50a4f5d6d723b8966b39a27a275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Wed, 15 Aug 2012 15:58:36 +0200 Subject: [PATCH 11/40] Missing changelog entry --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index a50bc23430b8f..d70751ecb612f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,7 @@ English Dolibarr ChangeLog - Fix: Delete temporary files after validating an invoice. - Fix: preview of supplier order and invoice template. - Fix: [ bug #485 ] Configurated amount for public auto-subscription form is not taken into account +- Fix: Average amount graphs weren't comparing the previous year stats ***** ChangeLog for 3.2.0 compared to 3.1.3 ***** From 1f9e0d3e0004bf0c780d9d0b4eeeddb48fc4ba0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Fri, 17 Aug 2012 07:05:28 +0200 Subject: [PATCH 12/40] Translated message was generating an incomplete string --- htdocs/product/admin/product_extrafields.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/admin/product_extrafields.php b/htdocs/product/admin/product_extrafields.php index c24782a9396de..711d53424e1cd 100755 --- a/htdocs/product/admin/product_extrafields.php +++ b/htdocs/product/admin/product_extrafields.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2002 Rodolphe Quiedeville * Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2012 Marcos García * * 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 @@ -87,7 +88,7 @@ dol_fiche_head($head, 'attributes', $tab, 0, 'product'); -print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; +print $langs->trans('DefineHereComplementaryAttributes', $tab).'
'."\n"; print '
'; dol_htmloutput_errors($mesg); From 173ff4f92aac3c66b92b732ba1cc509f982d26ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Sat, 18 Aug 2012 07:35:39 +0200 Subject: [PATCH 13/40] Fixed a bug where files were not being uploaded to a project's task Reported by Jose Antonio Garcia in dolibarr.es' forum http://www.dolibarr.es/index.php/foro/7-bugs-versiones-estables/1250-error-subir-archivo-en-una-tarea-de-un-proyecto Conflicts: htdocs/projet/tasks/document.php --- htdocs/projet/tasks/document.php | 107 ++++++++++++++++--------------- 1 file changed, 54 insertions(+), 53 deletions(-) diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 1cb227795de75..af3da6bb41065 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -44,11 +44,11 @@ $withproject=GETPOST('withproject','int'); $project_ref = GETPOST('project_ref','alpha'); -$mesg=''; -if (isset($_SESSION['DolMessage'])) -{ - $mesg=$_SESSION['DolMessage']; - unset($_SESSION['DolMessage']); +$mesg=''; +if (isset($_SESSION['DolMessage'])) +{ + $mesg=$_SESSION['DolMessage']; + unset($_SESSION['DolMessage']); } // Security check @@ -79,6 +79,42 @@ * Actions */ +// Retreive First Task ID of Project if withprojet is on to allow project prev next to work +if (! empty($project_ref) && ! empty($withproject)) +{ + if ($projectstatic->fetch(0,$project_ref) > 0) + { + $tasksarray=$object->getTasksArray(0, 0, $projectstatic->id, $socid, 0); + if (count($tasksarray) > 0) + { + $id=$tasksarray[0]->id; + $object->fetch($id); + } + else + { + Header("Location: ".DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.($withproject?'&withproject=1':'').(empty($mode)?'':'&mode='.$mode)); + exit; + } + } +} + +// Find upload dir after retreive is task if necessary +if ($id > 0 || ! empty($ref)) +{ + if ($object->fetch($id,$ref) > 0) + { + $projectstatic->fetch($object->fk_project); + + if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid); + + $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($projectstatic->ref).'/'.dol_sanitizeFileName($object->ref); + } + else + { + dol_print_error($db); + } +} + // Envoi fichier if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) { @@ -87,16 +123,16 @@ $resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),0,0,$_FILES['userfile']['error']); if (is_numeric($resupload) && $resupload > 0) { - if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1) - { - // Create small thumbs for image (Ratio is near 16/9) - // Used on logon for example - $imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs"); - // Create mini thumbs for image (Ratio is near 16/9) - // Used on menu or for setup page for example - $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); - } - $mesg = '
'.$langs->trans("FileTransferComplete").'
'; + if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1) + { + // Create small thumbs for image (Ratio is near 16/9) + // Used on logon for example + $imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs"); + // Create mini thumbs for image (Ratio is near 16/9) + // Used on menu or for setup page for example + $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); + } + $mesg = '
'.$langs->trans("FileTransferComplete").'
'; } else { @@ -120,49 +156,14 @@ // Delete if ($action=='delete') { - $langs->load("other"); + $langs->load("other"); $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). dol_delete_file($file); $_SESSION['DolMessage'] = '
'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
'; - Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); - exit; -} - -// Retreive First Task ID of Project if withprojet is on to allow project prev next to work -if (! empty($project_ref) && ! empty($withproject)) -{ - if ($projectstatic->fetch(0,$project_ref) > 0) - { - $tasksarray=$object->getTasksArray(0, 0, $projectstatic->id, $socid, 0); - if (count($tasksarray) > 0) - { - $id=$tasksarray[0]->id; - $object->fetch($id); - } - else - { - Header("Location: ".DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.($withproject?'&withproject=1':'').(empty($mode)?'':'&mode='.$mode)); - exit; - } - } + Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); + exit; } -// Find upload dir after retreive is task if necessary -if ($id > 0 || ! empty($ref)) -{ - if ($object->fetch($id,$ref) > 0) - { - $projectstatic->fetch($object->fk_project); - - if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid); - - $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($projectstatic->ref).'/'.dol_sanitizeFileName($object->ref); - } - else - { - dol_print_error($db); - } -} /* * View From 2bd7dc68d327aa0c3108dc874bbb57a73e01a2bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Sat, 18 Aug 2012 05:57:25 +0200 Subject: [PATCH 14/40] Project::setClose wasn't setting the new status --- htdocs/projet/class/project.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 9e47dd845ea4c..fc3f701045404 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -604,6 +604,7 @@ function setClose($user) if (!$error) { + $this->statut = 2; $this->db->commit(); return 1; } From 5f8530d0c0d56190fcfc54a7ca932343bf7c6e3c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 18 Aug 2012 09:01:17 +0200 Subject: [PATCH 15/40] Fix: [ bug #503 ] Unable to delete linked file to a deposit Conflicts: htdocs/compta/paiement/cheque/fiche.php --- htdocs/compta/paiement/cheque/fiche.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/fiche.php index 6c49ce2a58200..82eeb10e6e3eb 100644 --- a/htdocs/compta/paiement/cheque/fiche.php +++ b/htdocs/compta/paiement/cheque/fiche.php @@ -216,6 +216,21 @@ } } +// Remove file in doc form +else if ($action == 'remove_file' && $user->rights->banque->cheque) +{ + $remisecheque = new RemiseCheque($db); + if ($remisecheque->fetch($_GET["id"]) > 0) + { + require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); + + $langs->load("other"); + + $file=$dir.get_exdir($remisecheque->number,2,1) . GETPOST('file'); + $ret=dol_delete_file($file); + } +} + /* * View From 2e38300ec42ab7bd70f1fdb4732aaae7859a149b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 18 Aug 2012 10:16:25 +0200 Subject: [PATCH 16/40] Fix: [ bug #501 ] Error while trying to modify an user --- htdocs/adherents/class/adherent.class.php | 67 +++++++++++++---------- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index bfc17e21f816a..bbf9297917c7e 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -708,36 +708,43 @@ function delete($rowid) $resql=$this->db->query($sql); if ($resql) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent WHERE rowid = ".$rowid; - dol_syslog(get_class($this)."::delete sql=".$sql); - $resql=$this->db->query($sql); - if ($resql) - { - if ($this->db->affected_rows($resql)) - { - // Appel des triggers - include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('MEMBER_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers - - $this->db->commit(); - return 1; - } - else - { - // Rien a effacer - $this->db->rollback(); - return 0; - } - } - else - { - $this->error=$this->db->error(); - $this->db->rollback(); - return -3; - } + // Remove linked user + $ret=$this->setUserId(0); + if ($ret > 0) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent WHERE rowid = ".$rowid; + dol_syslog(get_class($this)."::delete sql=".$sql); + $resql=$this->db->query($sql); + if ($resql) + { + if ($this->db->affected_rows($resql)) + { + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('MEMBER_DELETE',$this,$user,$langs,$conf); + if ($result < 0) { + $error++; $this->errors=$interface->errors; + } + // Fin appel triggers + + $this->db->commit(); + return 1; + } + else + { + // Rien a effacer + $this->db->rollback(); + return 0; + } + } + else + { + $this->error=$this->db->error(); + $this->db->rollback(); + return -3; + } + } } else { From d6f1f870a210178d1d6b1bf39668bb2d76019c4c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 18 Aug 2012 10:51:13 +0200 Subject: [PATCH 17/40] Fix: bad rights --- htdocs/projet/tasks/note.php | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index 11cf96ca9c779..a4984ba140f8c 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -46,17 +46,17 @@ $object = new Task($db); $projectstatic = new Project($db); -if ($id > 0 || ! empty($ref)) -{ - if ($object->fetch($id,$ref) > 0) - { +if ($id > 0 || ! empty($ref)) +{ + if ($object->fetch($id,$ref) > 0) + { $projectstatic->fetch($object->fk_project); - if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid); - } - else - { - dol_print_error($db); - } + if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid); + } + else + { + dol_print_error($db); + } } @@ -78,18 +78,20 @@ } } +$permission=($user->rights->projet->creer || $user->rights->projet->all->creer); + /* * Actions */ -if ($action == 'setnote_public' && $user->rights->ficheinter->creer) +if ($action == 'setnote_public' && ! empty($permission)) { $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); if ($result < 0) dol_print_error($db,$object->error); } -else if ($action == 'setnote_private' && $user->rights->ficheinter->creer) +else if ($action == 'setnote_private' && ! empty($permission)) { $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); if ($result < 0) dol_print_error($db,$object->error); @@ -203,7 +205,6 @@ print '
'; $colwidth=30; - $permission=($user->rights->projet->creer || $user->rights->projet->all->creer); $moreparam=$param; include(DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'); From b2fa4b3f4925f7764f999d40646f214af8012c4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Sat, 18 Aug 2012 18:05:53 +0200 Subject: [PATCH 18/40] Added missing changelog entries --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index d70751ecb612f..ffb4644ff42c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,10 @@ English Dolibarr ChangeLog - Fix: preview of supplier order and invoice template. - Fix: [ bug #485 ] Configurated amount for public auto-subscription form is not taken into account - Fix: Average amount graphs weren't comparing the previous year stats +- Fix: Closed project didn't show the new status unless the page was refreshed +- Fix: Files were not being uploaded to a project's task +- Fix: [ bug #503 ] Unable to delete linked file to a deposit +- Fix: [ bug #501 ] Error while trying to modify an user ***** ChangeLog for 3.2.0 compared to 3.1.3 ***** From 552c82a032bff426926d230e07826a3b91e5ee6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Sun, 19 Aug 2012 03:37:37 +0200 Subject: [PATCH 19/40] Fixed bug #504 https://doliforge.org/tracker/?func=detail&aid=504&atid=246&group_id=144 --- htdocs/product/admin/product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index def73f8b66fee..e618d877a8e4b 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -36,7 +36,7 @@ $langs->load("products"); // Security check -if (! $user->admin || empty($conf->product->enabled)) +if (! $user->admin || (empty($conf->product->enabled) && empty($conf->service->enabled))) accessforbidden(); $action = GETPOST('action','alpha'); From cef55097eae6e8643ef7b972b9ee432200477017 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Aug 2012 00:27:38 +0200 Subject: [PATCH 20/40] Fix: Default value was not defined --- htdocs/install/mysql/data/llx_const.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/data/llx_const.sql b/htdocs/install/mysql/data/llx_const.sql index 18a81459535d5..6590ca83857ca 100644 --- a/htdocs/install/mysql/data/llx_const.sql +++ b/htdocs/install/mysql/data/llx_const.sql @@ -35,6 +35,7 @@ insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_N insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_FEATURES_LEVEL','0','chaine','Level of features to show (0=stable only, 1=stable+experimental, 2=stable+experimental+development',1,0); -- Hidden and common to all entities +insert into llx_const (name, value, type, note, visible, entity) values ('SYSLOG_FILE_ON','1','chaine','Log to file Directory where to write log file',0,0); insert into llx_const (name, value, type, note, visible, entity) values ('SYSLOG_FILE','DOL_DATA_ROOT/dolibarr.log','chaine','Directory where to write log file',0,0); insert into llx_const (name, value, type, note, visible, entity) values ('SYSLOG_LEVEL','7','chaine','Level of debug info to show',0,0); From 6c2d9baeb587e557592aa7c3f9300cca37704268 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 20 Aug 2012 00:34:06 +0200 Subject: [PATCH 21/40] Fix: remove old accountancy code, can cause blank screen --- htdocs/install/mysql/migration/3.1.0-3.2.0.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql index dbfac93b84b32..e21ff76a6a778 100755 --- a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql +++ b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql @@ -456,3 +456,5 @@ ALTER TABLE llx_product_fournisseur_price MODIFY fk_product_fournisseur integer UPDATE llx_product SET canvas = NULL where canvas = 'default@product'; UPDATE llx_product SET canvas = NULL where canvas = 'product@product'; UPDATE llx_product SET canvas = NULL where canvas = 'service@product'; + +DELETE FROM llx_const WHERE __DECRYPT('name')__ = 'SOCIETE_CODECOMPTA_ADDON' AND __DECRYPT('value')__ = 'mod_codecompta_digitaria'; \ No newline at end of file From cb96735f50d256de50c4b1c962e28317a655413f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Aug 2012 02:15:07 +0200 Subject: [PATCH 22/40] Fix: [ bug #506 ] Can't set percentage of a started event --- htdocs/core/class/html.formactions.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index efb5fde009389..54bbb9a6ae07d 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -69,7 +69,7 @@ function form_select_status_action($formname,$selected,$canedit=1,$htmlname='com print ''."\n"; print ''; // Full day - print ''.$langs->trans("EventOnFullDay").''; + print ''.$langs->trans("EventOnFullDay").''; // Date start $datep=$actioncomm->datep; @@ -687,7 +687,7 @@ function setdatefields() print ''.$langs->trans("Title").''; // Full day event - print ''.$langs->trans("EventOnFullDay").'fulldayevent?' checked="checked"':'').'>'; + print ''.$langs->trans("EventOnFullDay").'fulldayevent?' checked="checked"':'').'>'; // Date start print ''.$langs->trans("DateActionStart").''; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 6ff8843da5485..d1f35271f2fa7 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -744,11 +744,13 @@ if (empty($action) || $action == 'show_month') // View by month { $newparam=$param; // newparam is for birthday links + $newparam=preg_replace('/showbirthday=/i','showbirthday_=',$newparam); // To avoid replacement when replace day= is done $newparam=preg_replace('/action=show_month&?/i','',$newparam); $newparam=preg_replace('/action=show_week&?/i','',$newparam); - $newparam=preg_replace('/day=[0-9][0-9]&?/i','',$newparam); - $newparam=preg_replace('/month=[0-9][0-9]&?/i','',$newparam); + $newparam=preg_replace('/day=[0-9]+&?/i','',$newparam); + $newparam=preg_replace('/month=[0-9]+&?/i','',$newparam); $newparam=preg_replace('/year=[0-9]+&?/i','',$newparam); + $newparam=preg_replace('/showbirthday_=/i','showbirthday=',$newparam); // Restore correct parameter echo ''; echo ' '; $i=0; @@ -810,11 +812,13 @@ elseif ($action == 'show_week') // View by week { $newparam=$param; // newparam is for birthday links + $newparam=preg_replace('/showbirthday=/i','showbirthday_=',$newparam); // To avoid replacement when replace day= is done $newparam=preg_replace('/action=show_month&?/i','',$newparam); $newparam=preg_replace('/action=show_week&?/i','',$newparam); - $newparam=preg_replace('/day=[0-9][0-9]&?/i','',$newparam); - $newparam=preg_replace('/month=[0-9][0-9]&?/i','',$newparam); + $newparam=preg_replace('/day=[0-9]+&?/i','',$newparam); + $newparam=preg_replace('/month=[0-9]+&?/i','',$newparam); $newparam=preg_replace('/year=[0-9]+&?/i','',$newparam); + $newparam=preg_replace('/showbirthday_=/i','showbirthday=',$newparam); // Restore correct parameter echo '
'; echo ' '; $i=0; @@ -866,9 +870,6 @@ $newparam=$param; // newparam is for birthday links $newparam=preg_replace('/action=show_month&?/i','',$newparam); $newparam=preg_replace('/action=show_week&?/i','',$newparam); - $newparam=preg_replace('/day=[0-9][0-9]&?/i','',$newparam); - $newparam=preg_replace('/month=[0-9][0-9]&?/i','',$newparam); - $newparam=preg_replace('/year=[0-9]+&?/i','',$newparam); // Code to show just one day $style='cal_current_month'; $today=0; From 2d15b64f242343860f1af26c698575046286966f Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 21 Aug 2012 11:46:50 +0200 Subject: [PATCH 27/40] Fix: wrong ereg --- htdocs/core/lib/admin.lib.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 185178d0525cc..5790834fc4989 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -253,7 +253,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker dol_syslog('Admin.lib::run_sql Request '.($i+1).' sql='.$newsql, LOG_DEBUG); // Replace for encrypt data - if (preg_match_all('/__ENCRYPT\(\'([^\,]+)\'\)__/i',$newsql,$reg)) + if (preg_match_all('/__ENCRYPT\(\'([A-Za-z0-9_]+)\'\)__/i',$newsql,$reg)) { $num=count($reg[0]); @@ -266,7 +266,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker } // Replace for decrypt data - if (preg_match_all('/__DECRYPT\(\'([^\,]+)\'\)__/i',$newsql,$reg)) + if (preg_match_all('/__DECRYPT\(\'([A-Za-z0-9_]+)\'\)__/i',$newsql,$reg)) { $num=count($reg[0]); @@ -1138,15 +1138,15 @@ function form_constantes($tableau) function addDocumentModel($name, $type, $label='', $description='') { global $db, $conf; - + $db->begin(); - + $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; $sql.= " VALUES ('".$db->escape($name)."','".$type."',".$conf->entity.", "; $sql.= ($label?"'".$db->escape($label)."'":'null').", "; $sql.= (! empty($description)?"'".$db->escape($description)."'":"null"); $sql.= ")"; - + dol_syslog("admin.lib::addDocumentModel sql=".$sql); $resql=$db->query($sql); if ($resql) @@ -1172,9 +1172,9 @@ function addDocumentModel($name, $type, $label='', $description='') function delDocumentModel($name, $type) { global $db, $conf; - + $db->begin(); - + $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $sql.= " WHERE nom = '".$db->escape($name)."'"; $sql.= " AND type = '".$type."'"; From 049e5883416cdb1519e9fab87a897cc738724c87 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 22 Aug 2012 17:40:13 +0200 Subject: [PATCH 28/40] Fix: move barcode type entries in module descriptor for best compatibility with multicompany --- htdocs/admin/barcode.php | 12 +++--- htdocs/core/modules/DolibarrModules.class.php | 5 ++- htdocs/core/modules/modBarcode.class.php | 15 ++++++-- .../install/mysql/data/llx_c_barcode_type.sql | 37 ------------------- .../install/mysql/migration/3.1.0-3.2.0.sql | 4 +- .../mysql/tables/llx_c_barcode_type.key.sql | 19 ++++++++++ 6 files changed, 43 insertions(+), 49 deletions(-) delete mode 100644 htdocs/install/mysql/data/llx_c_barcode_type.sql create mode 100755 htdocs/install/mysql/tables/llx_c_barcode_type.key.sql diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index f87df7b6ea9bd..bf84a84b82dd0 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -1,8 +1,8 @@ - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2011 Juanjo Menent +/* Copyright (C) 2003-2004 Rodolphe Quiedeville + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2011 Juanjo Menent * * 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 @@ -112,7 +112,7 @@ foreach($dirbarcode as $reldir) { - $dir=dol_buildpath($reldir,0); + $dir=dol_buildpath($reldir); $newdir=dol_osencode($dir); // Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php) @@ -334,4 +334,4 @@ $db->close(); llxFooter(); -?> \ No newline at end of file +?> diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index e7661306fdd7e..4cfcfedf1c604 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -62,7 +62,7 @@ abstract class DolibarrModules */ function _init($array_sql, $options='') { - global $langs; + global $conf, $langs; $err=0; $this->db->begin(); @@ -113,6 +113,9 @@ function _init($array_sql, $options='') $sql=$val; } + // Add current entity id + $sql=str_replace('__ENTITY__', $conf->entity, $sql); + dol_syslog(get_class($this)."::_init ignoreerror=".$ignoreerror." sql=".$sql, LOG_DEBUG); $result=$this->db->query($sql); if (! $result) diff --git a/htdocs/core/modules/modBarcode.class.php b/htdocs/core/modules/modBarcode.class.php index 662972212c3c1..8764d7b212955 100644 --- a/htdocs/core/modules/modBarcode.class.php +++ b/htdocs/core/modules/modBarcode.class.php @@ -112,9 +112,16 @@ function init($options='') // Permissions $this->remove($options); - $sql = array(); - - return $this->_init($sql,$options); + $sql = array( + array('sql'=>'INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ("EAN8", "EAN8", 0, "1234567", __ENTITY__)','ignoreerror'=>1), + array('sql'=>'INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ("EAN13", "EAN13", 0, "123456789012", __ENTITY__)','ignoreerror'=>1), + array('sql'=>'INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ("UPC", "UPC", 0, "123456789012", __ENTITY__)','ignoreerror'=>1), + array('sql'=>'INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ("ISBN", "ISBN", 0, "123456789", __ENTITY__)','ignoreerror'=>1), + array('sql'=>'INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ("C39", "Code 39", 0, "1234567890", __ENTITY__)','ignoreerror'=>1), + array('sql'=>'INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ("C128", "Code 128", 0, "ABCD1234567890", __ENTITY__)','ignoreerror'=>1) + ); + + return $this->_init($sql, $options); } /** @@ -129,7 +136,7 @@ function remove($options='') { $sql = array(); - return $this->_remove($sql,$options); + return $this->_remove($sql, $options); } } diff --git a/htdocs/install/mysql/data/llx_c_barcode_type.sql b/htdocs/install/mysql/data/llx_c_barcode_type.sql deleted file mode 100644 index af10d8d1e7606..0000000000000 --- a/htdocs/install/mysql/data/llx_c_barcode_type.sql +++ /dev/null @@ -1,37 +0,0 @@ --- Copyright (C) 2001-2004 Rodolphe Quiedeville --- Copyright (C) 2003 Jean-Louis Bergamo --- Copyright (C) 2004-2009 Laurent Destailleur --- Copyright (C) 2004 Benoit Mortier --- Copyright (C) 2004 Guillaume Delecourt --- Copyright (C) 2005-2009 Regis Houssin --- Copyright (C) 2007 Patrick Raguin --- --- 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 2 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 . --- --- - --- --- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors --- de l'install et tous les sigles '--' sont supprimés. --- - --- --- Codes barres --- -INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (1, 'EAN8', 'EAN8', 0, '1234567'); -INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (2, 'EAN13', 'EAN13', 0, '123456789012'); -INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (3, 'UPC', 'UPC', 0, '123456789012'); -INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (4, 'ISBN', 'ISBN', 0, '123456789'); -INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (5, 'C39', 'Code 39', 0, '1234567890'); -INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (6, 'C128', 'Code 128', 0, 'ABCD1234567890'); diff --git a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql index e21ff76a6a778..8e8dd2f8059c9 100755 --- a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql +++ b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql @@ -457,4 +457,6 @@ UPDATE llx_product SET canvas = NULL where canvas = 'default@product'; UPDATE llx_product SET canvas = NULL where canvas = 'product@product'; UPDATE llx_product SET canvas = NULL where canvas = 'service@product'; -DELETE FROM llx_const WHERE __DECRYPT('name')__ = 'SOCIETE_CODECOMPTA_ADDON' AND __DECRYPT('value')__ = 'mod_codecompta_digitaria'; \ No newline at end of file +DELETE FROM llx_const WHERE __DECRYPT('name')__ = 'SOCIETE_CODECOMPTA_ADDON' AND __DECRYPT('value')__ = 'mod_codecompta_digitaria'; + +ALTER TABLE llx_c_barcode_type ADD UNIQUE INDEX uk_c_barcode_type(code, entity); diff --git a/htdocs/install/mysql/tables/llx_c_barcode_type.key.sql b/htdocs/install/mysql/tables/llx_c_barcode_type.key.sql new file mode 100755 index 0000000000000..ca4cf7fc89827 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_c_barcode_type.key.sql @@ -0,0 +1,19 @@ +-- ======================================================================== +-- Copyright (C) 2012 Regis Houssin +-- +-- 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 2 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 . +-- +-- ======================================================================== + +ALTER TABLE llx_c_barcode_type ADD UNIQUE INDEX uk_c_barcode_type(code, entity); From 61372f4650da0ce1875e8b77420d22614b6e44eb Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 23 Aug 2012 18:14:02 +0200 Subject: [PATCH 29/40] Fix: rename for security raison --- ...{demo_wsclient_invoice.php => demo_wsclient_invoice.php-NORUN} | 0 .../{demo_wsclient_other.php => demo_wsclient_other.php-NORUN} | 0 ...ductorservice.php => demo_wsclient_productorservice.php-NORUN} | 0 ...wsclient_thirdparty.php => demo_wsclient_thirdparty.php-NORUN} | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename htdocs/webservices/{demo_wsclient_invoice.php => demo_wsclient_invoice.php-NORUN} (100%) rename htdocs/webservices/{demo_wsclient_other.php => demo_wsclient_other.php-NORUN} (100%) rename htdocs/webservices/{demo_wsclient_productorservice.php => demo_wsclient_productorservice.php-NORUN} (100%) rename htdocs/webservices/{demo_wsclient_thirdparty.php => demo_wsclient_thirdparty.php-NORUN} (100%) diff --git a/htdocs/webservices/demo_wsclient_invoice.php b/htdocs/webservices/demo_wsclient_invoice.php-NORUN similarity index 100% rename from htdocs/webservices/demo_wsclient_invoice.php rename to htdocs/webservices/demo_wsclient_invoice.php-NORUN diff --git a/htdocs/webservices/demo_wsclient_other.php b/htdocs/webservices/demo_wsclient_other.php-NORUN similarity index 100% rename from htdocs/webservices/demo_wsclient_other.php rename to htdocs/webservices/demo_wsclient_other.php-NORUN diff --git a/htdocs/webservices/demo_wsclient_productorservice.php b/htdocs/webservices/demo_wsclient_productorservice.php-NORUN similarity index 100% rename from htdocs/webservices/demo_wsclient_productorservice.php rename to htdocs/webservices/demo_wsclient_productorservice.php-NORUN diff --git a/htdocs/webservices/demo_wsclient_thirdparty.php b/htdocs/webservices/demo_wsclient_thirdparty.php-NORUN similarity index 100% rename from htdocs/webservices/demo_wsclient_thirdparty.php rename to htdocs/webservices/demo_wsclient_thirdparty.php-NORUN From 084efd03a3d7e365ac44aff32961744d874b949f Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 24 Aug 2012 17:26:36 +0200 Subject: [PATCH 30/40] Fix: Bad assignation of const for pdf delivery module name --- htdocs/core/modules/modExpedition.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index 235c80e873ff5..a95dd9eac0e2a 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -211,8 +211,8 @@ function init($options='') $sql = array( "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity, "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','shipping',".$conf->entity.")", - "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[1][2]."' AND entity = ".$conf->entity, - "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[1][2]."','delivery',".$conf->entity.")", + "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[2][2]."' AND entity = ".$conf->entity, + "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[2][2]."','delivery',".$conf->entity.")", ); return $this->_init($sql,$options); From 0dafeb8e443773e68fa4fd85329c12783df83063 Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 24 Aug 2012 17:30:22 +0200 Subject: [PATCH 31/40] Fix: Bad assignation of const for pdf delivery module name --- htdocs/install/mysql/migration/repair.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 99a91bab00a65..4494fdfaf3ed9 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -47,6 +47,8 @@ UPDATE llx_product SET canvas = NULL where canvas = 'default@product'; DELETE FROM llx_boxes where box_id NOT IN (SELECT rowid FROM llx_boxes_def); +DELETE FROM llx_document_model WHERE nom ='elevement' AND type='delivery'; + -- VMYSQL4.1 DELETE T1 FROM llx_boxes_def as T1, llx_boxes_def as T2 where T1.entity = T2.entity AND T1.file = T2.file AND T1.note = T2.note and T1.rowid > T2.rowid -- VPGSQL8.2 DELETE FROM llx_boxes_def as T1 WHERE rowid NOT IN (SELECT min(rowid) FROM llx_boxes_def GROUP BY file, entity, note) From bc2411098c4c7f397c775484e190884a38ec34d5 Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 24 Aug 2012 17:45:44 +0200 Subject: [PATCH 32/40] Fix: Bad assignation of const for pdf delivery module name --- htdocs/install/mysql/migration/repair.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 4494fdfaf3ed9..b68f4aa1bd67b 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -47,7 +47,7 @@ UPDATE llx_product SET canvas = NULL where canvas = 'default@product'; DELETE FROM llx_boxes where box_id NOT IN (SELECT rowid FROM llx_boxes_def); -DELETE FROM llx_document_model WHERE nom ='elevement' AND type='delivery'; +UPDATE llx_document_model SET nom='typhon' WHERE nom ='elevement' AND type='delivery'; -- VMYSQL4.1 DELETE T1 FROM llx_boxes_def as T1, llx_boxes_def as T2 where T1.entity = T2.entity AND T1.file = T2.file AND T1.note = T2.note and T1.rowid > T2.rowid -- VPGSQL8.2 DELETE FROM llx_boxes_def as T1 WHERE rowid NOT IN (SELECT min(rowid) FROM llx_boxes_def GROUP BY file, entity, note) From fef04f69213ab64f3a4df2c47e8f8b6bac46e290 Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 24 Aug 2012 18:03:03 +0200 Subject: [PATCH 33/40] Fix: Bad assignation of const for pdf delivery module name --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a3c7069876c8b..3310347ae10cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,7 +28,7 @@ English Dolibarr ChangeLog - Fix: [ bug #503 ] Unable to delete linked file to a deposit - Fix: [ bug #501 ] Error while trying to modify an user - Fix: [ bug #506 ] Can't set percentage of a started event - +- Fix: Bad assignation of const for pdf delivery module name ***** ChangeLog for 3.2.0 compared to 3.1.3 ***** WARNING: PHP lower than 5.x are no more supported. From c5728843a52606396970ccfb2a32cf0bc37f3f00 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 25 Aug 2012 10:59:41 +0200 Subject: [PATCH 34/40] Fix: remove obsolete code Conflicts: htdocs/admin/expedition.php --- htdocs/admin/expedition.php | 302 ++++++-------------- htdocs/core/modules/modExpedition.class.php | 17 +- 2 files changed, 87 insertions(+), 232 deletions(-) diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 8e189889b3b7b..c2e6ba1f9bb4b 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -1,12 +1,12 @@ - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2011-2012 Juanjo Menent - * Copyright (C) 2011-2012 Philippe Grand +/* Copyright (C) 2003-2008 Rodolphe Quiedeville + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2011-2012 Philippe Grand * * 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 @@ -28,18 +28,23 @@ * \brief Page d'administration/configuration du module Expedition */ -require("../main.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); -require_once(DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'); +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; $langs->load("admin"); $langs->load("sendings"); $langs->load("deliveries"); +$langs->load('other'); -if (!$user->admin) accessforbidden(); +if (! $user->admin) + accessforbidden(); $action=GETPOST('action','alpha'); $value=GETPOST('value','alpha'); +$label = GETPOST('label','alpha'); +$scandir = GETPOST('scandir','alpha'); +$type='shipping'; if (empty($conf->global->EXPEDITION_ADDON_NUMBER)) { @@ -50,6 +55,59 @@ /* * Actions */ + if ($action == 'updateMask') +{ + $maskconst=GETPOST('maskconstexpedition','alpha'); + $maskvalue=GETPOST('maskexpedition','alpha'); + if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; + } +} + +if ($action == 'set_SHIPPING_FREE_TEXT') +{ + $freetext=GETPOST('SHIPPING_FREE_TEXT','alpha'); + $res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; + } +} + +if ($action == 'set_SHIPPING_DRAFT_WATERMARK') +{ + $draft=GETPOST('SHIPPING_DRAFT_WATERMARK','alpha'); + + $res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; + } +} + if ($action == 'specimen') { $modele=GETPOST('module','alpha'); @@ -73,7 +131,7 @@ if ($filefound) { - require_once($file); + require_once $file; $module = new $classname($db); @@ -98,210 +156,23 @@ // Activate a model if ($action == 'set') { - $label = GETPOST('label','alpha'); - $scandir = GETPOST('scandir','alpha'); - - $type='shipping'; - $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; - $sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", "; - $sql.= ($label?"'".$db->escape($label)."'":'null').", "; - $sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null"); - $sql.= ")"; - if ($db->query($sql)) - { - - } + $ret = addDocumentModel($value, $type, $label, $scandir); } if ($action == 'del') { - $type='shipping'; - $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; - $sql.= " WHERE nom = '".$db->escape($value)."'"; - $sql.= " AND type = '".$type."'"; - $sql.= " AND entity = ".$conf->entity; - - if ($db->query($sql)) + $ret = delDocumentModel($value, $type); + if ($ret > 0) { if ($conf->global->EXPEDITION_ADDON_PDF == "$value") dolibarr_del_const($db, 'EXPEDITION_ADDON_PDF',$conf->entity); } } -// Set default model -if ($action == 'setdoc') -{ - $label = GETPOST('label','alpha'); - $scandir = GETPOST('scandir','alpha'); - - $db->begin(); - - if (dolibarr_set_const($db, "EXPEDITION_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) - { - $conf->global->EXPEDITION_ADDON_PDF = $value; - } - - // On active le modele - $type='shipping'; - $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; - $sql_del.= " WHERE nom = '".$db->escape($value)."'"; - $sql_del.= " AND type = '".$type."'"; - $sql_del.= " AND entity = ".$conf->entity; - $result1=$db->query($sql_del); - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; - $sql.= " VALUES ('".$db->escape($value)."', '".$type."', ".$conf->entity.", "; - $sql.= ($label?"'".$db->escape($label)."'":'null').", "; - $sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null"); - $sql.= ")"; - $result2=$db->query($sql); - if ($result1 && $result2) - { - $db->commit(); - } - else - { - $db->rollback(); - } -} - -// TODO A quoi servent les methode d'expedition ? -if ($action == 'setmethod' || $action== 'setmod') -{ - $module=GETPOST('module','alpha'); - $moduleid=GETPOST('moduleid','alpha'); - $statut=GETPOST('statut','alpha'); - - require_once(DOL_DOCUMENT_ROOT."/core/modules/expedition/methode_expedition_$module.modules.php"); - - $classname = "methode_expedition_$module"; - $expem = new $classname($db); - - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."c_shipment_mode"; - $sql.= " WHERE rowid = ".$moduleid; - - $resql = $db->query($sql); - if ($resql && ($statut == 1 || $action == 'setmod')) - { - $db->begin(); - - $sqlu = "UPDATE ".MAIN_DB_PREFIX."c_shipment_mode"; - $sqlu.= " SET statut=1"; - $sqlu.= " WHERE rowid=".$moduleid; - - $result=$db->query($sqlu); - if ($result) - { - $db->commit(); - } - else - { - $db->rollback(); - } - } - - if ($statut == 1 || $action == 'setmod') - { - $db->begin(); - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (rowid,code,libelle,description,statut)"; - $sql.= " VALUES (".$moduleid.",'".$expem->code."','".$expem->name."','".$expem->description."',1)"; - $result=$db->query($sql); - if ($result) - { - $db->commit(); - } - else - { - //dol_print_error($db); - $db->rollback(); - } - } - else if ($statut == 0) - { - $db->begin(); - - $sql = "UPDATE ".MAIN_DB_PREFIX."c_shipment_mode"; - $sql.= " SET statut=0"; - $sql.= " WHERE rowid=".$moduleid; - $result=$db->query($sql); - if ($result) - { - $db->commit(); - } - else - { - $db->rollback(); - } - } -} - -if ($action == 'setmod') -{ - // TODO Verifier si module numerotation choisi peut etre active - // par appel methode canBeActivated - - $module=GETPOST('module','alpha'); - - dolibarr_set_const($db, "EXPEDITION_ADDON",$module,'chaine',0,'',$conf->entity); - -} - -if ($action == 'updateMask') -{ - $maskconst=GETPOST('maskconstexpedition','alpha'); - $maskvalue=GETPOST('maskexpedition','alpha'); - if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity); - - if (! $res > 0) $error++; - - if (! $error) - { - $mesg = "".$langs->trans("SetupSaved").""; - } - else - { - $mesg = "".$langs->trans("Error").""; - } -} - if ($action == 'setmodel') { dolibarr_set_const($db, "EXPEDITION_ADDON_NUMBER",$value,'chaine',0,'',$conf->entity); } -if ($action == 'set_SHIPPING_DRAFT_WATERMARK') -{ - $draft=GETPOST('SHIPPING_DRAFT_WATERMARK','alpha'); - $res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); - - if (! $res > 0) $error++; - - if (! $error) - { - $mesg = "".$langs->trans("SetupSaved").""; - } - else - { - $mesg = "".$langs->trans("Error").""; - } -} - -if ($action == 'set_SHIPPING_FREE_TEXT') -{ - $free=GETPOST('SHIPPING_FREE_TEXT','alpha'); - $res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT",$free,'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; - - if (! $error) - { - $mesg = "".$langs->trans("SetupSaved").""; - } - else - { - $mesg = "".$langs->trans("Error").""; - } -} - /* * View @@ -372,12 +243,11 @@ while (($file = readdir($handle))!==false) { - if (preg_match('/^(mod_.*)\.php$/i',$file,$reg)) + if (substr($file, 0, 15) == 'mod_expedition_' && substr($file, dol_strlen($file)-3, 3) == 'php') { - $file = $reg[1]; - $classname = substr($file,4); + $file = substr($file, 0, dol_strlen($file)-4); - require_once(DOL_DOCUMENT_ROOT ."/core/modules/expedition/".$file.".php"); + require_once DOL_DOCUMENT_ROOT ."/core/modules/expedition/".$file.'.php'; $module = new $file; @@ -420,7 +290,6 @@ // Info $htmltooltip=''; $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; - $facture->type=0; $nextval=$module->getNextValue($mysoc,$expedition); if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval { @@ -511,10 +380,10 @@ $classname = substr($file, 0, dol_strlen($file) - 12); $var=!$var; - print "
"; } else diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index a95dd9eac0e2a..f6e436f65d897 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -84,11 +84,11 @@ function modExpedition($db) $this->const[$r][4] = 0; $r++; - $this->const[$r][0] = "EXPEDITION_ADDON"; - $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "elevement"; - $this->const[$r][3] = 'Nom du gestionnaire du type d\'expedition'; - $this->const[$r][4] = 0; + $this->const[$r][0] = "EXPEDITION_ADDON_NUMBER"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "mod_expedition_safor"; + $this->const[$r][3] = 'Nom du gestionnaire de numerotation des expeditions'; + $this->const[$r][4] = 0; $r++; $this->const[$r][0] = "LIVRAISON_ADDON_PDF"; @@ -105,13 +105,6 @@ function modExpedition($db) $this->const[$r][4] = 0; $r++; - $this->const[$r][0] = "EXPEDITION_ADDON_NUMBER"; - $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "mod_expedition_safor"; - $this->const[$r][3] = 'Nom du gestionnaire de numerotation des expeditions'; - $this->const[$r][4] = 0; - $r++; - // Boxes $this->boxes = array(); From 87cc60d647a50bd77a1aeb24ee5eda132bfc511d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 25 Aug 2012 10:59:58 +0200 Subject: [PATCH 35/40] Revert "Fix: remove obsolete code" This reverts commit c5728843a52606396970ccfb2a32cf0bc37f3f00. --- htdocs/admin/expedition.php | 302 ++++++++++++++------ htdocs/core/modules/modExpedition.class.php | 17 +- 2 files changed, 232 insertions(+), 87 deletions(-) diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index c2e6ba1f9bb4b..8e189889b3b7b 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -1,12 +1,12 @@ - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011-2012 Juanjo Menent - * Copyright (C) 2011-2012 Philippe Grand +/* Copyright (C) 2003-2008 Rodolphe Quiedeville + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2011-2012 Philippe Grand * * 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 @@ -28,23 +28,18 @@ * \brief Page d'administration/configuration du module Expedition */ -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; +require("../main.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); +require_once(DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'); $langs->load("admin"); $langs->load("sendings"); $langs->load("deliveries"); -$langs->load('other'); -if (! $user->admin) - accessforbidden(); +if (!$user->admin) accessforbidden(); $action=GETPOST('action','alpha'); $value=GETPOST('value','alpha'); -$label = GETPOST('label','alpha'); -$scandir = GETPOST('scandir','alpha'); -$type='shipping'; if (empty($conf->global->EXPEDITION_ADDON_NUMBER)) { @@ -55,59 +50,6 @@ /* * Actions */ - if ($action == 'updateMask') -{ - $maskconst=GETPOST('maskconstexpedition','alpha'); - $maskvalue=GETPOST('maskexpedition','alpha'); - if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity); - - if (! $res > 0) $error++; - - if (! $error) - { - $mesg = "".$langs->trans("SetupSaved").""; - } - else - { - $mesg = "".$langs->trans("Error").""; - } -} - -if ($action == 'set_SHIPPING_FREE_TEXT') -{ - $freetext=GETPOST('SHIPPING_FREE_TEXT','alpha'); - $res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); - - if (! $res > 0) $error++; - - if (! $error) - { - $mesg = "".$langs->trans("SetupSaved").""; - } - else - { - $mesg = "".$langs->trans("Error").""; - } -} - -if ($action == 'set_SHIPPING_DRAFT_WATERMARK') -{ - $draft=GETPOST('SHIPPING_DRAFT_WATERMARK','alpha'); - - $res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); - - if (! $res > 0) $error++; - - if (! $error) - { - $mesg = "".$langs->trans("SetupSaved").""; - } - else - { - $mesg = "".$langs->trans("Error").""; - } -} - if ($action == 'specimen') { $modele=GETPOST('module','alpha'); @@ -131,7 +73,7 @@ if ($filefound) { - require_once $file; + require_once($file); $module = new $classname($db); @@ -156,23 +98,210 @@ // Activate a model if ($action == 'set') { - $ret = addDocumentModel($value, $type, $label, $scandir); + $label = GETPOST('label','alpha'); + $scandir = GETPOST('scandir','alpha'); + + $type='shipping'; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; + $sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", "; + $sql.= ($label?"'".$db->escape($label)."'":'null').", "; + $sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null"); + $sql.= ")"; + if ($db->query($sql)) + { + + } } if ($action == 'del') { - $ret = delDocumentModel($value, $type); - if ($ret > 0) + $type='shipping'; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; + $sql.= " WHERE nom = '".$db->escape($value)."'"; + $sql.= " AND type = '".$type."'"; + $sql.= " AND entity = ".$conf->entity; + + if ($db->query($sql)) { if ($conf->global->EXPEDITION_ADDON_PDF == "$value") dolibarr_del_const($db, 'EXPEDITION_ADDON_PDF',$conf->entity); } } +// Set default model +if ($action == 'setdoc') +{ + $label = GETPOST('label','alpha'); + $scandir = GETPOST('scandir','alpha'); + + $db->begin(); + + if (dolibarr_set_const($db, "EXPEDITION_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) + { + $conf->global->EXPEDITION_ADDON_PDF = $value; + } + + // On active le modele + $type='shipping'; + $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; + $sql_del.= " WHERE nom = '".$db->escape($value)."'"; + $sql_del.= " AND type = '".$type."'"; + $sql_del.= " AND entity = ".$conf->entity; + $result1=$db->query($sql_del); + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; + $sql.= " VALUES ('".$db->escape($value)."', '".$type."', ".$conf->entity.", "; + $sql.= ($label?"'".$db->escape($label)."'":'null').", "; + $sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null"); + $sql.= ")"; + $result2=$db->query($sql); + if ($result1 && $result2) + { + $db->commit(); + } + else + { + $db->rollback(); + } +} + +// TODO A quoi servent les methode d'expedition ? +if ($action == 'setmethod' || $action== 'setmod') +{ + $module=GETPOST('module','alpha'); + $moduleid=GETPOST('moduleid','alpha'); + $statut=GETPOST('statut','alpha'); + + require_once(DOL_DOCUMENT_ROOT."/core/modules/expedition/methode_expedition_$module.modules.php"); + + $classname = "methode_expedition_$module"; + $expem = new $classname($db); + + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."c_shipment_mode"; + $sql.= " WHERE rowid = ".$moduleid; + + $resql = $db->query($sql); + if ($resql && ($statut == 1 || $action == 'setmod')) + { + $db->begin(); + + $sqlu = "UPDATE ".MAIN_DB_PREFIX."c_shipment_mode"; + $sqlu.= " SET statut=1"; + $sqlu.= " WHERE rowid=".$moduleid; + + $result=$db->query($sqlu); + if ($result) + { + $db->commit(); + } + else + { + $db->rollback(); + } + } + + if ($statut == 1 || $action == 'setmod') + { + $db->begin(); + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (rowid,code,libelle,description,statut)"; + $sql.= " VALUES (".$moduleid.",'".$expem->code."','".$expem->name."','".$expem->description."',1)"; + $result=$db->query($sql); + if ($result) + { + $db->commit(); + } + else + { + //dol_print_error($db); + $db->rollback(); + } + } + else if ($statut == 0) + { + $db->begin(); + + $sql = "UPDATE ".MAIN_DB_PREFIX."c_shipment_mode"; + $sql.= " SET statut=0"; + $sql.= " WHERE rowid=".$moduleid; + $result=$db->query($sql); + if ($result) + { + $db->commit(); + } + else + { + $db->rollback(); + } + } +} + +if ($action == 'setmod') +{ + // TODO Verifier si module numerotation choisi peut etre active + // par appel methode canBeActivated + + $module=GETPOST('module','alpha'); + + dolibarr_set_const($db, "EXPEDITION_ADDON",$module,'chaine',0,'',$conf->entity); + +} + +if ($action == 'updateMask') +{ + $maskconst=GETPOST('maskconstexpedition','alpha'); + $maskvalue=GETPOST('maskexpedition','alpha'); + if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; + } +} + if ($action == 'setmodel') { dolibarr_set_const($db, "EXPEDITION_ADDON_NUMBER",$value,'chaine',0,'',$conf->entity); } +if ($action == 'set_SHIPPING_DRAFT_WATERMARK') +{ + $draft=GETPOST('SHIPPING_DRAFT_WATERMARK','alpha'); + $res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; + } +} + +if ($action == 'set_SHIPPING_FREE_TEXT') +{ + $free=GETPOST('SHIPPING_FREE_TEXT','alpha'); + $res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT",$free,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + + if (! $error) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; + } +} + /* * View @@ -243,11 +372,12 @@ while (($file = readdir($handle))!==false) { - if (substr($file, 0, 15) == 'mod_expedition_' && substr($file, dol_strlen($file)-3, 3) == 'php') + if (preg_match('/^(mod_.*)\.php$/i',$file,$reg)) { - $file = substr($file, 0, dol_strlen($file)-4); + $file = $reg[1]; + $classname = substr($file,4); - require_once DOL_DOCUMENT_ROOT ."/core/modules/expedition/".$file.'.php'; + require_once(DOL_DOCUMENT_ROOT ."/core/modules/expedition/".$file.".php"); $module = new $file; @@ -290,6 +420,7 @@ // Info $htmltooltip=''; $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; + $facture->type=0; $nextval=$module->getNextValue($mysoc,$expedition); if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval { @@ -380,10 +511,10 @@ $classname = substr($file, 0, dol_strlen($file) - 12); $var=!$var; - print '
"; } else diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index f6e436f65d897..a95dd9eac0e2a 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -84,11 +84,11 @@ function modExpedition($db) $this->const[$r][4] = 0; $r++; - $this->const[$r][0] = "EXPEDITION_ADDON_NUMBER"; - $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "mod_expedition_safor"; - $this->const[$r][3] = 'Nom du gestionnaire de numerotation des expeditions'; - $this->const[$r][4] = 0; + $this->const[$r][0] = "EXPEDITION_ADDON"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "elevement"; + $this->const[$r][3] = 'Nom du gestionnaire du type d\'expedition'; + $this->const[$r][4] = 0; $r++; $this->const[$r][0] = "LIVRAISON_ADDON_PDF"; @@ -105,6 +105,13 @@ function modExpedition($db) $this->const[$r][4] = 0; $r++; + $this->const[$r][0] = "EXPEDITION_ADDON_NUMBER"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "mod_expedition_safor"; + $this->const[$r][3] = 'Nom du gestionnaire de numerotation des expeditions'; + $this->const[$r][4] = 0; + $r++; + // Boxes $this->boxes = array(); From 9142e3400b22dd38e59c3f5600c8d0a2e1f1870b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Aug 2012 00:33:37 +0200 Subject: [PATCH 36/40] Fix: [ bug #254 ] Database backup not working with complex passwords --- htdocs/admin/tools/export.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index fe686d85bd1a9..5a1b4bdff9d2d 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -158,7 +158,7 @@ if (! empty($dolibarr_main_db_pass)) { $paramcrypted.=' -p"'.preg_replace('/./i','*',$dolibarr_main_db_pass).'"'; - $paramclear.=' -p"'.str_replace('"','\"',$dolibarr_main_db_pass).'"'; + $paramclear.=' -p"'.str_replace(array('"','`'),array('\"','\`'),$dolibarr_main_db_pass).'"'; } print ''.$langs->trans("RunCommandSummary").':
'."\n"; From fe7690234286c4695ddab8a49db5b8d7ea76e118 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Aug 2012 13:15:51 +0200 Subject: [PATCH 37/40] Fix: Bad field --- htdocs/adherents/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 9b0d1895e1b4f..286095a337dd6 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -247,7 +247,7 @@ $statictype->libelle=$obj->libelle; print '
'; print ''; - print ''; + print ''; print ''; print ''; $i++; From e121ab8c86230246964368af4342535832a41565 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Aug 2012 19:33:32 +0200 Subject: [PATCH 38/40] [ bug #512 ] Filter system not working in banks > account > transactions Conflicts: htdocs/compta/bank/account.php --- htdocs/compta/bank/account.php | 146 +++++++++++++++++---------------- 1 file changed, 74 insertions(+), 72 deletions(-) diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 5e2cba398e342..ad5205c99eb8f 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -48,6 +48,7 @@ if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'banque',$fieldvalue,'bank_account','','',$fieldtype); +$paiementtype=GETPOST('paiementtype','alpha',3); $req_nb=GETPOST("req_nb",'',3); $thirdparty=GETPOST("thirdparty",'',3); $vline=GETPOST("vline"); @@ -78,17 +79,17 @@ { $amount = - price2num($_POST["debit"]); } - + $dateop = dol_mktime(12,0,0,$_POST["opmonth"],$_POST["opday"],$_POST["opyear"]); $operation=$_POST["operation"]; $num_chq=$_POST["num_chq"]; $label=$_POST["label"]; $cat1=$_POST["cat1"]; - + if (! $dateop) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Date")); if (! $operation) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Type")); if (! $amount) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Amount")); - + if (! $mesg) { $object->fetch($id); @@ -143,15 +144,15 @@ } $result=$object->fetch($id, $ref); - + // Chargement des categories bancaires dans $options $nbcategories=0; - + $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_categ"; $sql.= " WHERE entity = ".$conf->entity; $sql.= " ORDER BY label"; - + $result = $db->query($sql); if ($result) { @@ -168,7 +169,7 @@ } $db->free($result); } - + // Definition de sql_rech et param $param=''; $sql_rech=''; @@ -203,13 +204,13 @@ $param.='&thirdparty='.urlencode($thirdparty); $mode_search = 1; } - if (GETPOST("paiementtype")) + if ($paiementtype) { - $sql_rech.=" AND b.fk_type = '".$db->escape(GETPOST("paiementtype"))."'"; - $param.='&paiementtype='.urlencode(GETPOST("paiementtype")); + $sql_rech.=" AND b.fk_type = '".$db->escape($paiementtype)."'"; + $param.='&paiementtype='.urlencode($paiementtype); $mode_search = 1; } - + $sql = "SELECT count(*) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= ", ".MAIN_DB_PREFIX."bank as b"; @@ -222,7 +223,7 @@ $sql.= " AND b.fk_account = ba.rowid"; $sql.= " AND ba.entity = ".$conf->entity; $sql.= $sql_rech; - + dol_syslog("account.php count transactions - sql=".$sql, LOG_DEBUG); $result=$db->query($sql); if ($result) @@ -230,7 +231,7 @@ $obj = $db->fetch_object($result); $nbline = $obj->nb; $total_lines = $nbline; - + if ($nbline > $viewline ) $limit = $nbline - $viewline ; else $limit = $viewline; @@ -240,7 +241,7 @@ { dol_print_error($db); } - + if ($page > 0) { $limitsql = $nbline - ($page * $viewline); @@ -253,34 +254,34 @@ $limitsql = $nbline; } //print $limitsql.'-'.$page.'-'.$viewline; - + // Onglets $head=bank_prepare_head($object); dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account'); - + print '
"; + print '
'; print $name; print "\n"; - require_once($dir.$file); + require_once $dir.$file; $module = new $classname(); print $module->description; @@ -524,16 +393,9 @@ if (in_array($name, $def)) { print "\n"; - //if ($conf->global->EXPEDITION_ADDON_PDF != $name) - //{ - print ''; - print img_picto($langs->trans("Activated"),'switch_on'); - print ''; - //} - //else - //{ - // print img_picto($langs->trans("Activated"),'switch_on'); - //} + print ''; + print img_picto($langs->trans("Activated"),'switch_on'); + print ''; print "
'; + print "
"; print $name; print "\n"; - require_once $dir.$file; + require_once($dir.$file); $module = new $classname(); print $module->description; @@ -393,9 +524,16 @@ if (in_array($name, $def)) { print "\n"; - print ''; - print img_picto($langs->trans("Activated"),'switch_on'); - print ''; + //if ($conf->global->EXPEDITION_ADDON_PDF != $name) + //{ + print ''; + print img_picto($langs->trans("Activated"),'switch_on'); + print ''; + //} + //else + //{ + // print img_picto($langs->trans("Activated"),'switch_on'); + //} print "'.$staticmember->getNomUrl(1,24).''.$statictype->getNomUrl(1,16).''.dol_print_date($db->jdate($obj->date_end),'dayhour').''.dol_print_date($db->jdate($obj->datem),'dayhour').''.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'
'; - + // Ref print ''; print ''; - + // Label print ''; print ''; - + print '
'.$langs->trans("Ref").''; print $form->showrefnav($object,'ref','',1,'ref'); print '
'.$langs->trans("Label").''.$object->label.'
'; - + print '
'; - + dol_htmloutput_errors($mesg); - + /** * Search form */ $param.='&account='.$object->id; - + // Define transaction list navigation string $navig=''; $navig.='
'; @@ -289,6 +290,7 @@ if ($limitsql > $viewline) $navig.=''.img_previous().''; $navig.= $langs->trans("Page")." "; // ' Page '; $navig.=''; + $navig.=''; $navig.=''; $navig.=''; $navig.=''; @@ -303,7 +305,7 @@ } $navig.='
'; //var_dump($navig); - + // Confirmation delete if ($action == 'delete') { @@ -311,15 +313,15 @@ $ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.$_GET["rowid"],$langs->trans('DeleteTransaction'),$text,'confirm_delete'); if ($ret == 'html') print '
'; } - + print ''; - + // Show title if ($action != 'addline' && $action != 'delete') { print ''; } - + // Form to add a transaction with no invoice if ($user->rights->banque->modifier && $action == 'addline') { @@ -328,11 +330,11 @@ print ''; print ''; print ''; - + print ''; print ''; print ''; - + print ''; print ''; print ''; @@ -343,7 +345,7 @@ print ''; print ''; print ''; - + print ''; print ''; print ""; - + print ''."\n"; } - + /* * Affiche tableau des transactions bancaires */ - + // Ligne de titre tableau des ecritures print ''; print ''; @@ -389,19 +391,19 @@ if ($object->type != 2 && $object->rappro) print $langs->trans("AccountStatementShort"); else print ' '; print ''; - + print ''; print ''; print ''; print ''; - + print ''; print ''; print ''; print ''; print ''; print ''; @@ -412,13 +414,13 @@ print ''; print "\n"; print "\n"; - + /* * Another solution * create temporary table solde type=heap select amount from llx_bank limit 100 ; * select sum(amount) from solde ; */ - + $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,"; $sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type"; if ($mode_search) @@ -428,11 +430,11 @@ /* if ($mode_search && $conf->adherent->enabled) { - + } if ($mode_search && $conf->tax->enabled) { - + } */ $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; @@ -459,22 +461,22 @@ $sql.= $sql_rech; $sql.= $db->order("b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day $sql.= $db->plimit($limitsql, 0); - + dol_syslog("account.php get transactions - sql=".$sql, LOG_DEBUG); $result = $db->query($sql); if ($result) { $now=dol_now(); $nows=dol_print_date($now,'%Y%m%d'); - + //$form->load_cache_types_paiements(); //$form->cache_types_paiements - + $var=true; - + $num = $db->num_rows($result); $i = 0; $total = 0; $sep = 0; - + while ($i < $num) { $objp = $db->fetch_object($result); @@ -482,7 +484,7 @@ if ($i >= ($nbline - $viewline)) { $var=!$var; - + // Is it a transaction in future ? $dos=dol_print_date($db->jdate($objp->do),'%Y%m%d'); //print "dos=".$dos." nows=".$nows; @@ -496,26 +498,26 @@ print ""; print ''; } - + print ''; - + print '\n"; - + print '\n"; - + // Payment type print "\n"; - + // Num print '\n"; - + // Description print ''; - + // Add third party column print ''; - + // Amount if ($objp->amount < 0) { @@ -637,7 +639,7 @@ { print ''."\n"; } - + // Balance if ($action != 'search') { @@ -654,7 +656,7 @@ { print ''; } - + // Transaction reconciliated or edit link if ($objp->rappro && $object->canBeConciliated() > 0) // If line not conciliated and account can be conciliated { @@ -697,13 +699,13 @@ } print ''; } - + print ""; } - + $i++; } - + // Show total if ($page == 0 && ! $mode_search) { @@ -721,19 +723,19 @@ { dol_print_error($db); } - + print "
'.$navig.'
'.$langs->trans("AddBankRecordLong").'
'.$langs->trans("Date").' '.$langs->trans("Credit").' 
'; $form->select_date($dateop,'op',0,0,0,'transaction'); @@ -366,14 +368,14 @@ print ''; print '
 
'.$langs->trans("Date").'
  '; //$filtertype=array('TIP'=>'TIP','PRE'=>'PRE',...) $filtertype=''; - print $form->select_types_paiements($_REQUEST['paiementtype'],'paiementtype',$filtertype,2,1,1,8); + print $form->select_types_paiements($paiementtype,'paiementtype',$filtertype,2,1,1,8); print '
 
'.dol_print_date($db->jdate($objp->do),"day")."'.dol_print_date($db->jdate($objp->dv),"day"); print ""; $label=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$objp->fk_type; // $label=$langs->getTradFromKey("PaymentTypeShort".$objp->fk_type); - + if ($objp->fk_type == 'SOLD') $label=' '; print $label; print "'.($objp->num_chq?$objp->num_chq:"")."'; // Show generic description @@ -545,7 +547,7 @@ } else if ($links[$key]['type']=='company') { - + } else if ($links[$key]['type']=='payment_sc') { @@ -567,11 +569,11 @@ } else if ($links[$key]['type']=='member') { - + } else if ($links[$key]['type']=='sc') { - + } else { @@ -592,7 +594,7 @@ } } print ''; foreach($links as $key=>$val) @@ -627,7 +629,7 @@ } } print '  '.price($objp->amount).'-
"; - + print "\n\n"; - + /* * Boutons actions */ - + if ($action != 'delete') { print '
'; - + if ($object->type != 2 && $object->rappro) // If not cash account and can be reconciliate { if ($user->rights->banque->consolidate) @@ -745,7 +747,7 @@ print ''.$langs->trans("Conciliate").''; } } - + if ($action != 'addline') { if ($user->rights->banque->modifier) @@ -757,10 +759,10 @@ print ''.$langs->trans("AddBankRecord").''; } } - + print '
'; } - + print '
'; } else @@ -771,4 +773,4 @@ llxFooter(); $db->close(); -?> \ No newline at end of file +?> From 85eedfa6e71bde1f2d41664f3d627d9b7ff7047f Mon Sep 17 00:00:00 2001 From: simnandez Date: Mon, 27 Aug 2012 08:52:10 +0200 Subject: [PATCH 39/40] Fix: Bad assignation of const for pdf delivery module name --- htdocs/install/mysql/migration/repair.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index b68f4aa1bd67b..f14928a5db496 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -47,7 +47,7 @@ UPDATE llx_product SET canvas = NULL where canvas = 'default@product'; DELETE FROM llx_boxes where box_id NOT IN (SELECT rowid FROM llx_boxes_def); -UPDATE llx_document_model SET nom='typhon' WHERE nom ='elevement' AND type='delivery'; +DELETE FROM llx_document_model WHERE nom ='elevement' AND type='delivery'; -- VMYSQL4.1 DELETE T1 FROM llx_boxes_def as T1, llx_boxes_def as T2 where T1.entity = T2.entity AND T1.file = T2.file AND T1.note = T2.note and T1.rowid > T2.rowid -- VPGSQL8.2 DELETE FROM llx_boxes_def as T1 WHERE rowid NOT IN (SELECT min(rowid) FROM llx_boxes_def GROUP BY file, entity, note) From 849dc8c83606198d2a8c93c0d6976464a968b663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Tue, 28 Aug 2012 07:08:10 +0200 Subject: [PATCH 40/40] Added me to the COPYRIGHT file --- COPYRIGHT | 1 + 1 file changed, 1 insertion(+) diff --git a/COPYRIGHT b/COPYRIGHT index a86542700a257..d368f02d2e1c3 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -51,6 +51,7 @@ Copyright (C) 2012 - Juanjo Menent - Philippe Grand - Jean Heimburger +- Marcos García Copyright (C) 2011 - Laurent Destailleur