From 56245e2c9a888da1d84d02b5dbca99602975bd23 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 4 Oct 2016 16:51:44 +0200 Subject: [PATCH 01/20] FIX: only show projects of related third if external user --- htdocs/core/boxes/box_project.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 7d819ec0d2b..1db7b5729db 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -2,6 +2,7 @@ /* Copyright (C) 2012-2014 Charles-François BENKE * Copyright (C) 2014 Marcos García * Copyright (C) 2015 Frederic France + * Copyright (C) 2016 Juan José 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 @@ -79,8 +80,10 @@ class box_project extends ModeleBoxes $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut "; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; + if($user->socid) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=p.fk_soc"; $sql.= " WHERE p.entity = ".$conf->entity; - $sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts + if($user->socid) $sql.= " AND s.rowid = ".$user->socid; + $sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts $sql.= " ORDER BY p.datec DESC"; $sql.= $db->plimit($max, 0); From ee20704a8a1902319adcba6c4811d20113fd9e68 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 5 Oct 2016 17:20:56 +0200 Subject: [PATCH 02/20] FIX : missing column into SQL on thridparty list --- htdocs/societe/list.php | 43 +++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 93e757278c6..01d3c95270b 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -166,7 +166,7 @@ $arrayfields=array( // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); } @@ -342,6 +342,7 @@ $sql.= " st.libelle as stcomm, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.p $sql.= " s.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idprof4, s.fk_pays,"; $sql.= " s.tms as date_update, s.datec as date_creation,"; $sql.= " typent.code as typent_code"; +$sql.= " ,s.code_compta,s.code_compta_fournisseur"; // We'll need these fields in order to filter by sale (including the case where the user can only see his prospects) if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user"; // We'll need these fields in order to filter by categ @@ -403,7 +404,7 @@ foreach ($search_array_options as $key => $val) $typ=$extrafields->attribute_type[$tmpkey]; $mode=0; if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric - if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) + if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) { $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); } @@ -462,8 +463,8 @@ if ($resql) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); - } - + } + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies'); // Show delete result message @@ -491,13 +492,13 @@ if ($resql) print ''; print ''; print ''; - + if ($search_all) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); } - + // Filter on categories $moreforfilter=''; if ($type == 'c' || $type == 'p') @@ -542,7 +543,7 @@ if ($resql) $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - + print ''; print ''; @@ -568,9 +569,9 @@ if ($resql) // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { - if (! empty($arrayfields["ef.".$key]['checked'])) + if (! empty($arrayfields["ef.".$key]['checked'])) { $align=$extrafields->getAlignFlag($key); print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); @@ -701,7 +702,7 @@ if ($resql) print ''; print ''; } - + // Type (customer/prospect/supplier) print ''; - + if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) { // Prospect level @@ -732,15 +733,15 @@ if ($resql) $options_to .= $langs->trans($tab_level_label); $options_to .= ''; } - + // Print these two select print $langs->trans("From").' '; print ' '; print $langs->trans("to").' '; - + print ''; } - + if (! empty($arrayfields['s.fk_stcomm']['checked'])) { // Prospect status @@ -756,9 +757,9 @@ if ($resql) // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { - if (! empty($arrayfields["ef.".$key]['checked'])) + if (! empty($arrayfields["ef.".$key]['checked'])) { $align=$extrafields->getAlignFlag($key); $typeofextrafield=$extrafields->attribute_type[$key]; @@ -814,7 +815,7 @@ if ($resql) { $obj = $db->fetch_object($resql); $var=!$var; - + $companystatic->id=$obj->rowid; $companystatic->name=$obj->name; $companystatic->canvas=$obj->canvas; @@ -825,7 +826,7 @@ if ($resql) $companystatic->code_fournisseur=$obj->code_fournisseur; $companystatic->fk_prospectlevel=$obj->fk_prospectlevel; $companystatic->name_alias=$obj->name_alias; - + print ""; if (! empty($arrayfields['s.nom']['checked'])) { @@ -867,7 +868,7 @@ if ($resql) if (! empty($arrayfields['s.zip']['checked'])) { print "\n"; - } + } // Country if (! empty($arrayfields['country.code_iso']['checked'])) { @@ -957,9 +958,9 @@ if ($resql) // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { - if (! empty($arrayfields["ef.".$key]['checked'])) + if (! empty($arrayfields["ef.".$key]['checked'])) { print 'getAlignFlag($key); From b7b18e3355aaecb52c64cafc1aa03775d2c90af4 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 7 Oct 2016 10:12:25 +0200 Subject: [PATCH 03/20] FIX: Error when CATEGORIE_RECURSIV_ADD is enabled and new category is daughter of an already linked to object --- htdocs/categories/class/categorie.class.php | 31 +++++++++++++-------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index e1e44a475ed..6202fe6eb0a 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2006-2012 Regis Houssin * Copyright (C) 2006-2012 Laurent Destailleur * Copyright (C) 2007 Patrick Raguin - * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2013-2016 Juanjo Menent * Copyright (C) 2013 Philippe Grand * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Raphaël Doursenaud @@ -642,17 +642,24 @@ class Categorie extends CommonObject } else { - $this->db->rollback(); - if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') - { - $this->error=$this->db->lasterrno(); - return -3; - } - else - { - $this->error=$this->db->lasterror(); - } - return -1; + if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') + { + if (empty($conf->global->CATEGORIE_RECURSIV_ADD)) { + $this->db->rollback(); + $this->error = $this->db->lasterrno(); + return -3; + } + else { + $this->db->commit(); + return 1; + } + } + else + { + $this->db->rollback(); + $this->error=$this->db->lasterror(); + return -1; + } } } From 298e5cee61bc2ccc8a8def653f8a2415433e9d3b Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 7 Oct 2016 22:21:50 +0200 Subject: [PATCH 04/20] Fix #5843 best way fixing --- htdocs/categories/class/categorie.class.php | 28 +++++++++++++-------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 6202fe6eb0a..410f0f80682 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -558,6 +558,7 @@ class Categorie extends CommonObject global $user,$langs,$conf; $error=0; + $trigger=true; if ($this->id == -1) return -2; @@ -598,12 +599,16 @@ class Categorie extends CommonObject { $cat = new Categorie($this->db); $cat->id=$objparent->fk_parent; - $result=$cat->add_type($obj, $type); - if ($result < 0) - { - $this->error=$cat->error; - $error++; - } + + if (! $cat->containsObject($type,$obj->id)) { + $result=$cat->add_type($obj, $type); + if ($result < 0) { + $this->error=$cat->error; + $error++; + } + } else { + $trigger=false; + } } } } @@ -624,10 +629,13 @@ class Categorie extends CommonObject $this->linkto=$obj; // Call trigger - $result=$this->call_trigger('CATEGORY_LINK',$user); - if ($result < 0) { $error++; } - // End call triggers - + if ($trigger) { + $result = $this->call_trigger('CATEGORY_LINK', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } if (! $error) { $this->db->commit(); From 45dfb8ca628ee3e18fa782b4ef4962b3adb0f8ca Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 7 Oct 2016 22:32:11 +0200 Subject: [PATCH 05/20] Fix #5843 best way fixing --- htdocs/categories/class/categorie.class.php | 72 +++++++++------------ 1 file changed, 29 insertions(+), 43 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 410f0f80682..2b88eaae209 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -558,7 +558,6 @@ class Categorie extends CommonObject global $user,$langs,$conf; $error=0; - $trigger=true; if ($this->id == -1) return -2; @@ -591,26 +590,23 @@ class Categorie extends CommonObject $resql=$this->db->query($sql); if ($resql) { - if ($this->db->num_rows($resql) > 0) - { - $objparent = $this->db->fetch_object($resql); + if ($this->db->num_rows($resql) > 0) { + $objparent = $this->db->fetch_object($resql); - if (!empty($objparent->fk_parent)) - { - $cat = new Categorie($this->db); - $cat->id=$objparent->fk_parent; + if (!empty($objparent->fk_parent)) { + $cat = new Categorie($this->db); + $cat->id = $objparent->fk_parent; + + if (!$cat->containsObject($type, $obj->id)) { + $result = $cat->add_type($obj, $type); + if ($result < 0) { + $this->error = $cat->error; + $error++; + } - if (! $cat->containsObject($type,$obj->id)) { - $result=$cat->add_type($obj, $type); - if ($result < 0) { - $this->error=$cat->error; - $error++; - } - } else { - $trigger=false; } - } - } + } + } } else { @@ -629,13 +625,10 @@ class Categorie extends CommonObject $this->linkto=$obj; // Call trigger - if ($trigger) { - $result = $this->call_trigger('CATEGORY_LINK', $user); - if ($result < 0) { - $error++; - } - // End call triggers - } + $result=$this->call_trigger('CATEGORY_LINK',$user); + if ($result < 0) { $error++; } + // End call triggers + if (! $error) { $this->db->commit(); @@ -650,24 +643,17 @@ class Categorie extends CommonObject } else { - if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') - { - if (empty($conf->global->CATEGORIE_RECURSIV_ADD)) { - $this->db->rollback(); - $this->error = $this->db->lasterrno(); - return -3; - } - else { - $this->db->commit(); - return 1; - } - } - else - { - $this->db->rollback(); - $this->error=$this->db->lasterror(); - return -1; - } + $this->db->rollback(); + if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') + { + $this->error=$this->db->lasterrno(); + return -3; + } + else + { + $this->error=$this->db->lasterror(); + } + return -1; } } From ffd486e3d65067845b5be2d4de026a1382820216 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 7 Oct 2016 22:54:08 +0200 Subject: [PATCH 06/20] Fix #5843 best way fixing --- htdocs/categories/class/categorie.class.php | 31 +++++++++++---------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 2b88eaae209..b3cb3d9cc52 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -590,23 +590,24 @@ class Categorie extends CommonObject $resql=$this->db->query($sql); if ($resql) { - if ($this->db->num_rows($resql) > 0) { + if ($this->db->num_rows($resql) > 0) + { $objparent = $this->db->fetch_object($resql); - if (!empty($objparent->fk_parent)) { - $cat = new Categorie($this->db); - $cat->id = $objparent->fk_parent; - - if (!$cat->containsObject($type, $obj->id)) { - $result = $cat->add_type($obj, $type); - if ($result < 0) { - $this->error = $cat->error; - $error++; - } - - } - } - } + if (!empty($objparent->fk_parent)) + { + $cat = new Categorie($this->db); + $cat->id = $objparent->fk_parent; + if (!$cat->containsObject($type, $obj->id)) { + $result = $cat->add_type($obj, $type); + if ($result < 0) + { + $this->error = $cat->error; + $error++; + } + } + } + } } else { From 3eb8a667bcaaa6228310d725aab2dcc769049c3a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 Oct 2016 12:34:21 +0200 Subject: [PATCH 07/20] Fix clean of search criteria --- htdocs/projet/tasks/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 3d86cf3aeca..5573441d646 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -150,6 +150,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $day=''; $month=''; $year=''; + $search_array_options=array(); } if (empty($search_projectstatus) && $search_projectstatus == '') $search_projectstatus=1; From 24420edd46592ccc641aa02f2206437c38cf1290 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 Oct 2016 14:36:13 +0200 Subject: [PATCH 08/20] Prepare 4.0.2 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 129475812e1..b79e6ceeb92 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.1'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.2'); if (! defined('EURO')) define('EURO',chr(128)); From 0b08db16a10aa4e178b412dc56f80c5b346b34e1 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 13 Oct 2016 06:31:09 +0200 Subject: [PATCH 09/20] Fix: Missing language key --- htdocs/langs/en_US/main.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 150abc1b4b8..c61cc235b25 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -505,6 +505,7 @@ ReportPeriod=Report period ReportDescription=Description Report=Report Keyword=Keyword +Origin=Origin Legend=Legend Fill=Fill Reset=Reset From 567f7e5365ead8c4e0e372fbc62b65df3da2d330 Mon Sep 17 00:00:00 2001 From: Sergio Sanchis Climent Date: Fri, 14 Oct 2016 00:43:10 +0200 Subject: [PATCH 10/20] FIX: #5340 --- htdocs/core/modules/import/import_csv.modules.php | 4 ++++ htdocs/core/modules/modSociete.class.php | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index da59679b1be..2db005c5646 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -504,6 +504,10 @@ class ImportCsv extends ModeleImports } if (empty($newval)) $arrayrecord[($key-1)]['type']=-1; // If we get empty value, we will use "null" } + elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='numeric') + { + $newval = price2num($newval); + } //print 'Val to use as insert is '.$newval.'
'; } diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 778fd7a9865..5116f94ae24 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -405,7 +405,8 @@ class modSociete extends DolibarrModules 's.code_client'=>array('rule'=>'getcustomercodeifauto'), 's.code_fournisseur'=>array('rule'=>'getsuppliercodeifauto'), 's.code_compta'=>array('rule'=>'getcustomeraccountancycodeifauto'), - 's.code_compta_fournisseur'=>array('rule'=>'getsupplieraccountancycodeifauto') + 's.code_compta_fournisseur'=>array('rule'=>'getsupplieraccountancycodeifauto'), + 's.capital'=>array('rule'=>'numeric') ); //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); $this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.fk_typent'=>'id@'.MAIN_DB_PREFIX.'c_typent','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'); From 63a7b506b1991e4c8f4f03eb4770912d4f217706 Mon Sep 17 00:00:00 2001 From: Sergio Sanchis Date: Fri, 14 Oct 2016 10:55:54 +0200 Subject: [PATCH 11/20] Fix: Error if exist extrafield --- htdocs/compta/facture/list.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 796b0730c89..ce2843837df 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -767,6 +767,11 @@ if (! $sall) $sql.= ' f.datec, f.tms,'; $sql.= ' s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.code_client, s.client, typent.code'; $sql.= ' ,state.code_departement, state.nom'; + + foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by + { + $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : ''); + } } else { From 4fb66cf7a411592c76ca39224754a7dd91064c2f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 15 Oct 2016 02:11:49 +0200 Subject: [PATCH 12/20] Better explanation for ftp module setup to avoid error with FTPS/SFTP. --- htdocs/core/modules/modFTP.class.php | 5 ++++- htdocs/ftp/admin/ftpclient.php | 2 +- htdocs/ftp/index.php | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/modFTP.class.php b/htdocs/core/modules/modFTP.class.php index e7388faaedf..585c72d6eec 100644 --- a/htdocs/core/modules/modFTP.class.php +++ b/htdocs/core/modules/modFTP.class.php @@ -76,7 +76,10 @@ class modFTP extends DolibarrModules $this->requiredby = array(); // List of modules id to disable if this one is disabled // Constants - $this->const = array(); // List of parameters + $this->const = array( + 1=>array('FTP_CONNECT_WITH_SSL','chaine','0','Use FTPS for FTP module', 1, 'current', 1), + 2=>array('FTP_CONNECT_WITH_SFTP','chaine','0','Use SFTP for FTP module', 1, 'current', 1) + ); // List of parameters // Boxes $this->boxes = array(); // List of boxes diff --git a/htdocs/ftp/admin/ftpclient.php b/htdocs/ftp/admin/ftpclient.php index b0d6b4affa2..6f71e964321 100644 --- a/htdocs/ftp/admin/ftpclient.php +++ b/htdocs/ftp/admin/ftpclient.php @@ -173,7 +173,7 @@ else print '
'; print ''; print ''; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/ftp/index.php b/htdocs/ftp/index.php index 62bb22bf328..b3dc15125a5 100644 --- a/htdocs/ftp/index.php +++ b/htdocs/ftp/index.php @@ -458,7 +458,7 @@ else // Construit liste des repertoires - print '
'; print '
".$obj->zip."
'.$langs->trans("Port").'2121 for pure non crypted FTP or if option FTP_CONNECT_WITH_SSL (See Home-Setup-Other) is on (FTPS)
22 if option FTP_CONNECT_WITH_SFTP (See Home-Setup-Other) is on (SFTP)
'."\n"; + print '
'."\n"; print ''."\n"; print ''."\n"; From 49e2b1ffdb215d22cff7e3e1a1e2e508b5c9edb2 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 15 Oct 2016 06:56:38 +0200 Subject: [PATCH 13/20] Fix: Error with language key --- htdocs/langs/en_US/loan.lang | 2 +- htdocs/loan/payment/card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/loan.lang b/htdocs/langs/en_US/loan.lang index de0d5a0525f..37832bc94d1 100644 --- a/htdocs/langs/en_US/loan.lang +++ b/htdocs/langs/en_US/loan.lang @@ -3,7 +3,7 @@ Loan=Loan Loans=Loans NewLoan=New Loan ShowLoan=Show Loan -PaymentLoan=Loan payment +LoanPayment=Loan payment ShowLoanPayment=Show Loan Payment LoanCapital=Capital Insurance=Insurance diff --git a/htdocs/loan/payment/card.php b/htdocs/loan/payment/card.php index 9c1e938c3ed..342bfd04a7a 100644 --- a/htdocs/loan/payment/card.php +++ b/htdocs/loan/payment/card.php @@ -125,7 +125,7 @@ $head[$h][1] = $langs->trans("Card"); $hselected = $h; $h++; -dol_fiche_head($head, $hselected, $langs->trans("PaymentLoan"), 0, 'payment'); +dol_fiche_head($head, $hselected, $langs->trans("LoanPayment"), 0, 'payment'); /* * Confirm deletion of the payment From 380ab8bfa55d6b4291c721229d0496ca6c23db7a Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 15 Oct 2016 07:05:53 +0200 Subject: [PATCH 14/20] Fix: Show Ref/rowid of loan --- htdocs/compta/bank/account.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 10c52e657ab..99f7a224a3e 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -833,7 +833,7 @@ if ($id > 0 || ! empty($ref)) { $loanstatic->label=$links[$key]['label']; } - $loanstatic->ref=$loanstatic->label; + $loanstatic->ref=$links[$key]['url_id']; print $loanstatic->getLinkUrl(1,16); } else if ($links[$key]['type']=='member') From 1beaf003f055aec5427c8303e4ee90734fe45e26 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 15 Oct 2016 07:45:10 +0200 Subject: [PATCH 15/20] Fix #5875: Links to loans are incorrect in the bank account transactions tab --- htdocs/loan/class/paymentloan.class.php | 10 +++++----- htdocs/loan/payment/payment.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index 09c3e0b4fbc..5a0ad6b14fd 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2014-2016 Alexandre Spangaro * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify @@ -385,6 +385,7 @@ class PaymentLoan extends CommonObject * All payment properties must have been set first like after a call to create(). * * @param User $user Object of user making payment + * @param int $fk_loan Id of fk_loan to do link with this payment * @param string $mode 'payment_loan' * @param string $label Label to use in bank record * @param int $accountid Id of bank account to do link with @@ -392,7 +393,7 @@ class PaymentLoan extends CommonObject * @param string $emetteur_banque Name of bank * @return int <0 if KO, >0 if OK */ - function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque) + function addPaymentToBank($user, $fk_loan, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque) { global $conf; @@ -445,11 +446,10 @@ class PaymentLoan extends CommonObject } } - // Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment) - //$linkaddedforthirdparty=array(); + // Add link 'loan' in bank_url between invoice and bank transaction (for each invoice concerned by payment) if ($mode == 'payment_loan') { - $result=$acc->add_url_line($bank_line_id, $this->id, DOL_URL_ROOT.'/loan/card.php?id=', ($this->label?$this->label:''),'loan'); + $result=$acc->add_url_line($bank_line_id, $fk_loan, DOL_URL_ROOT.'/loan/card.php?id=', ($this->label?$this->label:''),'loan'); if ($result <= 0) dol_print_error($this->db); } } diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index 91c71e95e5a..f01eae369be 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -116,7 +116,7 @@ if ($action == 'add_payment') if (! $error) { - $result = $payment->addPaymentToBank($user, 'payment_loan', '(LoanPayment)', GETPOST('accountid', 'int'), '', ''); + $result = $payment->addPaymentToBank($user, $chid, 'payment_loan', '(LoanPayment)', GETPOST('accountid', 'int'), '', ''); if (! $result > 0) { setEventMessages($payment->error, $payment->errors, 'errors'); From 25ba5074a7648605181d88f22cdded5d46351fe6 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 15 Oct 2016 08:00:31 +0200 Subject: [PATCH 16/20] Fix: Problem of presentation --- htdocs/loan/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 63b62a3d156..0894447d485 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -491,7 +491,6 @@ if ($id > 0) print ''; print ''; print ''; - print ''; print ''; $var=True; From df581d89739cbf6793fbcb16b6eed946ac6baeb7 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 15 Oct 2016 08:07:01 +0200 Subject: [PATCH 17/20] Fix: In payment card, only the capital is considered as a payment, interest and insurance are tax --- htdocs/loan/payment/payment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index f01eae369be..ead01e9c6d7 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -175,7 +175,7 @@ if ($action == 'create') print '\n"; print ''; - $sql = "SELECT SUM(amount_capital + amount_insurance + amount_interest) as total"; + $sql = "SELECT SUM(amount_capital) as total"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_loan"; $sql.= " WHERE fk_loan = ".$chid; $resql = $db->query($sql); From 9ab0bfe905708775e182d68ff1cd492bd2f015bb Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 16 Oct 2016 06:50:13 +0200 Subject: [PATCH 18/20] Fix: Add another key for bank rather than to modify one --- htdocs/langs/en_US/loan.lang | 1 + htdocs/loan/payment/card.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/loan.lang b/htdocs/langs/en_US/loan.lang index 37832bc94d1..8c70dfc6fd2 100644 --- a/htdocs/langs/en_US/loan.lang +++ b/htdocs/langs/en_US/loan.lang @@ -3,6 +3,7 @@ Loan=Loan Loans=Loans NewLoan=New Loan ShowLoan=Show Loan +PaymentLoan=Loan payment LoanPayment=Loan payment ShowLoanPayment=Show Loan Payment LoanCapital=Capital diff --git a/htdocs/loan/payment/card.php b/htdocs/loan/payment/card.php index 342bfd04a7a..cd98bb75b5b 100644 --- a/htdocs/loan/payment/card.php +++ b/htdocs/loan/payment/card.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2014-2016 Alexandre Spangaro * * 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 @@ -125,7 +125,7 @@ $head[$h][1] = $langs->trans("Card"); $hselected = $h; $h++; -dol_fiche_head($head, $hselected, $langs->trans("LoanPayment"), 0, 'payment'); +dol_fiche_head($head, $hselected, $langs->trans("PaymentLoan"), 0, 'payment'); /* * Confirm deletion of the payment From 2695f3528424a586c50bcaafd4e056da0f55e265 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Oct 2016 11:40:10 +0200 Subject: [PATCH 19/20] Fix to avoid scroll on confirm popup --- htdocs/projet/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index dd111b62396..633633aad7f 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -631,7 +631,7 @@ else array('type' => 'checkbox', 'name' => 'clone_task_files', 'label' => $langs->trans("CloneTaskFiles"), 'value' => false) ); - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("CloneProject"), $langs->trans("ConfirmCloneProject"), "confirm_clone", $formquestion, '', 1, 240); + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("CloneProject"), $langs->trans("ConfirmCloneProject"), "confirm_clone", $formquestion, '', 1, 280); } From 8edb51a017acca58c950f68e9dadd92a021dc29e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Oct 2016 18:27:39 +0200 Subject: [PATCH 20/20] FIX Extra fields of task not copied on project cloning --- htdocs/projet/class/task.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 631b2684246..12799a6664f 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1239,6 +1239,9 @@ class Task extends CommonObject // Load source object $clone_task->fetch($fromid); + $clone_task->fetch_optionals(); + //var_dump($clone_task->array_options);exit; + $origin_task->fetch($fromid); $defaultref='';
'.$langs->trans("Content").''.$langs->trans("Insurance").''.$langs->trans("Interest").''.$langs->trans("LoanCapital").' 
'.$langs->trans("Label").''.$loan->label."
'.$langs->trans("Amount").''.price($loan->capital,0,$outputlangs,1,-1,-1,$conf->currency).'