From 56245e2c9a888da1d84d02b5dbca99602975bd23 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 4 Oct 2016 16:51:44 +0200 Subject: [PATCH 01/26] 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/26] 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/26] 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/26] 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/26] 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/26] 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 b2afe98060aabf0c00e8f6b1fab078e9e29e107d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 Oct 2016 12:20:14 +0200 Subject: [PATCH 07/26] Fix option unique of extrafields not saved --- htdocs/core/actions_extrafields.inc.php | 1 + htdocs/core/tpl/admin_extrafields_add.tpl.php | 39 ++++++++++--------- .../core/tpl/admin_extrafields_edit.tpl.php | 37 ++++++++++-------- htdocs/theme/eldy/style.css.php | 2 +- 4 files changed, 43 insertions(+), 36 deletions(-) diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index 6a162123ce0..afcf929589b 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -313,6 +313,7 @@ if ($action == 'update') $params['options'][$key] = $value; } } + $result=$extrafields->update( GETPOST('attrname'), GETPOST('label'), diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index acf7a041408..a316da81553 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -38,14 +38,14 @@ var alwayseditable = jQuery("#alwayseditable"); var list = jQuery("#list"); @@ -56,24 +56,27 @@ else if (type == 'int') { size.val('10').removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} else if (type == 'text') { size.val('2000').removeAttr('disabled'); unique.prop('disabled', true).removeAttr('checked'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } else if (type == 'varchar') { size.val('255').removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } - else if (type == 'boolean') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} - else if (type == 'price') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} - else if (type == 'select') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else if (type == 'link') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();} - else if (type == 'sellist') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").show();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else if (type == 'radio') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else if (type == 'checkbox') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else if (type == 'chkbxlst') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();jQuery("#helplink").hide();} - else if (type == 'separate') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else size.val('').prop('disabled', true); + else if (type == 'boolean') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} + else if (type == 'price') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} + else if (type == 'select') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else if (type == 'sellist') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").show();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else if (type == 'radio') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else if (type == 'checkbox') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else if (type == 'chkbxlst') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();jQuery("#helplink").hide();} + else if (type == 'link') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();} + else if (type == 'separate') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else { // type = string + size.val('').prop('disabled', true); + unique.removeAttr('disabled'); + } if (type == 'separate') { - alwayseditable.val('').prop('disabled', true); list.val('').prop('disabled', true); + unique.removeAttr('checked').prop('disabled', true); required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.val('').prop('disabled', true); } else { - alwayseditable.val('').removeAttr('disabled'); list.val('').removeAttr('disabled'); + required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.val('').removeAttr('disabled'); } } init_typeoffields(''); @@ -123,14 +126,14 @@ - + - + - +global->MAIN_CAN_HIDE_EXTRAFIELDS)) { ?> - +global->MAIN_FEATURES_LEVEL >= 2) { ?> diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 94132731829..6788a24baaa 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -37,7 +37,7 @@ if (GETPOST('type') == "separate") { - print "jQuery('#size, #unique, #required, #default_value').val('').prop('disabled', true);"; + print "jQuery('#size, #default_value').val('').prop('disabled', true);"; print 'jQuery("#value_choice").hide();'; } ?> @@ -48,24 +48,27 @@ else if (type == 'int') { size.removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} else if (type == 'text') { size.removeAttr('disabled'); unique.prop('disabled', true).removeAttr('checked'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } else if (type == 'varchar') { size.removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } - else if (type == 'boolean') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} - else if (type == 'price') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} - else if (type == 'select') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else if (type == 'link') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();} - else if (type == 'sellist') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").show();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else if (type == 'radio') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else if (type == 'checkbox') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else if (type == 'chkbxlst') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();jQuery("#helplink").hide();} - else if (type == 'separate') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else size.val('').prop('disabled', true); + else if (type == 'boolean') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} + else if (type == 'price') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} + else if (type == 'select') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else if (type == 'sellist') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").show();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else if (type == 'radio') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else if (type == 'checkbox') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else if (type == 'chkbxlst') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();jQuery("#helplink").hide();} + else if (type == 'link') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();} + else if (type == 'separate') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else { // type = string + size.val('').prop('disabled', true); + unique.removeAttr('disabled'); + } if (type == 'separate') { - alwayseditable.val('').prop('disabled', true); list.val('').prop('disabled', true); + required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.val('').prop('disabled', true); } else { - alwayseditable.val('').removeAttr('disabled'); list.val('').removeAttr('disabled'); + required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.val('').removeAttr('disabled'); } } init_typeoffields(jQuery("#type").val()); @@ -174,14 +177,14 @@ else - + - + - +global->MAIN_CAN_HIDE_EXTRAFIELDS)) { ?> - + global->MAIN_FEATURES_LEVEL >= 2) { ?> diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 59e7a95f258..72d63b55ff6 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1351,7 +1351,7 @@ table.login_table_securitycode tr td { div.login_block { position: absolute; - text-align: right; + text-align: ; : 5px; top: 2px; font-weight: bold; From b91b8c64b596dee33e24cd10817a29acf6e31b1e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 Oct 2016 12:27:20 +0200 Subject: [PATCH 08/26] Fix sql error if we use separator extra field --- htdocs/projet/tasks/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 47083e9032d..3d86cf3aeca 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -221,8 +221,8 @@ $sql = "SELECT ".$distinct." p.rowid as projectid, p.ref as projectref, p.title $sql.= ", s.nom as name, s.rowid as socid"; $sql.= ", t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_update"; $sql.= ", t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut"; -// Add fields for extrafields -foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; +// Add fields from extrafields +foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); // Add fields from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook From 3eb8a667bcaaa6228310d725aab2dcc769049c3a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 Oct 2016 12:34:21 +0200 Subject: [PATCH 09/26] 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 10/26] 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 11/26] 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 12/26] 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 13/26] 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 14/26] 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."
trans("DefaultValue"); ?>">
trans("Unique"); ?>>
trans("Unique"); ?>>
trans("Required"); ?>>
trans("Required"); ?>>
trans("AlwaysEditable"); ?>>
trans("AlwaysEditable"); ?>>
trans("Hidden"); ?>>
trans("Hidden"); ?>>
trans("Unique"); ?>>
trans("Unique"); ?>>
trans("Required"); ?>>
trans("Required"); ?>>
trans("AlwaysEditable"); ?>>
trans("AlwaysEditable"); ?>>
trans("Hidden"); ?>>
trans("Hidden"); ?>>
'.$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 15/26] 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 16/26] 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 17/26] 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 18/26] 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 19/26] 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 20/26] 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 21/26] 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 22/26] 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=''; From 46c985d8cc9a526d550f8e54097edf958b34f6a3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Oct 2016 15:16:21 +0200 Subject: [PATCH 23/26] FIX Hidden option PRODUCT_MAX_VISIBLE_PHOTO --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e1e1b833248..279d1342580 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -929,7 +929,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $showimage=$object->is_photo_available($conf->product->multidir_output[$object->entity]); $maxvisiblephotos=(isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO)?$conf->global->PRODUCT_MAX_VISIBLE_PHOTO:5); if ($conf->browser->phone) $maxvisiblephotos=1; - if ($showimage) $morehtmlleft.='
'.$object->show_photos($conf->product->multidir_output[$object->entity],'small',-$maxvisiblephotos,0,0,0,$width,0).'
'; + if ($showimage) $morehtmlleft.='
'.$object->show_photos($conf->product->multidir_output[$object->entity],'small',$maxvisiblephotos,0,0,0,$width,0).'
'; else { if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) { From 24ee2bce14b975ea89f90e0d0adc314659379a0a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2016 12:57:30 +0200 Subject: [PATCH 24/26] FIX Can edit the customer ref even if order is not draft. --- htdocs/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index dd9a45eae3d..0930a205151 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1981,7 +1981,7 @@ if ($action == 'create' && $user->rights->commande->creer) print '
'.$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).'
'; - if ($action != 'refcustomer' && $object->brouillon) + if ($action != 'refcustomer') print ''; print '
'; print $langs->trans('RefCustomer') . ''; print '' . img_edit($langs->trans('Modify')) . '
'; print ''; From 3ca3b7ab78e013b79c04bba7d280dbd26e66a0bd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Oct 2016 10:36:11 +0200 Subject: [PATCH 25/26] Fix code comment --- htdocs/core/lib/functions.lib.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 279d1342580..fcb27d0cadc 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2426,9 +2426,9 @@ function img_printer($titlealt = "default", $other='') /** * Show help logo with cursor "?" * - * @param string $usehelpcursor Use help cursor - * @param string $usealttitle Text to use as alt title - * @return string Retourne tag img + * @param int $usehelpcursor Use help cursor + * @param int|string $usealttitle Text to use as alt title + * @return string Return tag img */ function img_help($usehelpcursor = 1, $usealttitle = 1) { @@ -3823,7 +3823,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi * @param int $idprod Id of product or 0 if not a predefined product * @param Societe $thirdparty_seller Thirdparty with a ->country_code defined (FR, US, IT, ...) * @param int $idprodfournprice Id product_fournisseur_price (for "supplier" order/invoice) - * @return int <0 if KO, Vat rate if OK + * @return float Vat rate * @see get_product_localtax_for_country */ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice=0) @@ -3973,7 +3973,7 @@ function get_product_localtax_for_country($idprod, $local, $thirdparty_seller) * @param Societe $thirdparty_buyer Objet societe acheteuse * @param int $idprod Id product * @param int $idprodfournprice Id product_fournisseur_price (for supplier order/invoice) - * @return float Taux de tva a appliquer, -1 si ne peut etre determine + * @return float Vat rate to use, -1 if we can't guess it * @see get_default_npr, get_default_localtax */ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0) @@ -4522,7 +4522,7 @@ function dol_nboflines_bis($text,$maxlinesize=0,$charset='UTF-8') else $pattern = '/(]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); - $nblines = floor((count($a)+1)/2); + $nblines = (int) floor((count($a)+1)/2); // count possible auto line breaks if($maxlinesize) { From c44aa8f4d710ac771fdaf9157ef3592480096b84 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Oct 2016 13:23:39 +0200 Subject: [PATCH 26/26] Fix warnings --- htdocs/product/stats/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 0bc4eafa316..3ff47496409 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -210,9 +210,9 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') //print ''; // Generation des graphs + $dir = (! empty($conf->product->multidir_temp[$object->entity])?$conf->product->multidir_temp[$object->entity]:$conf->service->multidir_temp[$object->entity]); if ($object->id > 0) // We are on statistics for a dedicated product { - $dir = (! empty($conf->product->multidir_temp[$object->entity])?$conf->product->multidir_temp[$object->entity]:$conf->service->multidir_temp[$object->entity]); if (! file_exists($dir.'/'.$object->id)) { if (dol_mkdir($dir.'/'.$object->id) < 0)