From 659570a6ab69a663f2a638b08777e4e7b1207031 Mon Sep 17 00:00:00 2001 From: jean Date: Mon, 4 May 2015 11:56:02 +0200 Subject: [PATCH 01/19] add a script for migrating pictures of products --- scripts/product/migrate_picture_path.php | 136 +++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100755 scripts/product/migrate_picture_path.php diff --git a/scripts/product/migrate_picture_path.php b/scripts/product/migrate_picture_path.php new file mode 100755 index 00000000000..272e56e3a42 --- /dev/null +++ b/scripts/product/migrate_picture_path.php @@ -0,0 +1,136 @@ +#!/usr/bin/php + + * Copyright (C) 2015 Jean Heimburger + * + * 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 scripts/product/migrate_picture_path.php + * \ingroup scripts + * \brief migrate pictures from old system to 3.7 and more system + * + */ + +$sapi_type = php_sapi_name(); +$script_file = basename(__FILE__); +$path=dirname(__FILE__).'/'; + +// Test if batch mode +if (substr($sapi_type, 0, 3) == 'cgi') { + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; + exit(-1); +} + +// Global variables +$version='1.0'; +$error=0; + + +// -------------------- START OF YOUR CODE HERE -------------------- +@set_time_limit(0); // No timeout for this script +define('EVEN_IF_ONLY_LOGIN_ALLOWED',1); // Set this define to 0 if you want to lock your script when dolibarr setup is "locked to admin user only". + +// Include and load Dolibarr environment variables +require_once($path."../../htdocs/master.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); +require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); +// After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file). +// $user is created but empty. + +//$langs->setDefaultLang('en_US'); // To change default language of $langs +$langs->load("main"); // To load language file for default language + + +print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; + +print '--- start'."\n"; + +function migrate_product_photospath($product) +{ + global $conf; + + $dir = $conf->product->multidir_output[$product->entity]; + $origin = $dir .'/'. get_exdir($product->id,2) . $product->id ."/photos"; + $destin = $dir.'/'.dol_sanitizeFileName($product->ref); + + $error = 0; + + $origin_osencoded=dol_osencode($origin); + $destin_osencoded=dol_osencode($destin); + dol_mkdir($destin); + + if (dol_is_dir($origin)) + { + $handle=opendir($origin_osencoded); + if (is_resource($handle)) + { + while (($file = readdir($handle)) != false) + { + if ($file != '.' && $file != '..' && is_dir($origin_osencoded.'/'.$file)) + { + $thumbs = opendir($origin_osencoded.'/'.$file); + if (is_resource($thumbs)) + { + dol_mkdir($destin.'/'.$file); + while (($thumb = readdir($thumbs)) != false) + { + dol_move($origin.'/'.$file.'/'.$thumb, $destin.'/'.$file.'/'.$thumb); + } +// dol_delete_dir($origin.'/'.$file); + } + } + else + { + if (dol_is_file($origin.'/'.$file) ) + { + dol_move($origin.'/'.$file, $destin.'/'.$file); + } + + } + } + } + } +} + +$product = new Product($db); + +$sql = "SELECT rowid as pid from ".MAIN_DB_PREFIX."product "; + +$resql = $db->query($sql); + +if (!resql ) +{ + print "\n sql error ".$sql; + exit; +} + +while ($obj = $db->fetch_object($resql)) +{ + print "\n migrating ".$product->ref; + $product->fetch($obj->pid); + migrate_product_photospath($product); +} + + + + + +// -------------------- END OF YOUR CODE -------------------- + + +$db->close(); // Close $db database opened handler + +exit($error); From 91885c9d6fee6c785f3de70a059d07b185669043 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Fri, 22 May 2015 17:22:57 +0200 Subject: [PATCH 02/19] FIX when multicompany was enabled, this function didn't check just on the good entity (problem when both company use same mask) --- htdocs/core/class/commonobject.class.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e0bab998982..10e83d80595 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -65,13 +65,17 @@ abstract class CommonObject */ static function isExistingObject($element, $id, $ref='', $ref_ext='') { - global $db; + global $db,$conf; $sql = "SELECT rowid, ref, ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX.$element; - if ($id > 0) $sql.= " WHERE rowid = ".$db->escape($id); - else if ($ref) $sql.= " WHERE ref = '".$db->escape($ref)."'"; - else if ($ref_ext) $sql.= " WHERE ref_ext = '".$db->escape($ref_ext)."'"; + + if($conf->multicompany->enabled)$sql.= " WHERE entity=".$conf->entity; + else $sql.=" WHERE 1 "; + + if ($id > 0) $sql.= " AND rowid = ".$db->escape($id); + else if ($ref) $sql.= " AND ref = '".$db->escape($ref)."'"; + else if ($ref_ext) $sql.= " AND ref_ext = '".$db->escape($ref_ext)."'"; else { $error='ErrorWrongParameters'; dol_print_error(get_class()."::isExistingObject ".$error, LOG_ERR); From 44c46d68ed4a443962dbdbb8d8ad130f9ee31f82 Mon Sep 17 00:00:00 2001 From: Alexis ALGOUD Date: Sat, 23 May 2015 23:51:49 +0200 Subject: [PATCH 03/19] Remove the useless if --- htdocs/core/class/commonobject.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 10e83d80595..73019b52eef 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -70,8 +70,7 @@ abstract class CommonObject $sql = "SELECT rowid, ref, ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX.$element; - if($conf->multicompany->enabled)$sql.= " WHERE entity=".$conf->entity; - else $sql.=" WHERE 1 "; + $sql.= " WHERE entity=".$conf->entity; if ($id > 0) $sql.= " AND rowid = ".$db->escape($id); else if ($ref) $sql.= " AND ref = '".$db->escape($ref)."'"; From dd7febe2b984f0ab2c60d435279e3a0a6374a5c0 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Fri, 29 May 2015 15:10:59 +0200 Subject: [PATCH 04/19] replace test by getEntity() --- htdocs/core/class/commonobject.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 10e83d80595..03d044a2ee6 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -69,9 +69,7 @@ abstract class CommonObject $sql = "SELECT rowid, ref, ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX.$element; - - if($conf->multicompany->enabled)$sql.= " WHERE entity=".$conf->entity; - else $sql.=" WHERE 1 "; + $sql.= " WHERE entity IN (".getEntity($element).")" ; if ($id > 0) $sql.= " AND rowid = ".$db->escape($id); else if ($ref) $sql.= " AND ref = '".$db->escape($ref)."'"; From 19694710b2fef16a94c34175421b25e6721fabfd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 May 2015 12:24:23 +0200 Subject: [PATCH 05/19] Keep this constant visible --- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index 5072b59ffdf..080fbdc699d 100755 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -1177,4 +1177,4 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_typ ALTER TABLE llx_livraison MODIFY COLUMN date_delivery DATETIME NULL DEFAULT NULL; -INSERT INTO llx_const (name, value, type, note, visible, entity) SELECT 'PRODUCT_USE_OLD_PATH_FOR_PHOTO','1','chaine','Use old path for products images',0,1 FROM llx_const WHERE name='MAIN_VERSION_LAST_INSTALL' AND value < '3.7.0'; \ No newline at end of file +INSERT INTO llx_const (name, value, type, note, visible, entity) SELECT 'PRODUCT_USE_OLD_PATH_FOR_PHOTO','1','chaine','Use old path for products images',1,1 FROM llx_const WHERE name='MAIN_VERSION_LAST_INSTALL' AND value < '3.7.0'; From 227f2842c2f5bef4446e0a9daac9b749a667517e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 May 2015 18:03:24 +0200 Subject: [PATCH 06/19] Prepare version 3.7.1 --- ChangeLog | 4 ++-- build/makepack-dolibarr.pl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e8e4028619b..91d602ab417 100644 --- a/ChangeLog +++ b/ChangeLog @@ -202,8 +202,8 @@ Dolibarr better: - Table llx_c_pays were renamed into llx_c_country. - Triggers *_BUILDDOC are removed. Building a doc is not a business event. For action after creation of a pdf or odt, hook "afterPDFCreation" or "afterODTCreation" must be used instead. -- A lot of pages called fiche.php were renamed into card.php -- A lot of pages called liste.php were renamed into list.php +- A lot of pages named fiche.php were renamed into card.php +- A lot of pages named liste.php were renamed into list.php - If you used warehouse/stock module, recheck setup of stock increase/decrease rules of the warehouse module and your Point Of Sale module setup if you use one. - Replaced USER_UPDATE_SESSION trigger with an updateSession hook may break modules using it. diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index c667754d4ab..f5d556eb2c5 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -981,10 +981,10 @@ if ($nboftargetok) { mkdir($DESTI.'/package_windows'); if (-d $DESTI.'/package_windows') { $NEWDESTI=$DESTI.'/package_windows'; } - print "Remove target $FILENAMEEXEDOLIWAMP.exe...\n"; + print "Remove target $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe...\n"; unlink "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"; - print "Check that in your Wine setup, you create a Z: drive that point to your /tmp directory.\n"; + print "Check that in your Wine setup, you create a Z: drive that point to your / directory.\n"; $SOURCEBACK=$SOURCE; $SOURCEBACK =~ s/\//\\/g; From 9753097731f56a558b14abde3c9141726e6ab963 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 May 2015 18:45:01 +0200 Subject: [PATCH 07/19] Prepare 3.7.1 --- ChangeLog | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 91d602ab417..31a6c7266a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,14 +10,31 @@ make a Dolibarr upgrade. ***** ChangeLog for 3.7.1 compared to 3.7.* ***** -- Fix: Bug in the new photo system -- Fix: Error management -- Fix: [ Bug #2714 ] Members -> Memberxy-> Agenda -> technical Error -- Fix: [ Bug #2713 ] 3.7.0 mailing-unsubscribe.php not unsubscribe +FIX Bug in the new photo system +FIX Error management +FIX [ Bug #2714 ] Members -> Memberxy-> Agenda -> technical Error +FIX [ Bug #2713 ] 3.7.0 mailing-unsubscribe.php not unsubscribe +FIX #2901 +FIX when we create an agenda event with "Not applicable" status, it is automatically saved with "To do" status +FIX check the user status during authentication +FIX top links menu have target attribute with wrong value +FIX extrafields required on thirdparty +FIX create contact with extrafield is null when it is require +FIX width multiselect +FIX "script" tag with wrong syntax +Fix bug debian 786479 +FIX update usergroup name +Fix facturestats was not filtering on invoice type +FIX #2856 : Wrong table design +FIX button create payment hide if tax amount is less than 1 +FIX event for restricted user was restricted if company null +FIX send mail, copy sendto don't read the list of contact +FIX Properly escape untrusted data to prevent HTML injection. +FIX send mail, copy sendto don't read the list of contact -- Path to save photos of products was moved in 3.7.0 to match path of other attached files. If you had loose - your photo on the photo tab of products, you can set the constant "PRODUCT_USE_OLD_PATH_FOR_PHOTO" to - restore old path. +Path to save photos of products was moved in 3.7.0 to match path of other attached files. If you had loose +your photo on the photo tab of products, you can set the constant "PRODUCT_USE_OLD_PATH_FOR_PHOTO" to +restore old path. WARNING: From cf4308aa3b7d354de7886c60721c29e782975f13 Mon Sep 17 00:00:00 2001 From: Gauthier Date: Mon, 1 Jun 2015 11:24:30 +0200 Subject: [PATCH 08/19] FIX : When we automatically creta an order from a proposal with workflow module, if some extrafields of propal don't exist in order object, insertExtraFields() function tries to insert extrafields in unexistant column of commande_extrafields table. --- htdocs/commande/class/commande.class.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index e58ad890f58..0564c60ef4b 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -976,7 +976,9 @@ class Commande extends CommonOrder */ function createFromProposal($object) { - global $conf,$user,$langs,$hookmanager; + global $db, $conf,$user,$langs,$hookmanager; + + dol_include_once('/core/class/extrafields.class.php'); $error=0; @@ -1046,9 +1048,15 @@ class Commande extends CommonOrder // get extrafields from original line $object->fetch_optionals($object->id); - foreach($object->array_options as $options_key => $value) - $this->array_options[$options_key] = $value; - + + $e = new ExtraFields($db); + $element_extrafields = $e->fetch_name_optionals_label($this->element); + + foreach($object->array_options as $options_key => $value) { + if(array_key_exists(str_replace('options_', '', $options_key), $element_extrafields)){ + $this->array_options[$options_key] = $value; + } + } // Possibility to add external linked objects with hooks $this->linked_objects[$this->origin] = $this->origin_id; if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects)) @@ -1657,6 +1665,7 @@ class Commande extends CommonOrder $i++; } + $this->db->free($result); return 1; From 0523f226cfba8f0527a9e483920837fa8d6b71c4 Mon Sep 17 00:00:00 2001 From: phf Date: Mon, 1 Jun 2015 12:29:10 +0200 Subject: [PATCH 09/19] FIX : when mailing is deleted, the targets list was kept in database --- htdocs/comm/mailing/class/mailing.class.php | 25 ++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 69a3520d1e8..1df5a7ad18f 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -421,7 +421,7 @@ class Mailing extends CommonObject $resql=$this->db->query($sql); if ($resql) { - return 1; + return $this->delete_targets(); } else { @@ -429,6 +429,29 @@ class Mailing extends CommonObject return -1; } } + + /** + * Delete targets emailing + * + * @return int 1 if OK, 0 if error + */ + function delete_targets() + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles"; + $sql.= " WHERE fk_mailing = ".$this->id; + + dol_syslog("Mailing::delete_targets", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + return 1; + } + else + { + $this->error=$this->db->lasterror(); + return 0; + } + } /** From f0257d02b5d12dc754f0e912e22b42796806e8b7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Jun 2015 16:31:25 +0200 Subject: [PATCH 10/19] Minor fix --- scripts/product/migrate_picture_path.php | 112 +++++++++++++---------- 1 file changed, 62 insertions(+), 50 deletions(-) diff --git a/scripts/product/migrate_picture_path.php b/scripts/product/migrate_picture_path.php index 272e56e3a42..a03e2549006 100755 --- a/scripts/product/migrate_picture_path.php +++ b/scripts/product/migrate_picture_path.php @@ -20,8 +20,8 @@ /** * \file scripts/product/migrate_picture_path.php * \ingroup scripts - * \brief migrate pictures from old system to 3.7 and more system - * + * \brief Migrate pictures from old system prior to 3.7 to new path for 3.7+ + * */ $sapi_type = php_sapi_name(); @@ -34,12 +34,6 @@ if (substr($sapi_type, 0, 3) == 'cgi') { exit(-1); } -// Global variables -$version='1.0'; -$error=0; - - -// -------------------- START OF YOUR CODE HERE -------------------- @set_time_limit(0); // No timeout for this script define('EVEN_IF_ONLY_LOGIN_ALLOWED',1); // Set this define to 0 if you want to lock your script when dolibarr setup is "locked to admin user only". @@ -54,24 +48,72 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); $langs->load("main"); // To load language file for default language +// Global variables +$version=DOL_VERSION; +$error=0; +$forcecommit=0; + + print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; +dol_syslog($script_file." launched with arg ".join(',',$argv)); + +if (! isset($argv[1]) || $argv[1] != 'product') { + print "Usage: $script_file product\n"; + exit(-1); +} print '--- start'."\n"; +// Case to migrate products path +if ($argv[1] == 'product') +{ + $product = new Product($db); + + $sql = "SELECT rowid as pid from ".MAIN_DB_PREFIX."product"; // Get list of all products + $resql = $db->query($sql); + if ($resql) + { + while ($obj = $db->fetch_object($resql)) + { + $product->fetch($obj->pid); + print " migrating product id=".$product->id." ref=".$product->ref."\n"; + migrate_product_photospath($product); + } + } + else + { + print "\n sql error ".$sql; + exit; + } +} + + +$db->close(); // Close $db database opened handler + +exit($error); + + + +/** + * Migrate file from old path to new one for product $product + * + * @param Product $product Object product + * @return void + */ function migrate_product_photospath($product) { global $conf; - + $dir = $conf->product->multidir_output[$product->entity]; $origin = $dir .'/'. get_exdir($product->id,2) . $product->id ."/photos"; $destin = $dir.'/'.dol_sanitizeFileName($product->ref); - + $error = 0; - + $origin_osencoded=dol_osencode($origin); $destin_osencoded=dol_osencode($destin); dol_mkdir($destin); - + if (dol_is_dir($origin)) { $handle=opendir($origin_osencoded); @@ -84,53 +126,23 @@ function migrate_product_photospath($product) $thumbs = opendir($origin_osencoded.'/'.$file); if (is_resource($thumbs)) { - dol_mkdir($destin.'/'.$file); + dol_mkdir($destin.'/'.$file); while (($thumb = readdir($thumbs)) != false) { - dol_move($origin.'/'.$file.'/'.$thumb, $destin.'/'.$file.'/'.$thumb); + dol_move($origin.'/'.$file.'/'.$thumb, $destin.'/'.$file.'/'.$thumb); } -// dol_delete_dir($origin.'/'.$file); - } +// dol_delete_dir($origin.'/'.$file); + } } - else + else { - if (dol_is_file($origin.'/'.$file) ) + if (dol_is_file($origin.'/'.$file) ) { dol_move($origin.'/'.$file, $destin.'/'.$file); } - - } + + } } } } } - -$product = new Product($db); - -$sql = "SELECT rowid as pid from ".MAIN_DB_PREFIX."product "; - -$resql = $db->query($sql); - -if (!resql ) -{ - print "\n sql error ".$sql; - exit; -} - -while ($obj = $db->fetch_object($resql)) -{ - print "\n migrating ".$product->ref; - $product->fetch($obj->pid); - migrate_product_photospath($product); -} - - - - - -// -------------------- END OF YOUR CODE -------------------- - - -$db->close(); // Close $db database opened handler - -exit($error); From 4f75ab79dbce0faae28a81abcc81aa6daf9c8a51 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Jun 2015 16:32:33 +0200 Subject: [PATCH 11/19] Prepare 3.7.2 --- build/debian/changelog | 2 +- htdocs/filefunc.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/debian/changelog b/build/debian/changelog index 134fc188abe..98caa12a1d3 100644 --- a/build/debian/changelog +++ b/build/debian/changelog @@ -1,4 +1,4 @@ -dolibarr (3.7.1-3) UNRELEASED; urgency=low +dolibarr (3.7.2-3) UNRELEASED; urgency=low [ Laurent Destailleur (eldy) ] * New upstream release. diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index a742464606d..716a647240a 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -29,7 +29,7 @@ * \brief File that include conf.php file and commons lib like functions.lib.php */ -if (! defined('DOL_VERSION')) define('DOL_VERSION','3.7.1'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','3.7.2'); if (! defined('EURO')) define('EURO',chr(128)); // Define syslog constants From 6e72d3c8cc13972a845a8e868ac32ddaa71901e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Jun 2015 21:34:21 +0200 Subject: [PATCH 12/19] FIX Export of tags for contact and member --- htdocs/core/modules/modCategorie.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index 327608c8814..a1bc1aa215e 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -162,7 +162,7 @@ class modCategorie extends DolibarrModules $this->export_enabled[$r]='$conf->adherent->enabled'; $this->export_permission[$r]=array(array("categorie","lire"),array("adherent","lire")); $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'MemberId','p.lastname'=>'LastName','p.firstname'=>'Firstname'); - $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.rowid'=>'List:adherent:nom','p.lastname'=>'Text','p.firstname'=>'Text'); + $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.lastname'=>'Text','p.firstname'=>'Text'); $this->export_entities_array[$r]=array('p.rowid'=>'member','p.lastname'=>'member','p.firstname'=>'member'); // We define here only fields that use another picto $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_member as cp, '.MAIN_DB_PREFIX.'adherent as p'; @@ -202,7 +202,6 @@ class modCategorie extends DolibarrModules $this->export_TypeFields_array[$r] = array ( 'u.label' => "Text", 'u.description' => "Text", - 'p.rowid' => 'List:contact:lastname', 'p.lastname' => 'Text', 'p.firstname' => 'Text' ); From 3f1613197e006e29163b4cdaa1e4c2519827e217 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 2 Jun 2015 08:41:42 +0200 Subject: [PATCH 13/19] FIX : If supplier invoice block linked element is display after other block total HT amount is not reset to 0 and sum other block (like customer orders values) --- htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php index c10fea8bb8a..2f66049143e 100644 --- a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php @@ -40,6 +40,7 @@ else print_titre($langs->trans("RelatedBill")); trans("Status"); ?> Date: Tue, 2 Jun 2015 11:20:08 +0200 Subject: [PATCH 14/19] FIX : total amount in tpl linked object are not reset --- htdocs/expedition/tpl/linkedobjectblock.tpl.php | 1 + htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/expedition/tpl/linkedobjectblock.tpl.php b/htdocs/expedition/tpl/linkedobjectblock.tpl.php index 364afb92177..a235944bff8 100644 --- a/htdocs/expedition/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expedition/tpl/linkedobjectblock.tpl.php @@ -41,6 +41,7 @@ print_titre($langs->trans('RelatedShippings')); trans("Status"); ?> trans('RelatedOrders')); trans("Status"); ?> Date: Tue, 2 Jun 2015 16:06:03 +0200 Subject: [PATCH 15/19] FIX : When we clone a propal, if it has a project which is not assigned to a third, it was not on new propal because fk_project was always set to empty string if new propal is for another third. --- htdocs/comm/propal/class/propal.class.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 3a8c9c6c0ae..775e1ad2782 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -959,8 +959,10 @@ class Propal extends CommonObject */ function createFromClone($socid=0) { - global $user,$langs,$conf,$hookmanager; - + global $db, $user,$langs,$conf,$hookmanager; + + dol_include_once('/projet/class.project.class.php'); + $this->context['createfromclone']='createfromclone'; $error=0; @@ -985,7 +987,16 @@ class Propal extends CommonObject $this->socid = $objsoc->id; $this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); $this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); - $this->fk_project = ''; + + $project = new Project($db); + + if($objFrom->fk_project > 0 && $project->fetch($objFrom->fk_project)) { + if($project->socid <= 0) $this->fk_project = $objFrom->fk_project; + else $this->fk_project = ''; + } else { + $this->fk_project = ''; + } + $this->fk_delivery_address = ''; } From f437bd2d6da63002ad366ea5bead1253d27fa98a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Jun 2015 21:21:20 +0200 Subject: [PATCH 16/19] FIX No check warehouse is provided if module stock is not enabled. --- htdocs/expedition/class/expedition.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 9b3b1018f50..4716ba4ae88 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -752,10 +752,11 @@ class Expedition extends CommonObject $orderline = new OrderLine($this->db); $orderline->fetch($id); - $fk_product = $orderline->fk_product; - if (! empty($orderline->fk_product)) + if (! empty($conf->stock->enabled) && ! empty($orderline->fk_product)) { + $fk_product = $orderline->fk_product; + if (! ($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS)) { $this->error=$langs->trans("ErrorWarehouseRequiredIntoShipmentLine"); From 195a1b2708655a2d62d00879c574e93d22d7bcdc Mon Sep 17 00:00:00 2001 From: jfefe Date: Thu, 4 Jun 2015 18:10:29 +0200 Subject: [PATCH 17/19] FIX #2957 : missing $langs object for trigger --- htdocs/fourn/class/fournisseur.product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index b642926f802..140bc3d4230 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -156,7 +156,7 @@ class ProductFournisseur extends Product */ function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0) { - global $conf,$mysoc; + global $conf,$mysoc, $langs; // Clean parameter if (empty($qty)) $qty=0; From e78dba809be12d616226a3faa9195c799e7ecbc7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 4 Jun 2015 15:42:51 +0200 Subject: [PATCH 18/19] Fix: PRODUCT_USE_OLD_PATH_FOR_PHOTO use entity 0 for multicompany Fix: use encrypt/decrypt with llx_const for experimental encryption of sensitive data --- .../install/mysql/migration/3.6.0-3.7.0.sql | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index 080fbdc699d..b74c8ddba17 100755 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -98,36 +98,36 @@ ALTER TABLE llx_accountingaccount add column fk_user_author integer DEFAULT NULL ALTER TABLE llx_accountingaccount add column fk_user_modif integer DEFAULT NULL AFTER fk_user_author; -- Qual -UPDATE llx_const SET name = 'ACCOUNTING_MODE' WHERE name = 'COMPTA_MODE'; -UPDATE llx_const SET name = 'ACCOUNTING_ACCOUNT_CUSTOMER' WHERE name = 'COMPTA_ACCOUNT_CUSTOMER'; -UPDATE llx_const SET name = 'ACCOUNTING_ACCOUNT_SUPPLIER' WHERE name = 'COMPTA_ACCOUNT_SUPPLIER'; -UPDATE llx_const SET name = 'ACCOUNTING_PRODUCT_BUY_ACCOUNT' WHERE name = 'COMPTA_PRODUCT_BUY_ACCOUNT'; -UPDATE llx_const SET name = 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT' WHERE name = 'COMPTA_PRODUCT_SOLD_ACCOUNT'; -UPDATE llx_const SET name = 'ACCOUNTING_SERVICE_BUY_ACCOUNT' WHERE name = 'COMPTA_SERVICE_BUY_ACCOUNT'; -UPDATE llx_const SET name = 'ACCOUNTING_SERVICE_SOLD_ACCOUNT' WHERE name = 'COMPTA_SERVICE_SOLD_ACCOUNT'; -UPDATE llx_const SET name = 'ACCOUNTING_VAT_ACCOUNT' WHERE name = 'COMPTA_VAT_ACCOUNT'; -UPDATE llx_const SET name = 'ACCOUNTING_VAT_BUY_ACCOUNT' WHERE name = 'COMPTA_VAT_BUY_ACCOUNT'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_MODE')__ WHERE __DECRYPT('name')__ = 'COMPTA_MODE'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_ACCOUNT_CUSTOMER')__ WHERE __DECRYPT('name')__ = 'COMPTA_ACCOUNT_CUSTOMER'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_ACCOUNT_SUPPLIER')__ WHERE __DECRYPT('name')__ = 'COMPTA_ACCOUNT_SUPPLIER'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_PRODUCT_BUY_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'COMPTA_PRODUCT_BUY_ACCOUNT'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_PRODUCT_SOLD_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'COMPTA_PRODUCT_SOLD_ACCOUNT'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_SERVICE_BUY_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'COMPTA_SERVICE_BUY_ACCOUNT'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_SERVICE_SOLD_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'COMPTA_SERVICE_SOLD_ACCOUNT'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_VAT_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'COMPTA_VAT_ACCOUNT'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_VAT_BUY_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'COMPTA_VAT_BUY_ACCOUNT'; -- Compatibility with module Accounting Expert -UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_MODELCSV' WHERE name = 'ACCOUNTINGEX_MODELCSV'; -UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_SEPARATORCSV' WHERE name = 'ACCOUNTINGEX_SEPARATORCSV'; -UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_DATE' WHERE name = 'ACCOUNTINGEX_EXP_DATE'; -UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_PIECE' WHERE name = 'ACCOUNTINGEX_EXP_PIECE'; -UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_GLOBAL_ACCOUNT' WHERE name = 'ACCOUNTINGEX_EXP_GLOBAL_ACCOUNT'; -UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_LABEL' WHERE name = 'ACCOUNTINGEX_EXP_LABEL'; -UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_AMOUNT' WHERE name = 'ACCOUNTINGEX_EXP_AMOUNT'; -UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_DEVISE' WHERE name = 'ACCOUNTINGEX_EXP_DEVISE'; -UPDATE llx_const SET name = 'ACCOUNTING_ACCOUNT_SUSPENSE' WHERE name = 'ACCOUNTINGEX_ACCOUNT_SUSPENSE'; -UPDATE llx_const SET name = 'ACCOUNTING_SELL_JOURNAL' WHERE name = 'ACCOUNTINGEX_SELL_JOURNAL'; -UPDATE llx_const SET name = 'ACCOUNTING_PURCHASE_JOURNAL' WHERE name = 'ACCOUNTINGEX_PURCHASE_JOURNAL'; -UPDATE llx_const SET name = 'ACCOUNTING_SOCIAL_JOURNAL' WHERE name = 'ACCOUNTINGEX_SOCIAL_JOURNAL'; -UPDATE llx_const SET name = 'ACCOUNTING_MISCELLANEOUS_JOURNAL' WHERE name = 'ACCOUNTINGEX_MISCELLANEOUS_JOURNAL'; -UPDATE llx_const SET name = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH' WHERE name = 'ACCOUNTINGEX_ACCOUNT_TRANSFER_CASH'; -UPDATE llx_const SET name = 'ACCOUNTING_LENGTH_GACCOUNT' WHERE name = 'ACCOUNTINGEX_LENGTH_GACCOUNT'; -UPDATE llx_const SET name = 'ACCOUNTING_LENGTH_AACCOUNT' WHERE name = 'ACCOUNTINGEX_LENGTH_AACCOUNT'; -UPDATE llx_const SET name = 'ACCOUNTING_LIMIT_LIST_VENTILATION' WHERE name = 'ACCOUNTINGEX_LIMIT_LIST_VENTILATION'; -UPDATE llx_const SET name = 'ACCOUNTING_LIST_SORT_VENTILATION_TODO' WHERE name = 'ACCOUNTINGEX_LIST_SORT_VENTILATION_TODO'; -UPDATE llx_const SET name = 'ACCOUNTING_LIST_SORT_VENTILATION_DONE' WHERE name = 'ACCOUNTINGEX_LIST_SORT_VENTILATION_DONE'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_MODELCSV')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_MODELCSV'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_SEPARATORCSV')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_SEPARATORCSV'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_DATE')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_EXP_DATE'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_PIECE')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_EXP_PIECE'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_GLOBAL_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_EXP_GLOBAL_ACCOUNT'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_LABEL')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_EXP_LABEL'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_AMOUNT')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_EXP_AMOUNT'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_DEVISE')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_EXP_DEVISE'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_ACCOUNT_SUSPENSE')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_ACCOUNT_SUSPENSE'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_SELL_JOURNAL')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_SELL_JOURNAL'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_PURCHASE_JOURNAL')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_PURCHASE_JOURNAL'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_SOCIAL_JOURNAL')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_SOCIAL_JOURNAL'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_MISCELLANEOUS_JOURNAL')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_MISCELLANEOUS_JOURNAL'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_ACCOUNT_TRANSFER_CASH')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_ACCOUNT_TRANSFER_CASH'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_LENGTH_GACCOUNT')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_LENGTH_GACCOUNT'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_LENGTH_AACCOUNT')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_LENGTH_AACCOUNT'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_LIMIT_LIST_VENTILATION')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_LIMIT_LIST_VENTILATION'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_LIST_SORT_VENTILATION_TODO')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_LIST_SORT_VENTILATION_TODO'; +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_LIST_SORT_VENTILATION_DONE')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_LIST_SORT_VENTILATION_DONE'; -- Drop old table DROP TABLE llx_compta; @@ -1133,9 +1133,9 @@ ALTER TABLE llx_c_email_templates ADD UNIQUE INDEX uk_c_email_templates(entity, ALTER TABLE llx_c_email_templates ADD INDEX idx_type(type_template); -- Remove OSC module -DELETE FROM llx_const WHERE name = 'MAIN_MODULE_BOUTIQUE'; -DELETE FROM llx_const WHERE name = 'OSC_DB_HOST'; -DELETE FROM llx_menu WHERE module = 'boutique'; +DELETE FROM llx_const WHERE __DECRYPT('name')__ = 'MAIN_MODULE_BOUTIQUE'; +DELETE FROM llx_const WHERE __DECRYPT('name')__ = 'OSC_DB_HOST'; +DELETE FROM llx_menu WHERE __DECRYPT('module')__ = 'boutique'; -- Add option always editable on extrafield ALTER TABLE llx_extrafields ADD alwayseditable INTEGER DEFAULT 0 AFTER pos; @@ -1177,4 +1177,4 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_typ ALTER TABLE llx_livraison MODIFY COLUMN date_delivery DATETIME NULL DEFAULT NULL; -INSERT INTO llx_const (name, value, type, note, visible, entity) SELECT 'PRODUCT_USE_OLD_PATH_FOR_PHOTO','1','chaine','Use old path for products images',1,1 FROM llx_const WHERE name='MAIN_VERSION_LAST_INSTALL' AND value < '3.7.0'; +INSERT INTO llx_const (name, value, type, note, visible, entity) SELECT __ENCRYPT('PRODUCT_USE_OLD_PATH_FOR_PHOTO')__,__ENCRYPT('1')__,'chaine','Use old path for products images',1,0 FROM llx_const WHERE __DECRYPT('name')__ = 'MAIN_VERSION_LAST_INSTALL' AND __DECRYPT('value')__ <= '3.7.2'; From f7493de50c4c16bf698f04b4d887a9f67442a1d7 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 5 Jun 2015 13:42:29 +0200 Subject: [PATCH 19/19] Fix : supplier order clone was buggy if notes contains apostrophe --- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 8e618ba0eee..b69818bbdb1 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -911,8 +911,8 @@ class CommandeFournisseur extends CommonOrder $sql.= " VALUES ("; $sql.= "''"; $sql.= ", '".$this->ref_supplier."'"; - $sql.= ", '".$this->note_private."'"; - $sql.= ", '".$this->note_public."'"; + $sql.= ", '".$this->db->escape($this->note_private)."'"; + $sql.= ", '".$this->db->escape($this->note_public)."'"; $sql.= ", ".$conf->entity; $sql.= ", ".$this->socid; $sql.= ", '".$this->db->idate($now)."'";