From b8d5d6a383e0b066350b43462c26272cbc883e55 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 May 2016 19:38:52 +0200 Subject: [PATCH 1/9] Fix bad placeholder --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 97c2d782afb..38dcdc87759 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1352,7 +1352,7 @@ if ($action == 'create') } else { - print $form->select_company(GETPOST('socid','int'),'socid','s.fournisseur = 1',1); + print $form->select_company(GETPOST('socid','int'),'socid','s.fournisseur = 1','SelectThirdParty'); } print ''; From a1a335025ff7bcb40a2b698b051bd6a6af1667db Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 May 2016 12:05:11 +0200 Subject: [PATCH 2/9] FIX #5230 --- htdocs/contrat/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index cce04ee8291..f7b18696993 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1025,7 +1025,7 @@ if ($action == 'create') $projectid = (!empty($objectsrc->fk_project)?$objectsrc->fk_project:''); - $soc = $objectsrc->client; + $soc = $objectsrc->thirdparty; $note_private = (! empty($objectsrc->note_private) ? $objectsrc->note_private : ''); $note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : ''); From 2290f6a123af34dd89ff16695f045934eb27c8e0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 May 2016 13:11:44 +0200 Subject: [PATCH 3/9] FIX Menu statistics was not visible if module proposal was not enabled --- htdocs/core/menus/standard/eldy.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 06e4ceab5b8..6c5af367c03 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1099,7 +1099,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $langs->load("stocks"); $newmenu->add("/product/reassortlot.php?type=0", $langs->trans("StocksByLotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire); } - if (! empty($conf->propal->enabled)) + if (! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled) || ! empty($conf->supplier_proposal->enabled)) { $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->rights->produit->lire && $user->rights->propale->lire); } @@ -1111,7 +1111,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/product/index.php?leftmenu=service&type=1", $langs->trans("Services"), 0, $user->rights->service->lire, '', $mainmenu, 'service'); $newmenu->add("/product/card.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->rights->service->creer); $newmenu->add("/product/list.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->rights->service->lire); - if (! empty($conf->propal->enabled)) + if (! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled) || ! empty($conf->supplier_proposal->enabled)) { $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->rights->service->lire && $user->rights->propale->lire); } From 3cc8207bb734eab987e6b31a31997112de0ce2a2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 May 2016 17:20:34 +0200 Subject: [PATCH 4/9] FIX Filter on category tag for suppliers --- htdocs/societe/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 80e54742765..e9b98ad7164 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -359,7 +359,7 @@ $sql.= " ,".MAIN_DB_PREFIX."c_stcomm as st"; // We'll need this table joined to the select in order to filter by sale if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We'll need this table joined to the select in order to filter by categ -if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as cs"; +if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_".($type=='f'?"fournisseur":"societe")." as cs"; $sql.= " WHERE s.fk_stcomm = st.id"; $sql.= " AND s.entity IN (".getEntity('societe', 1).")"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; From ed148f70b3d1113c532a1fbe0b1381044f7956b6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 May 2016 18:12:27 +0200 Subject: [PATCH 5/9] FIX Filter on assigned to was preselected on current user on list "All events" (instead of no filtering) --- htdocs/comm/action/index.php | 2 +- htdocs/core/modules/modAgenda.class.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index fe7b15c66fe..cf2b475e10d 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -48,7 +48,7 @@ $filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filt $usergroup = GETPOST("usergroup","int",3); $showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; -// If not choice done on calendar owner, we filter on user. +// If not choice done on calendar owner (like on left menu link "Agenda"), we filter on user. if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) { $filtert=$user->id; diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 482846032dc..45cc2680af0 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -266,7 +266,7 @@ class modAgenda extends DolibarrModules 'type'=>'left', 'titre'=>'MenuToDoActions', 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=todo', + 'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', 'langs'=>'agenda', 'position'=>105, 'perms'=>'$user->rights->agenda->allactions->read', @@ -278,7 +278,7 @@ class modAgenda extends DolibarrModules 'type'=>'left', 'titre'=>'MenuDoneActions', 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=done', + 'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', 'langs'=>'agenda', 'position'=>106, 'perms'=>'$user->rights->agenda->allactions->read', @@ -327,7 +327,7 @@ class modAgenda extends DolibarrModules 'type'=>'left', 'titre'=>'MenuToDoActions', 'mainmenu'=>'agenda', - 'url'=>'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=todo', + 'url'=>'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', 'langs'=>'agenda', 'position'=>115, 'perms'=>'$user->rights->agenda->allactions->read', @@ -339,7 +339,7 @@ class modAgenda extends DolibarrModules 'type'=>'left', 'titre'=>'MenuDoneActions', 'mainmenu'=>'agenda', - 'url'=>'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=done', + 'url'=>'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', 'langs'=>'agenda', 'position'=>116, 'perms'=>'$user->rights->agenda->allactions->read', From 460d7ce915020a140233f811d8ff666b8664d8ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 May 2016 19:38:28 +0200 Subject: [PATCH 6/9] FIX Split of credit note into discount page generates records not correctly recognised as credit note. --- htdocs/comm/remx.php | 16 ++++++++-------- htdocs/commande/card.php | 4 ++-- htdocs/compta/facture.php | 10 +++++----- htdocs/core/class/html.form.class.php | 8 ++++---- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 07989b457de..a4aff6d71c1 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -341,22 +341,22 @@ if ($socid > 0) $var = !$var; print ""; print ''.dol_print_date($db->jdate($obj->dc),'dayhour').''; - if ($obj->description == '(CREDIT_NOTE)') + if (preg_match('/\(CREDIT_NOTE\)/',$obj->description)) { print ''; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; - print $langs->trans("CreditNote").' '.$facturestatic->getNomURl(1); + print preg_replace('/\(CREDIT_NOTE\)/',$langs->trans("CreditNote"),$obj->description).' '.$facturestatic->getNomURl(1); print ''; } - elseif ($obj->description == '(DEPOSIT)') + elseif (preg_match('/\(DEPOSIT\)/',$obj->description)) { print ''; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; - print $langs->trans("InvoiceDeposit").' '.$facturestatic->getNomURl(1); + print preg_replace('/\(DEPOSIT\)/',$langs->trans("InvoiceDeposit"),$obj->description).' '.$facturestatic->getNomURl(1); print ''; } else @@ -500,22 +500,22 @@ if ($socid > 0) $var = !$var; print ""; print ''.dol_print_date($db->jdate($obj->dc),'dayhour').''; - if ($obj->description == '(CREDIT_NOTE)') + if (preg_match('/\(CREDIT_NOTE\)/',$obj->description)) { print ''; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; - print $langs->trans("CreditNote").' '.$facturestatic->getNomURl(1); + print preg_replace('/\(CREDIT_NOTE\)/',$langs->trans("CreditNote"),$obj->description).' '.$facturestatic->getNomURl(1); print ''; } - elseif ($obj->description == '(DEPOSIT)') + elseif (preg_match('/\(DEPOSIT\)/',$obj->description)) { print ''; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; - print $langs->trans("InvoiceDeposit").' '.$facturestatic->getNomURl(1); + print preg_replace('/\(DEPOSIT\)/',$langs->trans("InvoiceDeposit"),$obj->description).' '.$facturestatic->getNomURl(1); print ''; } else diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 4dbc60569bb..489eee73932 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1900,8 +1900,8 @@ if ($action == 'create' && $user->rights->commande->creer) // invoice $filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice } else { - $filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')"; - $filtercreditnote = "fk_facture_source IS NOT NULL AND description <> '(DEPOSIT)'"; + $filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')"; + $filtercreditnote = "fk_facture_source IS NOT NULL AND description NOT LIKE '(DEPOSIT)%'"; } // Relative and absolute discounts diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 79045fe54b9..8604e95b5a2 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2563,8 +2563,8 @@ else if ($id > 0 || ! empty($ref)) $filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice } else { - $filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')"; - $filtercreditnote = "fk_facture_source IS NOT NULL AND description <> '(DEPOSIT)'"; + $filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')"; + $filtercreditnote = "fk_facture_source IS NOT NULL AND description NOT LIKE '(DEPOSIT)%'"; } $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount); @@ -2982,9 +2982,9 @@ else if ($id > 0 || ! empty($ref)) // Remise dispo de type avoir if (! $absolute_discount) print '
'; - // $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, - // $filtercreditnote, $resteapayer); - $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0); // We allow credit note even if amount is higher + // $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer + $more=' ('.$addcreditnote.')'; + $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0, $more); // We allow credit note even if amount is higher } } if (! $absolute_discount && ! $absolute_creditnote) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7232f6ec270..8fb0118cd2e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1128,8 +1128,8 @@ class Form { $obj = $this->db->fetch_object($resql); $desc=dol_trunc($obj->description,40); - if ($desc=='(CREDIT_NOTE)') $desc=$langs->trans("CreditNote"); - if ($desc=='(DEPOSIT)') $desc=$langs->trans("Deposit"); + if (preg_match('/\(CREDIT_NOTE\)/', $desc)) $desc=preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $desc); + if (preg_match('/\(DEPOSIT\)/', $desc)) $desc=preg_replace('/\(DEPOSIT\)/', $langs->trans("Deposit"), $desc); $selectstring=''; if ($selected > 0 && $selected == $obj->rowid) $selectstring=' selected'; @@ -3762,7 +3762,7 @@ class Form } else { - if (! $filter || $filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency)).': '; + if (! $filter || $filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency)).': '; else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency)).': '; } $newfilter='fk_facture IS NULL AND fk_facture_line IS NULL'; // Remises disponibles @@ -3773,7 +3773,7 @@ class Form if ($nbqualifiedlines > 0) { print '   '; } if ($more) print $more; From 58ba5838cee97b43dcff0b1584536a844a3377f4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 May 2016 19:41:28 +0200 Subject: [PATCH 7/9] Fix alias name already visible into banner --- htdocs/societe/agenda.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 3d72ad9d328..e1745d38e59 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -87,11 +87,6 @@ if ($socid) print '
'; print ''; - // Alias names (commercial, trademark or alias names) - print '"; - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''; From 0d277083e642bae91f3df5060487a9b605e2f78b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 May 2016 19:56:59 +0200 Subject: [PATCH 8/9] Fix duplicate translation --- htdocs/langs/en_US/products.lang | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 291f04f1c7e..08d2a94c367 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -45,8 +45,6 @@ LastProducts=Last products CardProduct0=Product card CardProduct1=Service card CardContract=Contract card -Warehouse=Warehouse -Warehouses=Warehouses WarehouseOpened=Warehouse open WarehouseClosed=Warehouse closed Stock=Stock From ee420b79b1f7b532e33fa19aa4c63cb65864b895 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jun 2016 17:49:20 +0200 Subject: [PATCH 9/9] FIX Infinite loop on menu tree output for edition FIX Can show tree of entries added by external modules using fk_mainmenu and fk_leftmenu instead of fk_menu. --- htdocs/core/lib/treeview.lib.php | 37 +++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index e900931037e..225568fd776 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -113,7 +113,11 @@ function tree_showpad(&$fulltree,$key,$silent=0) */ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree') { - if (empty($pere['rowid'])) + global $tree_recur_alreadyadded; + + if ($rang == 0) $tree_recur_alreadyadded=array(); + + if (empty($pere['rowid'])) { // Test also done with jstree and dynatree (not able to have inside label) print '
'.$langs->trans('AliasNames').''; - print $object->name_alias; - print "
'.$langs->trans('Prefix').''.$object->prefix_comm.'