From e95d93e6313fb642e6ab1762e2cda4245f20ee20 Mon Sep 17 00:00:00 2001 From: Abbes Bahfir Date: Fri, 19 Oct 2018 17:31:26 +0100 Subject: [PATCH 001/421] fix:follow url back link --- htdocs/categories/viewcat.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index ba3580cea87..3bb309814b3 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -197,8 +197,7 @@ $head = categories_prepare_head($object,$type); dol_fiche_head($head, 'card', $title, -1, 'category'); - -$linkback = ''.$langs->trans("BackToList").''; +$linkback=(GETPOST('linkback') ? GETPOST('linkback'): ''.$langs->trans("BackToList").''); $object->next_prev_filter=" type = ".$object->type; $object->ref = $object->label; $morehtmlref='
'.$langs->trans("Root").' >> '; From 1b60fb7702a5f4e13925116a3269dfb7e3b07185 Mon Sep 17 00:00:00 2001 From: Bahfir Abbes Date: Fri, 19 Oct 2018 18:00:24 +0100 Subject: [PATCH 002/421] Update viewcat.php --- htdocs/categories/viewcat.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 3bb309814b3..a71fa14ebdd 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -197,7 +197,8 @@ $head = categories_prepare_head($object,$type); dol_fiche_head($head, 'card', $title, -1, 'category'); -$linkback=(GETPOST('linkback') ? GETPOST('linkback'): ''.$langs->trans("BackToList").''); +$linkback=(GETPOST('linkback') ? GETPOST('linkback'):DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type); +$linkback = ''.$langs->trans("BackToList").''; $object->next_prev_filter=" type = ".$object->type; $object->ref = $object->label; $morehtmlref='
'.$langs->trans("Root").' >> '; From 26b00dc5caf37bab641540b5f54cefe356b647d9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 30 Oct 2018 17:40:05 +0100 Subject: [PATCH 003/421] NEW possibility to defined rounding rules by currency --- htdocs/admin/limits.php | 100 ++++++++++++++++---------- htdocs/core/lib/multicurrency.lib.php | 29 +++++++- 2 files changed, 89 insertions(+), 40 deletions(-) diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index ca4b8fca512..b492664fd97 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -1,6 +1,6 @@ - * Copyright (C) 2009-2012 Regis Houssin + * Copyright (C) 2009-2018 Regis Houssin * Copyright (C) 2010 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -32,31 +32,37 @@ $langs->loadLangs(array('companies', 'products', 'admin')); if (! $user->admin) accessforbidden(); $action = GETPOST('action','alpha'); +$currencycode = GETPOST('currencycode', 'alpha'); + +$mainmaxdecimalsunit = 'MAIN_MAX_DECIMALS_UNIT'.(! empty($currencycode)?'_'.$currencycode:''); +$mainmaxdecimalstot = 'MAIN_MAX_DECIMALS_TOT'.(! empty($currencycode)?'_'.$currencycode:''); +$mainmaxdecimalsshown = 'MAIN_MAX_DECIMALS_SHOWN'.(! empty($currencycode)?'_'.$currencycode:''); +$mainroundingruletot = 'MAIN_ROUNDING_RULE_TOT'.(! empty($currencycode)?'_'.$currencycode:''); if ($action == 'update') { - $error=0; - $MAXDEC=8; - if ($_POST["MAIN_MAX_DECIMALS_UNIT"] > $MAXDEC - || $_POST["MAIN_MAX_DECIMALS_TOT"] > $MAXDEC - || $_POST["MAIN_MAX_DECIMALS_SHOWN"] > $MAXDEC) + $error=0; + $MAXDEC=8; + if ($_POST[$mainmaxdecimalsunit] > $MAXDEC + || $_POST[$mainmaxdecimalstot] > $MAXDEC + || $_POST[$mainmaxdecimalsshown] > $MAXDEC) { $error++; setEventMessages($langs->trans("ErrorDecimalLargerThanAreForbidden",$MAXDEC), null, 'errors'); } - if ($_POST["MAIN_MAX_DECIMALS_UNIT"] < 0 - || $_POST["MAIN_MAX_DECIMALS_TOT"] < 0 - || $_POST["MAIN_MAX_DECIMALS_SHOWN"] < 0) + if ($_POST[$mainmaxdecimalsunit].(! empty($currencycode)?'_'.$currencycode:'') < 0 + || $_POST[$mainmaxdecimalstot] < 0 + || $_POST[$mainmaxdecimalsshown] < 0) { $langs->load("errors"); $error++; setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors'); } - if ($_POST["MAIN_ROUNDING_RULE_TOT"]) + if ($_POST[$mainroundingruletot]) { - if ($_POST["MAIN_ROUNDING_RULE_TOT"] * pow(10,$_POST["MAIN_MAX_DECIMALS_TOT"]) < 1) + if ($_POST[$mainroundingruletot] * pow(10,$_POST[$mainmaxdecimalstot]) < 1) { $langs->load("errors"); $error++; @@ -66,22 +72,21 @@ if ($action == 'update') if (! $error) { - dolibarr_set_const($db, "MAIN_MAX_DECIMALS_UNIT", $_POST["MAIN_MAX_DECIMALS_UNIT"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_MAX_DECIMALS_TOT", $_POST["MAIN_MAX_DECIMALS_TOT"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_MAX_DECIMALS_SHOWN", $_POST["MAIN_MAX_DECIMALS_SHOWN"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, $mainmaxdecimalsunit, $_POST[$mainmaxdecimalsunit],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, $mainmaxdecimalstot, $_POST[$mainmaxdecimalstot],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, $mainmaxdecimalsshown, $_POST[$mainmaxdecimalsshown],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_ROUNDING_RULE_TOT", $_POST["MAIN_ROUNDING_RULE_TOT"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, $mainroundingruletot, $_POST[$mainroundingruletot],'chaine',0,'',$conf->entity); - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".(! empty($currencycode)?'¤cycode='.$currencycode:'')); exit; } } - /* * View -*/ + */ $form=new Form($db); @@ -89,6 +94,31 @@ llxHeader(); print load_fiche_titre($langs->trans("LimitsSetup"),'','title_setup'); +if ($conf->multicurrency->enabled && $conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY) +{ + require_once DOL_DOCUMENT_ROOT.'/core/lib/multicurrency.lib.php'; + + $currencycode = (! empty($currencycode)?$currencycode:$conf->currency); + $aCurrencies = array($conf->currency); // Default currency always first position + + $sql = 'SELECT rowid, code FROM '.MAIN_DB_PREFIX.'multicurrency'; + $sql.= ' WHERE entity = '.$conf->entity; + $sql.= ' AND code != "'.$conf->currency.'"'; // Default currency always first position + $resql = $db->query($sql); + if ($resql) + { + while ($obj = $db->fetch_object($resql)) + { + $aCurrencies[] = $obj->code; + } + + if (! empty($aCurrencies) && count($aCurrencies) > 1) + { + $head = multicurrencyLimitPrepareHead($aCurrencies); + dol_fiche_head($head, $currencycode, '', -1, "multicurrency"); + } + } +} print $langs->trans("LimitsDesc")."
\n"; print "
\n"; @@ -98,29 +128,29 @@ if ($action == 'edit') print '
'; print ''; print ''; + if ($conf->multicurrency->enabled && $conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY) { + print ''; + } clearstatcache(); print ''; print ''; - print ''; - + print ''; print ''; - - - print ''; + print ''; + print ''; + print ''; print ''; + print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"),$langs->trans("ParameterActiveForNextInputOnly")); - print '
'; print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"),$langs->trans("ParameterActiveForNextInputOnly")); - print '
'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'
'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'
'; print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"),$langs->trans("ParameterActiveForNextInputOnly")); - print '
'; @@ -136,32 +166,28 @@ else print ''; print ''; - print ''; - + print ''; print ''; - - - print ''; + print ''; + print ''; + print ''; print ''; + print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"),$langs->trans("ParameterActiveForNextInputOnly")); - print ''.$conf->global->MAIN_MAX_DECIMALS_UNIT.'
'.(! empty($conf->global->$mainmaxdecimalsunit)?$conf->global->$mainmaxdecimalsunit:$conf->global->MAIN_MAX_DECIMALS_UNIT).'
'; print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"),$langs->trans("ParameterActiveForNextInputOnly")); - print ''.$conf->global->MAIN_MAX_DECIMALS_TOT.'
'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").''.$conf->global->MAIN_MAX_DECIMALS_SHOWN.'
'.(! empty($conf->global->$mainmaxdecimalstot)?$conf->global->$mainmaxdecimalstot:$conf->global->MAIN_MAX_DECIMALS_TOT).'
'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").''.(! empty($conf->global->$mainmaxdecimalsshown)?$conf->global->$mainmaxdecimalsshown:$conf->global->MAIN_MAX_DECIMALS_SHOWN).'
'; print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"),$langs->trans("ParameterActiveForNextInputOnly")); - print ''.$conf->global->MAIN_ROUNDING_RULE_TOT.'
'.(! empty($conf->global->$mainroundingruletot)?$conf->global->$mainroundingruletot:$conf->global->MAIN_ROUNDING_RULE_TOT).'
'; print ''; } - if (empty($mysoc->country_code)) { $langs->load("errors"); @@ -170,7 +196,6 @@ if (empty($mysoc->country_code)) } else { - // Show examples print ''.$langs->trans("ExamplesWithCurrentSetup").":
\n"; @@ -196,7 +221,6 @@ else print " - ".$langs->trans("VAT").": ".$vat.'%'; print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; - // Add vat rates examples specific to country $vat_rates=array(); diff --git a/htdocs/core/lib/multicurrency.lib.php b/htdocs/core/lib/multicurrency.lib.php index 339ca2d01bc..968fe3d956d 100644 --- a/htdocs/core/lib/multicurrency.lib.php +++ b/htdocs/core/lib/multicurrency.lib.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015 ATM Consulting +/* Copyright (C) 2015 ATM Consulting + * Copyright (C) 2018 Regis Houssin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,3 +44,28 @@ function multicurrencyAdminPrepareHead() return $head; } + +/** + * Prepare array with list of currency tabs + * + * @param array $aCurrencies Currencies array + * @return array Array of tabs + */ +function multicurrencyLimitPrepareHead($aCurrencies) +{ + global $langs; + + $i=0; + $head = array(); + + foreach($aCurrencies as $currency) + { + $head[$i][0] = $_SERVER['PHP_SELF'].'?currencycode='.$currency; + $head[$i][1] = $langs->trans("Currency".$currency).' ('.$langs->getCurrencySymbol($currency).')'; + $head[$i][2] = $currency; + + $i++; + } + + return $head; +} \ No newline at end of file From 6e770676388649eff4427f51cd1060cd52c448d1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 30 Oct 2018 17:59:14 +0100 Subject: [PATCH 004/421] FIX better check --- htdocs/admin/limits.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index b492664fd97..104fb2cd388 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -94,7 +94,7 @@ llxHeader(); print load_fiche_titre($langs->trans("LimitsSetup"),'','title_setup'); -if ($conf->multicurrency->enabled && $conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY) +if (! empty($conf->multicurrency->enabled) && ! empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/multicurrency.lib.php'; @@ -128,7 +128,7 @@ if ($action == 'edit') print ''; print ''; print ''; - if ($conf->multicurrency->enabled && $conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY) { + if (! empty($conf->multicurrency->enabled) && ! empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) { print ''; } From 9999ae05ccfd8499145c1ad7c40f97f86552e664 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 1 May 2019 11:10:11 +0200 Subject: [PATCH 005/421] add default warehouse --- htdocs/fourn/commande/dispatch.php | 36 ++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 7a8bb2bcd22..46c4d4c7f81 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -8,6 +8,7 @@ * Copyright (C) 2016 Florian Henry * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2018 Frédéric France + * Copyright (C) 2019 Christophe Battarel * * 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 @@ -51,6 +52,8 @@ $id = GETPOST("id", 'int'); $ref = GETPOST('ref'); $lineid = GETPOST('lineid', 'int'); $action = GETPOST('action', 'aZ09'); +$fk_entrepot_default = GETPOST('fk_entrepot_default','int'); + if ($user->societe_id) $socid = $user->societe_id; $result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande'); @@ -236,6 +239,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) $prod = "product_" . $reg[1] . '_' . $reg[2]; $qty = "qty_" . $reg[1] . '_' . $reg[2]; $ent = "entrepot_" . $reg[1] . '_' . $reg[2]; + if(empty($ent)) $ent = $fk_entrepot_default; $pu = "pu_" . $reg[1] . '_' . $reg[2]; // This is unit price including discount $fk_commandefourndet = "fk_commandefourndet_" . $reg[1] . '_' . $reg[2]; @@ -456,8 +460,10 @@ if ($id > 0 || ! empty($ref)) { if ($object->statut == CommandeFournisseur::STATUS_ORDERSENT || $object->statut == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY || $object->statut == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) { - $entrepot = new Entrepot($db); - $listwarehouses = $entrepot->list_array(1); + + require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + $formproduct = new FormProduct($db); + $formproduct->loadWarehouses(); if(empty($conf->reception->enabled))print ''; else print ''; @@ -508,6 +514,23 @@ if ($id > 0 || ! empty($ref)) { $i = 0; if ($num) { + $entrepot = new Entrepot($db); + $listwarehouses=$entrepot->list_array(1); + + // entrepot par défaut + print $langs->trans("Warehouse").' : '; + if (count($listwarehouses)>1) + { + print $form->selectarray('fk_entrepot_default', $listwarehouses, $fk_entrepot_default, 1, 0, 0, '', 0, 0, $disabled); + } + elseif (count($listwarehouses)==1) + { + print $form->selectarray('fk_entrepot_default', $listwarehouses, $fk_entrepot_default, 0, 0, 0, '', 0, 0, $disabled); + } + else + { + print $langs->trans("NoWarehouseDefined"); + } print ''; print '' . $langs->trans("Description") . ''; @@ -758,6 +781,15 @@ if ($id > 0 || ! empty($ref)) { dol_fiche_end(); + // traitement entrepot par défaut + print ''; // List of lines already dispatched $sql = "SELECT p.ref, p.label,"; From ed12b1855c09472e10dcd9f4a0f46e0f5cd1baed Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 1 May 2019 13:55:27 +0200 Subject: [PATCH 006/421] change entrepot to warehouse --- htdocs/fourn/commande/dispatch.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 46c4d4c7f81..a13fc9a982b 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -52,7 +52,7 @@ $id = GETPOST("id", 'int'); $ref = GETPOST('ref'); $lineid = GETPOST('lineid', 'int'); $action = GETPOST('action', 'aZ09'); -$fk_entrepot_default = GETPOST('fk_entrepot_default','int'); +$fk_default_warehouse = GETPOST('fk_default_warehouse','int'); if ($user->societe_id) $socid = $user->societe_id; @@ -239,7 +239,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) $prod = "product_" . $reg[1] . '_' . $reg[2]; $qty = "qty_" . $reg[1] . '_' . $reg[2]; $ent = "entrepot_" . $reg[1] . '_' . $reg[2]; - if(empty($ent)) $ent = $fk_entrepot_default; + if(empty($ent)) $ent = $fk_default_warehouse; $pu = "pu_" . $reg[1] . '_' . $reg[2]; // This is unit price including discount $fk_commandefourndet = "fk_commandefourndet_" . $reg[1] . '_' . $reg[2]; @@ -521,11 +521,11 @@ if ($id > 0 || ! empty($ref)) { print $langs->trans("Warehouse").' : '; if (count($listwarehouses)>1) { - print $form->selectarray('fk_entrepot_default', $listwarehouses, $fk_entrepot_default, 1, 0, 0, '', 0, 0, $disabled); + print $form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 1, 0, 0, '', 0, 0, $disabled); } elseif (count($listwarehouses)==1) { - print $form->selectarray('fk_entrepot_default', $listwarehouses, $fk_entrepot_default, 0, 0, 0, '', 0, 0, $disabled); + print $form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 0, 0, 0, '', 0, 0, $disabled); } else { @@ -784,9 +784,9 @@ if ($id > 0 || ! empty($ref)) { // traitement entrepot par défaut print ''; From 98ba7e8184dd340fc6e3ea7fe4ff52125208c24f Mon Sep 17 00:00:00 2001 From: altairis Date: Wed, 21 Aug 2019 10:37:13 +0200 Subject: [PATCH 007/421] FIX PSR2 missing space --- htdocs/fourn/commande/dispatch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index a13fc9a982b..a97ea89b31a 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -52,7 +52,7 @@ $id = GETPOST("id", 'int'); $ref = GETPOST('ref'); $lineid = GETPOST('lineid', 'int'); $action = GETPOST('action', 'aZ09'); -$fk_default_warehouse = GETPOST('fk_default_warehouse','int'); +$fk_default_warehouse = GETPOST('fk_default_warehouse', 'int'); if ($user->societe_id) $socid = $user->societe_id; From 7c3e643fca180d67a41a4c9b1928bc45276fac58 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 22 Aug 2019 16:07:18 +0200 Subject: [PATCH 008/421] fix PSR2 missing space --- htdocs/fourn/commande/dispatch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index a13fc9a982b..a97ea89b31a 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -52,7 +52,7 @@ $id = GETPOST("id", 'int'); $ref = GETPOST('ref'); $lineid = GETPOST('lineid', 'int'); $action = GETPOST('action', 'aZ09'); -$fk_default_warehouse = GETPOST('fk_default_warehouse','int'); +$fk_default_warehouse = GETPOST('fk_default_warehouse', 'int'); if ($user->societe_id) $socid = $user->societe_id; From dff36c9d684720c74420fb02dc9a361cb1358392 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 5 Sep 2019 15:30:14 +0200 Subject: [PATCH 009/421] actualize from develop --- htdocs/fourn/commande/dispatch.php | 144 +++++++++++++++++++++++------ 1 file changed, 114 insertions(+), 30 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index a97ea89b31a..ea51bcdb4d7 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -246,7 +246,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) // We ask to move a qty if (GETPOST($qty) != 0) { if (! (GETPOST($ent, 'int') > 0)) { - dol_syslog('No dispatch for line ' . $key . ' as no warehouse choosed'); + dol_syslog('No dispatch for line ' . $key . ' as no warehouse was chosen.'); $text = $langs->transnoentities('Warehouse') . ', ' . $langs->transnoentities('Line') . ' ' . ($numline); setEventMessages($langs->trans('ErrorFieldRequired', $text), null, 'errors'); $error ++; @@ -283,7 +283,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) // We ask to move a qty if (GETPOST($qty) > 0) { if (! (GETPOST($ent, 'int') > 0)) { - dol_syslog('No dispatch for line ' . $key . ' as no warehouse choosed'); + dol_syslog('No dispatch for line ' . $key . ' as no warehouse was chosen.'); $text = $langs->transnoentities('Warehouse') . ', ' . $langs->transnoentities('Line') . ' ' . ($numline) . '-' . ($reg[1] + 1); setEventMessages($langs->trans('ErrorFieldRequired', $text), null, 'errors'); $error ++; @@ -418,13 +418,13 @@ if ($id > 0 || ! empty($ref)) { print '
'; print '
'; - print ''; + print '
'; // Date if ($object->methode_commande_id > 0) { print '"; @@ -454,12 +454,13 @@ if ($id > 0 || ! empty($ref)) { // Line of orders if ($object->statut <= CommandeFournisseur::STATUS_ACCEPTED || $object->statut >= CommandeFournisseur::STATUS_CANCELED) { - print ''.$langs->trans("OrderStatusNotReadyToDispatch").''; + print '
'.$langs->trans("OrderStatusNotReadyToDispatch").''; } if ($object->statut == CommandeFournisseur::STATUS_ORDERSENT || $object->statut == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY - || $object->statut == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) { + || $object->statut == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) + { require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); @@ -500,11 +501,35 @@ if ($id > 0 || ! empty($ref)) { $sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref AS sref, SUM(l.qty) as qty,"; $sql .= " p.ref, p.label, p.tobatch, p.fk_default_warehouse"; + + // Enable hooks to alter the SQL query (SELECT) + $parameters = array(); + $reshook = $hookmanager->executeHooks( + 'printFieldListSelect', + $parameters, + $object, + $action + ); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + $sql .= $hookmanager->resPrint; + $sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as l"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON l.fk_product=p.rowid"; $sql .= " WHERE l.fk_commande = " . $object->id; if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql .= " AND l.product_type = 0"; + + // Enable hooks to alter the SQL query (WHERE) + $parameters = array(); + $reshook = $hookmanager->executeHooks( + 'printFieldListWhere', + $parameters, + $object, + $action + ); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + $sql .= $hookmanager->resPrint; + $sql .= " GROUP BY p.ref, p.label, p.tobatch, l.rowid, l.fk_product, l.subprice, l.remise_percent, p.fk_default_warehouse"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product $sql .= " ORDER BY p.ref, p.label"; @@ -514,23 +539,23 @@ if ($id > 0 || ! empty($ref)) { $i = 0; if ($num) { - $entrepot = new Entrepot($db); - $listwarehouses=$entrepot->list_array(1); + $entrepot = new Entrepot($db); + $listwarehouses=$entrepot->list_array(1); + // entrepot par défaut + print $langs->trans("Warehouse").' : '; + if (count($listwarehouses)>1) + { + print $form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 1, 0, 0, '', 0, 0, $disabled); + } + elseif (count($listwarehouses)==1) + { + print $form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 0, 0, 0, '', 0, 0, $disabled); + } + else + { + print $langs->trans("NoWarehouseDefined"); + } - // entrepot par défaut - print $langs->trans("Warehouse").' : '; - if (count($listwarehouses)>1) - { - print $form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 1, 0, 0, '', 0, 0, $disabled); - } - elseif (count($listwarehouses)==1) - { - print $form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 0, 0, 0, '', 0, 0, $disabled); - } - else - { - print $langs->trans("NoWarehouseDefined"); - } print ''; print ''; @@ -546,12 +571,24 @@ if ($id > 0 || ! empty($ref)) { print ''; print ''; } - print ''; + //print ''; print ''; print ''; print ''; print ''; - print ''; + print ''; + + // Enable hooks to append additional columns + $parameters = array(); + $reshook = $hookmanager->executeHooks( + 'printFieldListTitle', + $parameters, + $object, + $action + ); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + print $hookmanager->resPrint; + print "\n"; } @@ -618,7 +655,7 @@ if ($id > 0 || ! empty($ref)) { $up_ht_disc = price2num($up_ht_disc * (100 - $objp->remise_percent) / 100, 'MU'); // Supplier ref - print ''; + //print ''; // Qty ordered print ''; @@ -634,6 +671,23 @@ if ($id > 0 || ! empty($ref)) { //print img_picto($langs->trans('AddDispatchBatchLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"'); print ''; // Dispatch column print ''; // Warehouse column + + // Enable hooks to append additional columns + $parameters = array( + 'is_information_row' => true, // allows hook to distinguish between the + // rows with information and the rows with + // dispatch form input + 'objp' => $objp + ); + $reshook = $hookmanager->executeHooks( + 'printFieldListValue', + $parameters, + $object, + $action + ); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + print $hookmanager->resPrint; + print ''; print ''; @@ -674,10 +728,27 @@ if ($id > 0 || ! empty($ref)) { //print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"'); print ''; // Dispatch column print ''; // Warehouse column + + // Enable hooks to append additional columns + $parameters = array( + 'is_information_row' => true, // allows hook to distinguish between the + // rows with information and the rows with + // dispatch form input + 'objp' => $objp + ); + $reshook = $hookmanager->executeHooks( + 'printFieldListValue', + $parameters, + $object, + $action + ); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + print $hookmanager->resPrint; + print ''; print ''; - print '\n"; + // Enable hooks to append additional columns + $parameters = array( + 'is_information_row' => false // this is a dispatch form row + ); + $reshook = $hookmanager->executeHooks( + 'printFieldListValue', + $parameters, + $object, + $action + ); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + print $hookmanager->resPrint; + print "\n"; } } @@ -737,13 +821,12 @@ if ($id > 0 || ! empty($ref)) { print "
' . $langs->trans("Date") . ''; if ($object->date_commande) { - print dol_print_date($object->date_commande, "dayhourtext") . "\n"; + print dol_print_date($object->date_commande, "dayhour") . "\n"; } print "
' . $langs->trans("Description") . '' . $langs->trans("SupplierRef") . '' . $langs->trans("SupplierRef") . '' . $langs->trans("QtyOrdered") . '' . $langs->trans("QtyDispatchedShort") . '' . $langs->trans("QtyToDispatchShort") . '' . $langs->trans("Warehouse") . '' . $langs->trans("Warehouse") . '
'.$objp->sref.''.$objp->sref.'' . $objp->qty . '
'; + print ''; print ''; print ''; @@ -725,6 +796,19 @@ if ($id > 0 || ! empty($ref)) { } print "
\n"; print '
'; - print "
\n"; if ($nbproduct) { $checkboxlabel = $langs->trans("CloseReceivedSupplierOrdersAutomatically", $langs->transnoentitiesnoconv('StatusOrderReceivedAll')); - print '
'; + print '
'; $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been // modified by hook @@ -760,7 +843,7 @@ if ($id > 0 || ! empty($ref)) { } empty($conf->reception->enabled)?$dispatchBt=$langs->trans("DispatchVerb"):$dispatchBt=$langs->trans("Receive"); - print '
'; @@ -770,7 +853,8 @@ if ($id > 0 || ! empty($ref)) { // Message if nothing to dispatch if (! $nbproduct) { - if (empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED)) + print "
\n"; + if (empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED)) print '
'.$langs->trans("NoPredefinedProductToDispatch").'
'; // No predefined line at all else print '
'.$langs->trans("NoMorePredefinedProductToDispatch").'
'; // No predefined line that remain to be dispatched. From 0bf70dddc73972c566aa2456cf470d3c1db76799 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 5 Sep 2019 15:33:16 +0200 Subject: [PATCH 010/421] actualize from develop --- htdocs/fourn/commande/dispatch.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index ea51bcdb4d7..ac611155f31 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -571,7 +571,7 @@ if ($id > 0 || ! empty($ref)) { print ''; print ''; } - //print '' . $langs->trans("SupplierRef") . ''; + print '' . $langs->trans("SupplierRef") . ''; print '' . $langs->trans("QtyOrdered") . ''; print '' . $langs->trans("QtyDispatchedShort") . ''; print '' . $langs->trans("QtyToDispatchShort") . ''; @@ -655,7 +655,7 @@ if ($id > 0 || ! empty($ref)) { $up_ht_disc = price2num($up_ht_disc * (100 - $objp->remise_percent) / 100, 'MU'); // Supplier ref - //print ''.$objp->sref.''; + print ''.$objp->sref.''; // Qty ordered print '' . $objp->qty . ''; @@ -748,7 +748,7 @@ if ($id > 0 || ! empty($ref)) { print ''; print ''; - print ''; + print ''; print ''; print ''; From 8b8a5e315a5cef22537912491f7eaddba5c84508 Mon Sep 17 00:00:00 2001 From: altairis Date: Fri, 4 Oct 2019 10:55:09 +0200 Subject: [PATCH 011/421] fix test error --- htdocs/fourn/commande/dispatch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index e9eb310438a..5e247809e52 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -239,7 +239,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) $prod = "product_" . $reg[1] . '_' . $reg[2]; $qty = "qty_" . $reg[1] . '_' . $reg[2]; $ent = "entrepot_" . $reg[1] . '_' . $reg[2]; - if(empty($ent)) $ent = $fk_default_warehouse; + if (empty(GETPOST($ent))) $ent = $fk_default_warehouse; $pu = "pu_" . $reg[1] . '_' . $reg[2]; // This is unit price including discount $fk_commandefourndet = "fk_commandefourndet_" . $reg[1] . '_' . $reg[2]; From 668bb0cb8682afa5332709e8f2257690e5d97612 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 4 Nov 2019 11:03:39 +0100 Subject: [PATCH 012/421] NEW add public and private notes in propal list --- htdocs/comm/propal/class/propal.class.php | 43 ++++++++++++++++++++++- htdocs/comm/propal/list.php | 13 +++---- 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 0df1af873a8..1ec4567d774 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3536,9 +3536,10 @@ class Propal extends CommonObject * @param string $get_params Parametres added to url * @param int $notooltip 1=Disable tooltip * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int $addlinktonotes -1=Disable, 0=Just add label show notes, 1=Add private note (only internal user), 2=Add public note (internal or external user), 3=Add private (internal user) and public note (internal and external user) * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = -1) { global $langs, $conf, $user; @@ -3604,6 +3605,46 @@ class Propal extends CommonObject if ($withpicto != 2) $result.= $this->ref; $result .= $linkend; + if ($addlinktonotes >= 0) { + $txttoshow = ''; + + if ($addlinktonotes == 0) { + if (!empty($this->note_private) || !empty($this->note_public)) { + $txttoshow = $langs->trans('ViewPrivateNote'); + } + } elseif ($addlinktonotes == 1) { + if (!empty($this->note_private)) { + $txttoshow .= ($user->socid > 0 ? '' : dol_string_nohtmltag($this->note_private, 1)); + } + } elseif ($addlinktonotes == 2) { + if (!empty($this->note_public)) { + $txttoshow .= dol_string_nohtmltag($this->note_public, 1); + } + } elseif ($addlinktonotes == 3) { + if ($user->socid > 0) { + if (!empty($this->note_public)) { + $txttoshow .= dol_string_nohtmltag($this->note_public, 1); + } + } else { + if (!empty($this->note_private)) { + $txttoshow .= dol_string_nohtmltag($this->note_private, 1); + } + if (!empty($this->note_public)) { + if (!empty($txttoshow)) $txttoshow .= '
'; + $txttoshow .= dol_string_nohtmltag($this->note_public, 1); + } + } + } + + if ($txttoshow) { + $result .= ' '; + $result .= ''; + $result .= img_picto('', 'note'); + $result .= ''; + $result .= ''; + } + } + return $result; } diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index a83d7ee5161..b5a0d1d72aa 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -273,7 +273,7 @@ $sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.c $sql.= " typent.code as typent_code,"; $sql.= " ava.rowid as availability,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; -$sql.= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,'; +$sql.= ' p.rowid, p.entity, p.note_private, p.note_public, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,'; $sql.= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,'; $sql.= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,"; $sql.= ' u.login'; @@ -764,6 +764,8 @@ if ($resql) $objectstatic->id=$obj->rowid; $objectstatic->ref=$obj->ref; + $objectstatic->note_private=$obj->note_private; + $objectstatic->note_public=$obj->note_public; $companystatic->id=$obj->socid; $companystatic->name=$obj->name; @@ -784,18 +786,11 @@ if ($resql) print ''; // Picto + Ref print ''; // Warning $warnornote=''; if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) $warnornote.=img_warning($langs->trans("Late")); - if (! empty($obj->note_private)) - { - $warnornote.=($warnornote?' ':''); - $warnornote.= ''; - $warnornote.= ''.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').''; - $warnornote.= ''; - } if ($warnornote) { print ''; } // Date end if (! empty($arrayfields['p.fin_validite']['checked'])) { - print ''; } // Date delivery if (! empty($arrayfields['p.date_livraison']['checked'])) { - print ''; } // Availability From e60b7a67fa61bea4591920739c16571f2f542555 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 7 Nov 2019 06:35:58 +0100 Subject: [PATCH 016/421] NEW Invoice list - Add date start & date end --- htdocs/compta/facture/list.php | 108 ++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 50 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 75945106b72..2d06fa1f557 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -13,6 +13,7 @@ * Copyright (C) 2015-2016 Ferran Marcet * Copyright (C) 2017 Josep Lluís Amador * Copyright (C) 2018 Charlene Benke + * Copyright (C) 2019 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 @@ -98,12 +99,10 @@ $search_country=GETPOST("search_country", 'int'); $search_type_thirdparty=GETPOST("search_type_thirdparty", 'int'); $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); -$search_day = GETPOST('search_day', 'int'); -$search_month = GETPOST('search_month', 'int'); -$search_year = GETPOST('search_year', 'int'); -$search_day_lim = GETPOST('search_day_lim', 'int'); -$search_month_lim = GETPOST('search_month_lim', 'int'); -$search_year_lim = GETPOST('search_year_lim', 'int'); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); +$search_datelimit_start = dol_mktime(0, 0, 0, GETPOST('search_datelimit_startmonth', 'int'), GETPOST('search_datelimit_startday', 'int'), GETPOST('search_datelimit_startyear', 'int')); +$search_datelimit_end = dol_mktime(23, 59, 59, GETPOST('search_datelimit_endmonth', 'int'), GETPOST('search_datelimit_endday', 'int'), GETPOST('search_datelimit_endyear', 'int')); $search_categ_cus=trim(GETPOST("search_categ_cus", 'int')); $search_btn=GETPOST('button_search', 'alpha'); $search_remove_btn=GETPOST('button_removefilter', 'alpha'); @@ -248,14 +247,12 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', $search_type=''; $search_country=''; $search_type_thirdparty=''; - $search_day=''; - $search_year=''; - $search_month=''; + $search_date_start=''; + $search_date_end=''; + $search_datelimit_start=''; + $search_datelimit_end=''; $option=''; $filter=''; - $search_day_lim=''; - $search_year_lim=''; - $search_month_lim=''; $toselect=''; $search_array_options=array(); $search_categ_cus=0; @@ -445,47 +442,49 @@ if ($filtre) $sql .= ' AND ' . $db->escape(trim($filt[0])) . ' = ' . $db->escape(trim($filt[1])); } } -if ($search_ref) $sql .= natural_search('f.ref', $search_ref); -if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer); +if ($search_ref) $sql .= natural_search('f.ref', $search_ref); +if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer); if ($search_type != '' && $search_type != '-1') $sql.=" AND f.type IN (".$db->escape($search_type).")"; -if ($search_project_ref) $sql .= natural_search('p.ref', $search_project_ref); -if ($search_project) $sql .= natural_search('p.title', $search_project); -if ($search_societe) $sql .= natural_search('s.nom', $search_societe); -if ($search_town) $sql.= natural_search('s.town', $search_town); -if ($search_zip) $sql.= natural_search("s.zip", $search_zip); -if ($search_state) $sql.= natural_search("state.nom", $search_state); -if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')'; -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')'; -if ($search_company) $sql .= natural_search('s.nom', $search_company); -if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1); -if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1); +if ($search_project_ref) $sql .= natural_search('p.ref', $search_project_ref); +if ($search_project) $sql .= natural_search('p.title', $search_project); +if ($search_societe) $sql .= natural_search('s.nom', $search_societe); +if ($search_town) $sql.= natural_search('s.town', $search_town); +if ($search_zip) $sql.= natural_search("s.zip", $search_zip); +if ($search_state) $sql.= natural_search("state.nom", $search_state); +if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')'; +if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')'; +if ($search_company) $sql .= natural_search('s.nom', $search_company); +if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1); +if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1); if ($search_montant_localtax1 != '') $sql.= natural_search('f.localtax1', $search_montant_localtax1, 1); if ($search_montant_localtax2 != '') $sql.= natural_search('f.localtax2', $search_montant_localtax2, 1); -if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); -if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); -if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; +if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); +if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); +if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; if ($search_status != '-1' && $search_status != '') { if (is_numeric($search_status) && $search_status >= 0) { - if ($search_status == '0') $sql.=" AND f.fk_statut = 0"; // draft - if ($search_status == '1') $sql.=" AND f.fk_statut = 1"; // unpayed - if ($search_status == '2') $sql.=" AND f.fk_statut = 2"; // payed Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed) - if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned + if ($search_status == '0') $sql.=" AND f.fk_statut = 0"; // draft + if ($search_status == '1') $sql.=" AND f.fk_statut = 1"; // unpayed + if ($search_status == '2') $sql.=" AND f.fk_statut = 2"; // payed Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed) + if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned } else { $sql.= " AND f.fk_statut IN (".$db->escape($search_status).")"; // When search_status is '1,2' for example } } -if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode); -if ($search_paymentterms > 0) $sql .= " AND f.fk_cond_reglement = ".$db->escape($search_paymentterms); -if ($search_module_source) $sql .= natural_search("f.module_source", $search_module_source); -if ($search_pos_source) $sql .= natural_search("f.pos_source", $search_pos_source); -$sql.= dolSqlDateFilter("f.datef", $search_day, $search_month, $search_year); -$sql.= dolSqlDateFilter("f.date_lim_reglement", $search_day_lim, $search_month_lim, $search_year_lim); -if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'"; -if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .(int) $search_sale; +if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode); +if ($search_paymentterms > 0) $sql .= " AND f.fk_cond_reglement = ".$db->escape($search_paymentterms); +if ($search_module_source) $sql .= natural_search("f.module_source", $search_module_source); +if ($search_pos_source) $sql .= natural_search("f.pos_source", $search_pos_source); +if ($search_date_start) $sql.= " AND f.datef >= '" . $db->idate($search_date_start) . "'"; +if ($search_date_end) $sql.= " AND f.datef <= '" . $db->idate($search_date_end) . "'"; +if ($search_datelimit_start) $sql.= " AND f.date_lim_reglement >= '" . $db->idate($search_datelimit_start) . "'"; +if ($search_datelimit_end) $sql.= " AND f.date_lim_reglement <= '" . $db->idate($search_datelimit_end) . "'"; +if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'"; +if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .(int) $search_sale; if ($search_user > 0) { $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".$search_user; @@ -752,20 +751,29 @@ if ($resql) // Date invoice if (! empty($arrayfields['f.date']['checked'])) { - print ''; } // Date due if (! empty($arrayfields['f.date_lim_reglement']['checked'])) { - print ''; } // Project ref @@ -778,7 +786,7 @@ if ($resql) { print ''; } - // Thirpdarty + // Thirdparty if (! empty($arrayfields['s.nom']['checked'])) { print ''; From 5cf111120431d22f10a57b755c7bddc671171185 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 7 Nov 2019 08:44:09 +0100 Subject: [PATCH 017/421] NEW Salaries list - Add date start & date end --- htdocs/salaries/list.php | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 51fd8462180..ec859678911 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -40,6 +40,8 @@ $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; $search_ref = GETPOST('search_ref', 'int'); $search_user = GETPOST('search_user', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); $search_amount = GETPOST('search_amount', 'alpha'); $search_account = GETPOST('search_account', 'int'); @@ -80,7 +82,10 @@ else if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers { $search_ref=""; + $search_user=""; $search_label=""; + $search_date_start=''; + $search_date_end=''; $search_amount=""; $search_account=''; $typeid=""; @@ -111,11 +116,13 @@ $sql.= " WHERE u.rowid = s.fk_user"; $sql.= " AND s.entity = ".$conf->entity; // Search criteria -if ($search_ref) $sql.=" AND s.rowid=".$search_ref; -if ($search_user) $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user); -if ($search_label) $sql.=natural_search(array('s.label'), $search_label); -if ($search_amount) $sql.=natural_search("s.amount", $search_amount, 1); -if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; +if ($search_ref) $sql.=" AND s.rowid=".$search_ref; +if ($search_user) $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user); +if ($search_label) $sql.=natural_search(array('s.label'), $search_label); +if ($search_date_start) $sql.= " AND s.datep >= '" . $db->idate($search_date_start) . "'"; +if ($search_date_end) $sql.= " AND s.datep <= '" . $db->idate($search_date_end) . "'"; +if ($search_amount) $sql.=natural_search("s.amount", $search_amount, 1); +if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; if ($filtre) { $filtre=str_replace(":", "=", $filtre); $sql .= " AND ".$filtre; @@ -171,7 +178,7 @@ if ($result) print ''; // Ref - print ''; // Employee @@ -181,9 +188,18 @@ if ($result) // Label print ''; // Date - print ''; + print ''; // Type - print ''; // Account @@ -239,7 +255,7 @@ if ($result) // Label payment print "\n"; // Date payment - print '\n"; + print '\n"; // Type print ''; // Account @@ -269,7 +285,7 @@ if ($result) print ''; } // Amount - print ''; + print ''; print ''; print "\n"; @@ -281,7 +297,7 @@ if ($result) $colspan=5; if (! empty($conf->banque->enabled)) $colspan++; print ''; - print '"; + print '"; print ""; print "
'; - print $objectstatic->getNomUrl(1, '', '', 0, 1); + print $objectstatic->getNomUrl(1, '', '', 0, 1, $conf->global->PROPAL_LIST_SHOW_NOTES); print ''; From fefb4a7f95719d4ed74172996b5e858a579517e8 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 5 Nov 2019 15:13:44 +0100 Subject: [PATCH 013/421] FIX replace
by
--- htdocs/comm/propal/class/propal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 1ec4567d774..26f28aed9ea 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3630,7 +3630,7 @@ class Propal extends CommonObject $txttoshow .= dol_string_nohtmltag($this->note_private, 1); } if (!empty($this->note_public)) { - if (!empty($txttoshow)) $txttoshow .= '
'; + if (!empty($txttoshow)) $txttoshow .= '
'; $txttoshow .= dol_string_nohtmltag($this->note_public, 1); } } From bcafef42b0895ee310a13b3bae589f01e3d45598 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 6 Nov 2019 16:45:52 +0100 Subject: [PATCH 014/421] NEW tooltip notes with first public note and then private note --- htdocs/comm/propal/class/propal.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 26f28aed9ea..74da579e77e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3626,13 +3626,13 @@ class Propal extends CommonObject $txttoshow .= dol_string_nohtmltag($this->note_public, 1); } } else { - if (!empty($this->note_private)) { - $txttoshow .= dol_string_nohtmltag($this->note_private, 1); - } if (!empty($this->note_public)) { - if (!empty($txttoshow)) $txttoshow .= '
'; $txttoshow .= dol_string_nohtmltag($this->note_public, 1); } + if (!empty($this->note_private)) { + if (!empty($txttoshow)) $txttoshow .= '

'; + $txttoshow .= dol_string_nohtmltag($this->note_private, 1); + } } } From 938d997e51f8930b73a906a39162d12108dc2a82 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 7 Nov 2019 06:33:33 +0100 Subject: [PATCH 015/421] NEW Propal list - Add date start & date end --- htdocs/comm/propal/list.php | 153 +++++++++++++++++++----------------- 1 file changed, 80 insertions(+), 73 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index bccc742aa8e..9a2721a51ea 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1,18 +1,19 @@ - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2013 Regis Houssin - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2011 Juanjo Menent - * Copyright (C) 2010-2011 Philippe Grand - * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2016-2018 Ferran Marcet - * Copyright (C) 2017-2018 Charlene Benke - * Copyright (C) 2018 Nicolas ZABOURI +/* Copyright (C) 2001-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2013 Regis Houssin + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2011 Philippe Grand + * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2016-2018 Ferran Marcet + * Copyright (C) 2017-2018 Charlene Benke + * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2019 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 @@ -75,15 +76,12 @@ $search_zip=GETPOST('search_zip', 'alpha'); $search_state=trim(GETPOST("search_state")); $search_country=GETPOST("search_country", 'int'); $search_type_thirdparty=GETPOST("search_type_thirdparty", 'int'); -$search_day=GETPOST("search_day", "int"); -$search_month=GETPOST("search_month", "int"); -$search_year=GETPOST("search_year", "int"); -$search_dayfin=GETPOST("search_dayfin", "int"); -$search_month_end=GETPOST("search_month_end", "int"); -$search_yearfin=GETPOST("search_yearfin", "int"); -$search_daydelivery=GETPOST("search_daydelivery", "int"); -$search_monthdelivery=GETPOST("search_monthdelivery", "int"); -$search_yeardelivery=GETPOST("search_yeardelivery", "int"); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); +$search_dateend_start = dol_mktime(0, 0, 0, GETPOST('search_dateend_startmonth', 'int'), GETPOST('search_dateend_startday', 'int'), GETPOST('search_dateend_startyear', 'int')); +$search_dateend_end = dol_mktime(23, 59, 59, GETPOST('search_dateend_endmonth', 'int'), GETPOST('search_dateend_endday', 'int'), GETPOST('search_dateend_endyear', 'int')); +$search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_startmonth', 'int'), GETPOST('search_datedelivery_startday', 'int'), GETPOST('search_datedelivery_startyear', 'int')); +$search_datedelivery_end = dol_mktime(23, 59, 59, GETPOST('search_datedelivery_endmonth', 'int'), GETPOST('search_datedelivery_endday', 'int'), GETPOST('search_datedelivery_endyear', 'int')); $search_availability=GETPOST('search_availability', 'int'); $search_categ_cus=trim(GETPOST("search_categ_cus", 'int')); $search_btn=GETPOST('button_search', 'alpha'); @@ -219,15 +217,12 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_type=''; $search_country=''; $search_type_thirdparty=''; - $search_year=''; - $search_month=''; - $search_day=''; - $search_yearfin=''; - $search_month_end=''; - $search_dayfin=''; - $search_yeardelivery=''; - $search_monthdelivery=''; - $search_daydelivery=''; + $search_date_start=''; + $search_date_end=''; + $search_dateend_start=''; + $search_dateend_end=''; + $search_datedelivery_start=''; + $search_datedelivery_end=''; $search_availability=''; $viewstatut=''; $object_statut=''; @@ -313,38 +308,41 @@ if (! $user->rights->societe->client->voir && ! $socid) //restriction { $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; } -if ($search_town) $sql.= natural_search('s.town', $search_town); -if ($search_zip) $sql.= natural_search("s.zip", $search_zip); -if ($search_state) $sql.= natural_search("state.nom", $search_state); -if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')'; -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')'; -if ($search_ref) $sql .= natural_search('p.ref', $search_ref); -if ($search_refcustomer) $sql .= natural_search('p.ref_client', $search_refcustomer); -if ($search_refproject) $sql .= natural_search('pr.ref', $search_refproject); -if ($search_project) $sql .= natural_search('pr.title', $search_project); -if ($search_availability) $sql .= " AND p.fk_availability IN (".$db->escape($search_availability).')'; +if ($search_town) $sql.= natural_search('s.town', $search_town); +if ($search_zip) $sql.= natural_search("s.zip", $search_zip); +if ($search_state) $sql.= natural_search("state.nom", $search_state); +if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')'; +if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')'; +if ($search_ref) $sql .= natural_search('p.ref', $search_ref); +if ($search_refcustomer) $sql .= natural_search('p.ref_client', $search_refcustomer); +if ($search_refproject) $sql .= natural_search('pr.ref', $search_refproject); +if ($search_project) $sql .= natural_search('pr.title', $search_project); +if ($search_availability) $sql .= " AND p.fk_availability IN (".$db->escape($search_availability).')'; -if ($search_societe) $sql .= natural_search('s.nom', $search_societe); -if ($search_login) $sql .= natural_search("u.login", $search_login); -if ($search_montant_ht != '') $sql.= natural_search("p.total_ht", $search_montant_ht, 1); -if ($search_montant_vat != '') $sql.= natural_search("p.tva", $search_montant_vat, 1); -if ($search_montant_ttc != '') $sql.= natural_search("p.total", $search_montant_ttc, 1); +if ($search_societe) $sql .= natural_search('s.nom', $search_societe); +if ($search_login) $sql .= natural_search("u.login", $search_login); +if ($search_montant_ht != '') $sql.= natural_search("p.total_ht", $search_montant_ht, 1); +if ($search_montant_vat != '') $sql.= natural_search("p.tva", $search_montant_vat, 1); +if ($search_montant_ttc != '') $sql.= natural_search("p.total", $search_montant_ttc, 1); if ($sall) { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } -if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); -if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; +if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); +if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; -if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$db->escape($search_product_category); -if ($socid > 0) $sql.= ' AND s.rowid = '.$socid; +if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$db->escape($search_product_category); +if ($socid > 0) $sql.= ' AND s.rowid = '.$socid; if ($viewstatut != '' && $viewstatut != '-1') { $sql.= ' AND p.fk_statut IN ('.$db->escape($viewstatut).')'; } -$sql.= dolSqlDateFilter("p.datep", $search_day, $search_month, $search_year); -$sql.= dolSqlDateFilter("p.fin_validite", $search_dayfin, $search_month_end, $search_yearfin); -$sql.= dolSqlDateFilter("p.date_livraison", $search_daydelivery, $search_monthdelivery, $search_yeardelivery); -if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$db->escape($search_sale); +if ($search_date_start) $sql.= " AND p.datep >= '" . $db->idate($search_date_start) . "'"; +if ($search_date_end) $sql.= " AND p.datep <= '" . $db->idate($search_date_end) . "'"; +if ($search_dateend_start) $sql.= " AND p.fin_validite >= '" . $db->idate($search_dateend_start) . "'"; +if ($search_dateend_end) $sql.= " AND p.fin_validite <= '" . $db->idate($search_dateend_end) . "'"; +if ($search_datedelivery_start) $sql.= " AND p.date_livraison >= '" . $db->idate($search_datedelivery_start) . "'"; +if ($search_datedelivery_end) $sql.= " AND p.date_livraison <= '" . $db->idate($search_datedelivery_end) . "'"; +if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$db->escape($search_sale); if ($search_user > 0) { $sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$db->escape($search_user); @@ -594,34 +592,43 @@ if ($resql) // Date if (! empty($arrayfields['p.date']['checked'])) { - print '
'; - //print $langs->trans('Month').': '; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - //print ' '.$langs->trans('Year').': '; - $formother->select_year($search_year, 'search_year', 1, 20, 5); + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print '
'; print '
'; - //print $langs->trans('Month').': '; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - //print ' '.$langs->trans('Year').': '; - $formother->select_year($search_yearfin, 'search_yearfin', 1, 20, 5); + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_dateend_start?$search_dateend_start:-1, 'search_dateend_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_dateend_end?$search_dateend_end:-1, 'search_dateend_end', 0, 0, 1); + print '
'; print '
'; - //print $langs->trans('Month').': '; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - //print ' '.$langs->trans('Year').': '; - $formother->select_year($search_yeardelivery, 'search_yeardelivery', 1, 20, 5); + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_datedelivery_start?$search_datedelivery_start:-1, 'search_datedelivery_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_datedelivery_end?$search_datedelivery_end:-1, 'search_datedelivery_end', 0, 0, 1); + print '
'; print '
'; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($search_year?$search_year:-1, 'search_year', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print '
'; print '
'; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($search_year_lim?$search_year_lim:-1, 'search_year_lim', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); - print '
'.$langs->trans("Alert"); + print '
'; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_datelimit_start?$search_datelimit_start:-1, 'search_datelimit_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_datelimit_end?$search_datelimit_end:-1, 'search_datelimit_end', 0, 0, 1); + print '
'; print '
'; + print ''; print ''; print ' '; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print '
'; + print '
'; + print ''; $form->select_types_paiements($typeid, 'typeid', '', 0, 1, 1, 16); print '".dol_trunc($obj->label, 40)."'.dol_print_date($db->jdate($obj->datep), 'day')."'.dol_print_date($db->jdate($obj->datep), 'day')."'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''.price($obj->amount).''.price($obj->amount).'
'.$langs->trans("Total").''.price($total)."'.price($total)."
"; From b85dc0c5e5556618c0c3a328dc20fc32d3fbabfb Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 7 Nov 2019 09:19:48 +0100 Subject: [PATCH 018/421] NEW Various payment list - Add search date start & date end & subledger_account --- htdocs/compta/bank/various_payment/list.php | 96 +++++++++++++-------- 1 file changed, 62 insertions(+), 34 deletions(-) diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index d73d6d8a391..205df51d6a6 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017-2019 Alexandre Spangaro * Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2018 Frédéric France * @@ -44,11 +44,15 @@ $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; $search_ref = GETPOST('search_ref', 'int'); $search_user = GETPOST('search_user', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); $search_amount_deb = GETPOST('search_amount_deb', 'alpha'); $search_amount_cred = GETPOST('search_amount_cred', 'alpha'); $search_account = GETPOST('search_account', 'int'); -$search_date = dol_mktime(0, 0, 0, GETPOST('date_docmonth', 'int'), GETPOST('date_docday', 'int'), GETPOST('date_docyear', 'int')); -$search_accountancy_code = GETPOST("search_accountancy_code"); +$search_accountancy_account = GETPOST("search_accountancy_account"); +if ($search_accountancy_account == - 1) $search_accountancy_account = ''; +$search_accountancy_subledger = GETPOST("search_accountancy_subledger"); +if ($search_accountancy_subledger == - 1) $search_accountancy_subledger = ''; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); @@ -81,12 +85,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' { $search_ref=""; $search_label=""; + $search_date_start=''; + $search_date_end=''; $search_amount_deb=""; $search_amount_cred=""; $search_account=''; + $search_accountancy_account = ''; + $search_accountancy_subledger = ''; $typeid=""; - $search_date = ''; - $search_accountancy_code = ''; } /* @@ -100,7 +106,7 @@ $formaccounting = new FormAccounting($db); $variousstatic = new PaymentVarious($db); $accountstatic = new Account($db); -$sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code,"; +$sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code, v.subledger_account,"; $sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,"; $sql.= " pst.code as payment_code"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v"; @@ -110,14 +116,16 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.row $sql.= " WHERE v.entity IN (".getEntity('payment_various').")"; // Search criteria -if ($search_ref) $sql.=" AND v.rowid=".$db->escape($search_ref); -if ($search_label) $sql.=natural_search(array('v.label'), $search_label); -if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1); -if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1); -if ($search_account > 0) $sql.=" AND b.fk_account=".$db->escape($search_account); -if ($search_date) $sql.=" AND v.datep = '".$db->idate($search_date)."'"; -if ($search_accountancy_code > 0) $sql.=" AND v.accountancy_code=".$db->escape($search_accountancy_code); -if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid; +if ($search_ref) $sql.= " AND v.rowid=".$db->escape($search_ref); +if ($search_label) $sql.= natural_search(array('v.label'), $search_label); +if ($search_date_start) $sql.= " AND v.datep >= '" . $db->idate($search_date_start) . "'"; +if ($search_date_end) $sql.= " AND v.datep <= '" . $db->idate($search_date_end) . "'"; +if ($search_amount_deb) $sql.= natural_search("v.amount", $search_amount_deb, 1); +if ($search_amount_cred) $sql.= natural_search("v.amount", $search_amount_cred, 1); +if ($search_account > 0) $sql.= " AND b.fk_account=".$db->escape($search_account); +if ($search_accountancy_account > 0) $sql.= " AND v.accountancy_code=".$db->escape($search_accountancy_account); +if ($search_accountancy_subledger > 0) $sql.= " AND v.subledger_account=".$db->escape($search_accountancy_subledger); +if ($typeid > 0) $sql.= " AND v.fk_typepayment=".$typeid; if ($filtre) { $filtre=str_replace(":", "=", $filtre); $sql .= " AND ".$filtre; @@ -143,14 +151,16 @@ if ($result) $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - if ($search_ref) $param.='&search_ref='.urlencode($search_ref); - if ($search_label) $param.='&search_label='.urlencode($search_label); - if ($typeid > 0) $param.='&typeid='.urlencode($typeid); - if ($search_amount_deb) $param.='&search_amount_deb='.urlencode($search_amount_deb); - if ($search_amount_cred) $param.='&search_amount_cred='.urlencode($search_amount_cred); - if ($search_account > 0) $param.='&search_amount='.urlencode($search_account); - //if ($search_date) $param.='&search_date='.$search_date; - if ($search_accountancy_code > 0) $param.='&search_accountancy_code='.urlencode($search_accountancy_code); + if ($search_ref) $param.='&search_ref='.urlencode($search_ref); + if ($search_label) $param.='&search_label='.urlencode($search_label); + if ($search_date_start) $param.='&search_date_start='.urlencode($search_date_start); + if ($search_date_end) $param.='&search_date_end='.urlencode($search_date_end); + if ($typeid > 0) $param.='&typeid='.urlencode($typeid); + if ($search_amount_deb) $param.='&search_amount_deb='.urlencode($search_amount_deb); + if ($search_amount_cred) $param.='&search_amount_cred='.urlencode($search_amount_cred); + if ($search_account > 0) $param.='&search_amount='.urlencode($search_account); + if ($search_accountancy_account > 0) $param.='&search_accountancy_account='.urlencode($search_accountancy_account); + if ($search_accountancy_subledger > 0) $param.='&search_accountancy_subledger='.urlencode($search_accountancy_subledger); if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); @@ -190,7 +200,13 @@ if ($result) // Date print ''; print '
'; - print $form->selectDate($search_date, 'date_doc', 0, 0, 1); + print $langs->trans('From') . ' '; + print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print '
'; print ''; @@ -207,12 +223,20 @@ if ($result) print ''; } - // Accounting account + if (! empty($conf->accounting->enabled)) { + // Accounting account print ''; print '
'; - print $formaccounting->select_account($search_accountancy_code, 'search_accountancy_code', 1, array (), 1, 1, 'maxwidth200'); + print $formaccounting->select_account($search_accountancy_account, 'search_accountancy_account', 1, array (), 1, 1, 'maxwidth200'); + print '
'; + print ''; + + // Subledger account + print ''; + print '
'; + print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, array (), 1, 1, 'maxwidth200'); print '
'; print ''; } @@ -237,7 +261,8 @@ if ($result) print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep,v.rowid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'left '); if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); - if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left '); + if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccountingShort", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left '); + if (! empty($conf->accounting->enabled)) print_liste_field_titre("SubledgerAccount", $_SERVER["PHP_SELF"], "v.subledger_account", "", $param, '', $sortfield, $sortorder, 'left '); print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); @@ -305,8 +330,15 @@ if ($result) if (! $i) $totalarray['nbfield']++; } + // Accounting subledger account + if (! empty($conf->accounting->enabled)) + { + print '' . length_accounta($obj->subledger_account) . ''; + if (! $i) $totalarray['nbfield']++; + } + // Debit - print ""; + print ''; if ($obj->sens == 0) { print price($obj->amount); @@ -314,10 +346,10 @@ if ($result) } if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_deb'; - print ""; + print ''; // Credit - print ""; + print ''; if ($obj->sens == 1) { print price($obj->amount); @@ -325,17 +357,13 @@ if ($result) } if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_cred'; - print ""; + print ''; print ""; $i++; } - $colspan=4; - if (! empty($conf->banque->enabled)) $colspan++; - if (! empty($conf->accounting->enabled)) $colspan++; - // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; From 9ff10d430b643772d239b9889a113e3e17273483 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 7 Nov 2019 13:57:04 +0100 Subject: [PATCH 019/421] NEW Customer command list - Add date start & date end --- htdocs/commande/list.php | 136 ++++++++++++++++++++------------------- 1 file changed, 71 insertions(+), 65 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index dadc25737b6..a66731885a8 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -56,12 +56,10 @@ $confirm=GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'orderlist'; -$search_orderyear=GETPOST("search_orderyear", "int"); -$search_ordermonth=GETPOST("search_ordermonth", "int"); -$search_orderday=GETPOST("search_orderday", "int"); -$search_deliveryyear=GETPOST("search_deliveryyear", "int"); -$search_deliverymonth=GETPOST("search_deliverymonth", "int"); -$search_deliveryday=GETPOST("search_deliveryday", "int"); +$search_dateorder_start= dol_mktime(0, 0, 0, GETPOST('search_dateorder_startmonth', 'int'), GETPOST('search_dateorder_startday', 'int'), GETPOST('search_dateorder_startyear', 'int')); +$search_dateorder_end= dol_mktime(23, 59, 59, GETPOST('search_dateorder_endmonth', 'int'), GETPOST('search_dateorder_endday', 'int'), GETPOST('search_dateorder_endyear', 'int')); +$search_datedelivery_start= dol_mktime(0, 0, 0, GETPOST('search_datedelivery_startmonth', 'int'), GETPOST('search_datedelivery_startday', 'int'), GETPOST('search_datedelivery_startyear', 'int')); +$search_datedelivery_end= dol_mktime(23, 59, 59, GETPOST('search_datedelivery_endmonth', 'int'), GETPOST('search_datedelivery_endday', 'int'), GETPOST('search_datedelivery_endyear', 'int')); $search_product_category=GETPOST('search_product_category', 'int'); $search_ref=GETPOST('search_ref', 'alpha')!=''?GETPOST('search_ref', 'alpha'):GETPOST('sref', 'alpha'); $search_ref_customer=GETPOST('search_ref_customer', 'alpha'); @@ -197,12 +195,10 @@ if (empty($reshook)) $search_total_ht=''; $search_total_vat=''; $search_total_ttc=''; - $search_orderyear=''; - $search_ordermonth=''; - $search_orderday=''; - $search_deliveryday=''; - $search_deliverymonth=''; - $search_deliveryyear=''; + $search_dateorder_start=''; + $search_dateorder_end=''; + $search_datedelivery_start=''; + $search_datedelivery_end=''; $search_project_ref=''; $search_project=''; $viewstatut=''; @@ -311,22 +307,24 @@ if ($viewstatut <> '') $sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed } } -$sql.= dolSqlDateFilter("c.date_commande", $search_orderday, $search_ordermonth, $search_orderyear); -$sql.= dolSqlDateFilter("c.date_livraison", $search_deliveryday, $search_deliverymonth, $search_deliveryyear); -if ($search_town) $sql.= natural_search('s.town', $search_town); -if ($search_zip) $sql.= natural_search("s.zip", $search_zip); -if ($search_state) $sql.= natural_search("state.nom", $search_state); -if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; -if ($search_company) $sql .= natural_search('s.nom', $search_company); -if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; -if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; -if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1); -if ($search_total_ttc != '') $sql.= natural_search('c.total_ttc', $search_total_ttc, 1); -if ($search_project_ref != '') $sql.= natural_search("p.ref", $search_project_ref); -if ($search_project != '') $sql.= natural_search("p.title", $search_project); -if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); -if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; +if ($search_dateorder_start) $sql.= " AND c.date_commande >= '" . $db->idate($search_dateorder_start) . "'"; +if ($search_dateorder_end) $sql.= " AND c.date_commande <= '" . $db->idate($search_dateorder_end) . "'"; +if ($search_datedelivery_start) $sql.= " AND c.date_livraison >= '" . $db->idate($search_datedelivery_start) . "'"; +if ($search_datedelivery_end) $sql.= " AND c.date_livraison <= '" . $db->idate($search_datedelivery_end) . "'"; +if ($search_town) $sql.= natural_search('s.town', $search_town); +if ($search_zip) $sql.= natural_search("s.zip", $search_zip); +if ($search_state) $sql.= natural_search("state.nom", $search_state); +if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; +if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; +if ($search_company) $sql .= natural_search('s.nom', $search_company); +if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; +if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; +if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1); +if ($search_total_ttc != '') $sql.= natural_search('c.total_ttc', $search_total_ttc, 1); +if ($search_project_ref != '') $sql.= natural_search("p.ref", $search_project_ref); +if ($search_project != '') $sql.= natural_search("p.title", $search_project); +if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); +if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks @@ -402,34 +400,32 @@ if ($resql) if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - if ($sall) $param.='&sall='.urlencode($sall); - if ($socid > 0) $param.='&socid='.urlencode($socid); - if ($viewstatut != '') $param.='&viewstatut='.urlencode($viewstatut); - if ($search_orderday) $param.='&search_orderday='.urlencode($search_orderday); - if ($search_ordermonth) $param.='&search_ordermonth='.urlencode($search_ordermonth); - if ($search_orderyear) $param.='&search_orderyear='.urlencode($search_orderyear); - if ($search_deliveryday) $param.='&search_deliveryday='.urlencode($search_deliveryday); - if ($search_deliverymonth) $param.='&search_deliverymonth='.urlencode($search_deliverymonth); - if ($search_deliveryyear) $param.='&search_deliveryyear='.urlencode($search_deliveryyear); - if ($search_ref) $param.='&search_ref='.urlencode($search_ref); - if ($search_company) $param.='&search_company='.urlencode($search_company); - if ($search_ref_customer) $param.='&search_ref_customer='.urlencode($search_ref_customer); - if ($search_user > 0) $param.='&search_user='.urlencode($search_user); - if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); - if ($search_total_ht != '') $param.='&search_total_ht='.urlencode($search_total_ht); - if ($search_total_vat != '') $param.='&search_total_vat='.urlencode($search_total_vat); - if ($search_total_ttc != '') $param.='&search_total_ttc='.urlencode($search_total_ttc); - if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref); - if ($search_town != '') $param.='&search_town='.urlencode($search_town); - if ($search_zip != '') $param.='&search_zip='.urlencode($search_zip); - if ($search_state != '') $param.='&search_state='.urlencode($search_state); - if ($search_country != '') $param.='&search_country='.urlencode($search_country); + if ($sall) $param.='&sall='.urlencode($sall); + if ($socid > 0) $param.='&socid='.urlencode($socid); + if ($viewstatut != '') $param.='&viewstatut='.urlencode($viewstatut); + if ($search_dateorder_start) $param.='&search_dateorder_start=' . urlencode($search_dateorder_start); + if ($search_dateorder_end) $param.='&search_dateorder_end=' . urlencode($search_dateorder_end); + if ($search_datedelivery_start) $param.='&search_datedelivery_start=' . urlencode($search_datedelivery_start); + if ($search_datedelivery_end) $param.='&search_datedelivery_end=' . urlencode($search_datedelivery_end); + if ($search_ref) $param.='&search_ref='.urlencode($search_ref); + if ($search_company) $param.='&search_company='.urlencode($search_company); + if ($search_ref_customer) $param.='&search_ref_customer='.urlencode($search_ref_customer); + if ($search_user > 0) $param.='&search_user='.urlencode($search_user); + if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); + if ($search_total_ht != '') $param.='&search_total_ht='.urlencode($search_total_ht); + if ($search_total_vat != '') $param.='&search_total_vat='.urlencode($search_total_vat); + if ($search_total_ttc != '') $param.='&search_total_ttc='.urlencode($search_total_ttc); + if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref); + if ($search_town != '') $param.='&search_town='.urlencode($search_town); + if ($search_zip != '') $param.='&search_zip='.urlencode($search_zip); + if ($search_state != '') $param.='&search_state='.urlencode($search_state); + if ($search_country != '') $param.='&search_country='.urlencode($search_country); if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.urlencode($search_type_thirdparty); if ($search_product_category != '') $param.='&search_product_category='.urlencode($search_product_category); if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus); - if ($show_files) $param.='&show_files=' .urlencode($show_files); - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); - if ($billed != '') $param.='&billed='.urlencode($billed); + if ($show_files) $param.='&show_files=' .urlencode($show_files); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + if ($billed != '') $param.='&billed='.urlencode($billed); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -646,18 +642,28 @@ if ($resql) // Date order if (! empty($arrayfields['c.date_commande']['checked'])) { - print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($search_orderyear?$search_orderyear:-1, 'search_orderyear', 1, 20, 5); + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_dateorder_start?$search_dateorder_start:-1, 'search_dateorder_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_dateorder_end?$search_dateorder_end:-1, 'search_dateorder_end', 0, 0, 1); + print '
'; print ''; } if (! empty($arrayfields['c.date_delivery']['checked'])) { - print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($search_deliveryyear?$search_deliveryyear:-1, 'search_deliveryyear', 1, 20, 5); + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_datedelivery_start?$search_datedelivery_start:-1, 'search_datedelivery_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_datedelivery_end?$search_datedelivery_end:-1, 'search_datedelivery_end', 0, 0, 1); + print '
'; print ''; } if (! empty($arrayfields['c.total_ht']['checked'])) @@ -1044,7 +1050,7 @@ if ($resql) print ''; if (! $i) $totalarray['nbfield']++; } - // Plannned date of delivery + // Planned date of delivery if (! empty($arrayfields['c.date_delivery']['checked'])) { print ''; @@ -1055,7 +1061,7 @@ if ($resql) // Amount HT if (! empty($arrayfields['c.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; + print ''.price($obj->total_ht)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_ht'; $totalarray['val']['c.total_ht'] += $obj->total_ht; @@ -1063,7 +1069,7 @@ if ($resql) // Amount VAT if (! empty($arrayfields['c.total_vat']['checked'])) { - print ''.price($obj->total_tva)."\n"; + print ''.price($obj->total_tva)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_tva'; $totalarray['val']['c.total_tva'] += $obj->total_tva; @@ -1071,7 +1077,7 @@ if ($resql) // Amount TTC if (! empty($arrayfields['c.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; + print ''.price($obj->total_ttc)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_ttc'; $totalarray['val']['c.total_ttc'] += $obj->total_ttc; From 55e3d7b89983f7af3b37da096793434ee0f77d41 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 7 Nov 2019 14:21:11 +0100 Subject: [PATCH 020/421] NEW Expedition list - Add date start & date end --- htdocs/expedition/list.php | 77 +++++++++++++++++++++++++++----------- 1 file changed, 56 insertions(+), 21 deletions(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index eeb05e8926c..961afb0191d 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -59,6 +59,10 @@ $search_state=trim(GETPOST("search_state")); $search_country=GETPOST("search_country", 'int'); $search_type_thirdparty=GETPOST("search_type_thirdparty", 'int'); $search_billed=GETPOST("search_billed", 'int'); +$search_datedelivery_start= dol_mktime(0, 0, 0, GETPOST('search_datedelivery_startmonth', 'int'), GETPOST('search_datedelivery_startday', 'int'), GETPOST('search_datedelivery_startyear', 'int')); +$search_datedelivery_end= dol_mktime(23, 59, 59, GETPOST('search_datedelivery_endmonth', 'int'), GETPOST('search_datedelivery_endday', 'int'), GETPOST('search_datedelivery_endyear', 'int')); +$search_datereceipt_start= dol_mktime(0, 0, 0, GETPOST('search_datereceipt_startmonth', 'int'), GETPOST('search_datereceipt_startday', 'int'), GETPOST('search_datereceipt_startyear', 'int')); +$search_datereceipt_end= dol_mktime(23, 59, 59, GETPOST('search_datereceipt_endmonth', 'int'), GETPOST('search_datereceipt_endday', 'int'), GETPOST('search_datereceipt_endyear', 'int')); $sall = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); $optioncss = GETPOST('optioncss', 'alpha'); @@ -156,6 +160,10 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_country=''; $search_type_thirdparty=''; $search_billed=''; + $search_datedelivery_start=''; + $search_datedelivery_end=''; + $search_datereceipt_start=''; + $search_datereceipt_end=''; $viewstatut=''; $toselect = ''; $search_array_options=array(); @@ -224,17 +232,22 @@ if ($socid) if ($viewstatut <> '' && $viewstatut >= 0) { $sql.= " AND e.fk_statut = ".$viewstatut; } -if ($search_ref_customer != '') $sql.=natural_search('e.ref_customer', $search_ref_customer); +if ($search_ref_customer != '') $sql.=natural_search('e.ref_customer', $search_ref_customer); if ($search_billed != '' && $search_billed >= 0) $sql.=' AND e.billed = '.$search_billed; -if ($search_town) $sql.= natural_search('s.town', $search_town); -if ($search_zip) $sql.= natural_search("s.zip", $search_zip); -if ($search_state) $sql.= natural_search("state.nom", $search_state); -if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; -if ($search_ref_exp) $sql .= natural_search('e.ref', $search_ref_exp); -if ($search_ref_liv) $sql .= natural_search('l.ref', $search_ref_liv); -if ($search_company) $sql .= natural_search('s.nom', $search_company); -if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); +if ($search_town) $sql.= natural_search('s.town', $search_town); +if ($search_zip) $sql.= natural_search("s.zip", $search_zip); +if ($search_state) $sql.= natural_search("state.nom", $search_state); +if ($search_country) $sql.= " AND s.fk_pays IN (".$search_country.')'; +if ($search_type_thirdparty) $sql.= " AND s.fk_typent IN (".$search_type_thirdparty.')'; +if ($search_ref_exp) $sql.= natural_search('e.ref', $search_ref_exp); +if ($search_ref_liv) $sql.= natural_search('l.ref', $search_ref_liv); +if ($search_company) $sql.= natural_search('s.nom', $search_company); +if ($search_datedelivery_start) $sql.= " AND e.date_delivery >= '" . $db->idate($search_datedelivery_start) . "'"; +if ($search_datedelivery_end) $sql.= " AND e.date_delivery <= '" . $db->idate($search_datedelivery_end) . "'"; +if ($search_datereceipt_start) $sql.= " AND l.date_delivery >= '" . $db->idate($search_datereceipt_start) . "'"; +if ($search_datereceipt_end) $sql.= " AND l.date_delivery <= '" . $db->idate($search_datereceipt_end) . "'"; + +if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; @@ -273,15 +286,19 @@ if ($resql) $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - if ($sall) $param.= "&sall=".urlencode($sall); - if ($search_ref_exp) $param.= "&search_ref_exp=".urlencode($search_ref_exp); - if ($search_ref_liv) $param.= "&search_ref_liv=".urlencode($search_ref_liv); - if ($search_ref_customer) $param.= "&search_ref_customer=".urlencode($search_ref_customer); - if ($search_company) $param.= "&search_company=".urlencode($search_company); - if ($search_town) $param.= '&search_town='.urlencode($search_town); - if ($search_zip) $param.= '&search_zip='.urlencode($search_zip); - if ($viewstatut != '') $param.= '&viewstatut='.urlencode($viewstatut); - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + if ($sall) $param.= "&sall=".urlencode($sall); + if ($search_ref_exp) $param.= "&search_ref_exp=".urlencode($search_ref_exp); + if ($search_ref_liv) $param.= "&search_ref_liv=".urlencode($search_ref_liv); + if ($search_ref_customer) $param.= "&search_ref_customer=".urlencode($search_ref_customer); + if ($search_company) $param.= "&search_company=".urlencode($search_company); + if ($search_town) $param.= '&search_town='.urlencode($search_town); + if ($search_zip) $param.= '&search_zip='.urlencode($search_zip); + if ($search_datedelivery_start) $param.='&search_datedelivery_start=' . urlencode($search_datedelivery_start); + if ($search_datedelivery_end) $param.='&search_datedelivery_end=' . urlencode($search_datedelivery_end); + if ($search_datereceipt_start) $param.='&search_datereceipt_start=' . urlencode($search_datereceipt_start); + if ($search_datereceipt_end) $param.='&search_datereceipt_end=' . urlencode($search_datereceipt_end); + if ($viewstatut != '') $param.= '&viewstatut='.urlencode($viewstatut); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -391,7 +408,16 @@ if ($resql) // Date delivery planned if (! empty($arrayfields['e.date_delivery']['checked'])) { - print ' '; + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_delivery_start?$search_delivery_start:-1, 'search_delivery_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_delivery_end?$search_delivery_end:-1, 'search_delivery_end', 0, 0, 1); + print '
'; + print ''; } if (! empty($arrayfields['l.ref']['checked'])) { @@ -403,7 +429,16 @@ if ($resql) if (! empty($arrayfields['l.date_delivery']['checked'])) { // Date received - print ' '; + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_receipt_start?$search_receipt_start:-1, 'search_receipt_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_receipt_end?$search_receipt_end:-1, 'search_receipt_end', 0, 0, 1); + print '
'; + print ''; } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; From 86b90b115fec5c0171c95accc1ca40926213217d Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 9 Nov 2019 05:20:13 +0100 Subject: [PATCH 021/421] NEW Invoice list - Add date start & date end --- htdocs/compta/facture/list.php | 56 ++++++++++++++++------------------ 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 2d06fa1f557..8440b514f24 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -569,38 +569,36 @@ if ($resql) $param='&socid='.$socid; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - if ($sall) $param.='&sall='.urlencode($sall); - if ($search_day) $param.='&search_day='.urlencode($search_day); - if ($search_month) $param.='&search_month='.urlencode($search_month); - if ($search_year) $param.='&search_year=' .urlencode($search_year); - if ($search_day_lim) $param.='&search_day_lim='.urlencode($search_day_lim); - if ($search_month_lim) $param.='&search_month_lim='.urlencode($search_month_lim); - if ($search_year_lim) $param.='&search_year_lim=' .urlencode($search_year_lim); - if ($search_ref) $param.='&search_ref=' .urlencode($search_ref); - if ($search_refcustomer) $param.='&search_refcustomer=' .urlencode($search_refcustomer); - if ($search_project_ref) $param.='&search_project_ref='.urlencode($search_project_ref); - if ($search_project) $param.='&search_project='.urlencode($search_project); - if ($search_type != '') $param.='&search_type='.urlencode($search_type); - if ($search_societe) $param.='&search_societe=' .urlencode($search_societe); - if ($search_town) $param.='&search_town='.urlencode($search_town); - if ($search_zip) $param.='&search_zip='.urlencode($search_zip); - if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale); - if ($search_user > 0) $param.='&search_user=' .urlencode($search_user); + if ($sall) $param.='&sall='.urlencode($sall); + if ($search_date_start) $param.='&search_date_start=' . urlencode($search_date_start); + if ($search_date_end) $param.='&search_date_end=' . urlencode($search_date_end); + if ($search_datelimit_start) $param.='&search_datelimit_start=' . urlencode($search_datelimit_start); + if ($search_datelimit_end) $param.='&search_datelimit_end=' . urlencode($search_datelimit_end); + if ($search_ref) $param.='&search_ref=' .urlencode($search_ref); + if ($search_refcustomer) $param.='&search_refcustomer=' .urlencode($search_refcustomer); + if ($search_project_ref) $param.='&search_project_ref='.urlencode($search_project_ref); + if ($search_project) $param.='&search_project='.urlencode($search_project); + if ($search_type != '') $param.='&search_type='.urlencode($search_type); + if ($search_societe) $param.='&search_societe=' .urlencode($search_societe); + if ($search_town) $param.='&search_town='.urlencode($search_town); + if ($search_zip) $param.='&search_zip='.urlencode($search_zip); + if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale); + if ($search_user > 0) $param.='&search_user=' .urlencode($search_user); if ($search_product_category > 0) $param.='&search_product_category=' .urlencode($search_product_category); - if ($search_montant_ht != '') $param.='&search_montant_ht='.urlencode($search_montant_ht); - if ($search_montant_vat != '') $param.='&search_montant_vat='.urlencode($search_montant_vat); + if ($search_montant_ht != '') $param.='&search_montant_ht='.urlencode($search_montant_ht); + if ($search_montant_vat != '') $param.='&search_montant_vat='.urlencode($search_montant_vat); if ($search_montant_localtax1 != '') $param.='&search_montant_localtax1='.urlencode($search_montant_localtax1); if ($search_montant_localtax2 != '') $param.='&search_montant_localtax2='.urlencode($search_montant_localtax2); - if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc); - if ($search_status != '') $param.='&search_status='.urlencode($search_status); - if ($search_paymentmode > 0) $param.='&search_paymentmode='.urlencode($search_paymentmode); - if ($search_paymentterms > 0) $param.='&search_paymentterms='.urlencode($search_paymentterms); - if ($search_module_source) $param.='&search_module_source='.urlencode($search_module_source); - if ($search_pos_source) $param.='&search_pos_source='.urlencode($search_pos_source); - if ($show_files) $param.='&show_files='.urlencode($show_files); - if ($option) $param.="&search_option=".urlencode($option); - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); - if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus); + if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc); + if ($search_status != '') $param.='&search_status='.urlencode($search_status); + if ($search_paymentmode > 0) $param.='&search_paymentmode='.urlencode($search_paymentmode); + if ($search_paymentterms > 0) $param.='&search_paymentterms='.urlencode($search_paymentterms); + if ($search_module_source) $param.='&search_module_source='.urlencode($search_module_source); + if ($search_pos_source) $param.='&search_pos_source='.urlencode($search_pos_source); + if ($show_files) $param.='&show_files='.urlencode($show_files); + if ($option) $param.="&search_option=".urlencode($option); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; From 812c0327547d08bd9309876d8d4a7f973cac0e18 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 12 Nov 2019 15:56:11 +0100 Subject: [PATCH 022/421] NEW French new regions --- .../install/mysql/data/llx_10_c_regions.sql | 25 ++++++------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index be485ddb6b1..bbb7af35bb7 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -45,25 +45,16 @@ insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 6,'97601',3,'Mayotte'); insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 11,'75056',1,'Île-de-France'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 21,'51108',0,'Champagne-Ardenne'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 22,'80021',0,'Picardie'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 23,'76540',0,'Haute-Normandie'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 24,'45234',2,'Centre'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 25,'14118',0,'Basse-Normandie'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 26,'21231',0,'Bourgogne'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 31,'59350',2,'Nord-Pas-de-Calais'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 41,'57463',0,'Lorraine'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 42,'67482',1,'Alsace'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 43,'25056',0,'Franche-Comté'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 24,'45234',2,'Centre-Val de Loire'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 27,'21231',0,'Bourgogne-Franche-Comté'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 28,'76540',0,'Normandie'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 32,'59350',4,'Hauts-de-France'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 44,'67482',2,'Grand Est'); insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 52,'44109',4,'Pays de la Loire'); insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 53,'35238',0,'Bretagne'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 54,'86194',2,'Poitou-Charentes'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 72,'33063',1,'Aquitaine'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 73,'31555',0,'Midi-Pyrénées'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 74,'87085',2,'Limousin'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 82,'69123',2,'Rhône-Alpes'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 83,'63113',1,'Auvergne'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 91,'34172',2,'Languedoc-Roussillon'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 75,'33063',0,'Nouvelle-Aquitaine'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 76,'31355',1,'Occitanie'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 84,'69123',1,'Auvergne-Rhône-Alpes'); insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 93,'13055',0,'Provence-Alpes-Côte d''Azur'); insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 94,'2A004',0,'Corse'); From 05ab4f79efe7a672d558066703fd4d8fe585e254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 13 Nov 2019 18:44:11 +0100 Subject: [PATCH 023/421] categories for actioncomm --- htdocs/categories/class/categorie.class.php | 8 + htdocs/categories/index.php | 8 +- htdocs/core/modules/modAgenda.class.php | 327 ++++++++++-------- .../install/mysql/migration/10.0.0-11.0.0.sql | 14 + htdocs/langs/en_US/categories.lang | 3 +- 5 files changed, 215 insertions(+), 145 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index f184f1b433f..e42f0fe32ff 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -54,6 +54,7 @@ class Categorie extends CommonObject const TYPE_ACCOUNT = 'bank_account'; const TYPE_BANK_LINE = 'bank_line'; const TYPE_WAREHOUSE = 'warehouse'; + const TYPE_ACTIONCOMM = 'actioncomm'; /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png @@ -77,6 +78,7 @@ class Categorie extends CommonObject 'user' => 7, 'bank_line' => 8, 'warehouse' => 9, + 'actioncomm' => 9, ); /** @@ -93,6 +95,7 @@ class Categorie extends CommonObject 7 => 'user', 8 => 'bank_line', 9 => 'warehouse', + 10 => 'actioncomm', ); /** @@ -111,6 +114,7 @@ class Categorie extends CommonObject 'bank_account' => 'account', 'project' => 'project', 'warehouse'=> 'warehouse', + 'actioncomm' => 'actioncomm', ); /** @@ -129,6 +133,7 @@ class Categorie extends CommonObject 'bank_account'=> 'account', 'project' => 'project', 'warehouse'=> 'warehouse', + 'actioncomm' => 'warehouse', ); /** @@ -147,6 +152,7 @@ class Categorie extends CommonObject 'bank_account' => 'Account', 'project' => 'Project', 'warehouse'=> 'Entrepot', + 'actioncomm' => 'ActionComm', ); /** @@ -164,6 +170,7 @@ class Categorie extends CommonObject 'account' => 'bank_account', 'project' => 'projet', 'warehouse'=> 'entrepot', + 'actioncomm' => 'actioncomm', ); /** @@ -214,6 +221,7 @@ class Categorie extends CommonObject * @see Categorie::TYPE_PROJECT * @see Categorie::TYPE_BANK_LINE * @see Categorie::TYPE_WAREHOUSE + * @see Categorie::TYPE_ACTIONCOMM */ public $type; diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index e0886da002c..59d3cef3a4d 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -59,7 +59,13 @@ elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCate elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; } elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; } elseif ($type == Categorie::TYPE_WAREHOUSE) { $title=$langs->trans("StocksCategoriesArea"); $typetext='warehouse'; } -else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; } +elseif ($type == Categorie::TYPE_ACTIONCOMM) { + $title = $langs->trans("ActionCommCategoriesArea"); + $typetext = 'actioncomm'; +} else { + $title = $langs->trans("CategoriesArea"); + $typetext = 'unknown'; +} $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 13e47abbc74..7d2b00a17d1 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -219,165 +219,206 @@ class modAgenda extends DolibarrModules ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=0', - 'type'=>'left', - 'titre'=>'Actions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda', - 'langs'=>'agenda', - 'position'=>100, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=0', + 'type'=>'left', + 'titre'=>'Actions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda', + 'langs'=>'agenda', + 'position'=>100, + 'perms'=>'$user->rights->agenda->myactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2, + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=1', - 'type'=>'left', - 'titre'=>'NewAction', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create', - 'langs'=>'commercial', - 'position'=>101, - 'perms'=>'($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create)', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=1', + 'type'=>'left', + 'titre'=>'NewAction', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create', + 'langs'=>'commercial', + 'position'=>101, + 'perms'=>'($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create)', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); $r++; // Calendar - $this->menu[$r]=array('fk_menu'=>'r=1', - 'type'=>'left', - 'titre'=>'Calendar', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda', - 'langs'=>'agenda', - 'position'=>140, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=1', + 'type'=>'left', + 'titre'=>'Calendar', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda', + 'langs'=>'agenda', + 'position'=>140, + 'perms'=>'$user->rights->agenda->myactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=3', - 'type'=>'left', - 'titre'=>'MenuToDoMyActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', - 'langs'=>'agenda', - 'position'=>141, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=3', + 'type'=>'left', + 'titre'=>'MenuToDoMyActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', + 'langs'=>'agenda', + 'position'=>141, + 'perms'=>'$user->rights->agenda->myactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=3', - 'type'=>'left', - 'titre'=>'MenuDoneMyActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', - 'langs'=>'agenda', - 'position'=>142, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=3', + 'type'=>'left', + 'titre'=>'MenuDoneMyActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', + 'langs'=>'agenda', + 'position'=>142, + 'perms'=>'$user->rights->agenda->myactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=3', - 'type'=>'left', - 'titre'=>'MenuToDoActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', - 'langs'=>'agenda', - 'position'=>143, - 'perms'=>'$user->rights->agenda->allactions->read', - 'enabled'=>'$user->rights->agenda->allactions->read', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=3', + 'type'=>'left', + 'titre'=>'MenuToDoActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', + 'langs'=>'agenda', + 'position'=>143, + 'perms'=>'$user->rights->agenda->allactions->read', + 'enabled'=>'$user->rights->agenda->allactions->read', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=3', - 'type'=>'left', - 'titre'=>'MenuDoneActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', - 'langs'=>'agenda', - 'position'=>144, - 'perms'=>'$user->rights->agenda->allactions->read', - 'enabled'=>'$user->rights->agenda->allactions->read', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=3', + 'type'=>'left', + 'titre'=>'MenuDoneActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', + 'langs'=>'agenda', + 'position'=>144, + 'perms'=>'$user->rights->agenda->allactions->read', + 'enabled'=>'$user->rights->agenda->allactions->read', + 'target'=>'', + 'user'=>2 + ); // List $r++; - $this->menu[$r]=array('fk_menu'=>'r=1', - 'type'=>'left', - 'titre'=>'List', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda', - 'langs'=>'agenda', - 'position'=>110, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=1', + 'type'=>'left', + 'titre'=>'List', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda', + 'langs'=>'agenda', + 'position'=>110, + 'perms'=>'$user->rights->agenda->myactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=8', - 'type'=>'left', - 'titre'=>'MenuToDoMyActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', - 'langs'=>'agenda', - 'position'=>111, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=8', + 'type'=>'left', + 'titre'=>'MenuToDoMyActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', + 'langs'=>'agenda', + 'position'=>111, + 'perms'=>'$user->rights->agenda->myactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=8', - 'type'=>'left', - 'titre'=>'MenuDoneMyActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', - 'langs'=>'agenda', - 'position'=>112, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=8', + 'type'=>'left', + 'titre'=>'MenuDoneMyActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', + 'langs'=>'agenda', + 'position'=>112, + 'perms'=>'$user->rights->agenda->myactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=8', - 'type'=>'left', - 'titre'=>'MenuToDoActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', - 'langs'=>'agenda', - 'position'=>113, - 'perms'=>'$user->rights->agenda->allactions->read', - 'enabled'=>'$user->rights->agenda->allactions->read', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=8', + 'type'=>'left', + 'titre'=>'MenuToDoActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', + 'langs'=>'agenda', + 'position'=>113, + 'perms'=>'$user->rights->agenda->allactions->read', + 'enabled'=>'$user->rights->agenda->allactions->read', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=8', - 'type'=>'left', - 'titre'=>'MenuDoneActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', - 'langs'=>'agenda', - 'position'=>114, - 'perms'=>'$user->rights->agenda->allactions->read', - 'enabled'=>'$user->rights->agenda->allactions->read', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=8', + 'type'=>'left', + 'titre'=>'MenuDoneActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', + 'langs'=>'agenda', + 'position'=>114, + 'perms'=>'$user->rights->agenda->allactions->read', + 'enabled'=>'$user->rights->agenda->allactions->read', + 'target'=>'', + 'user'=>2 + ); $r++; // Reports - $this->menu[$r]=array('fk_menu'=>'r=1', - 'type'=>'left', - 'titre'=>'Reportings', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda', - 'langs'=>'agenda', - 'position'=>160, - 'perms'=>'$user->rights->agenda->allactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=1', + 'type'=>'left', + 'titre'=>'Reportings', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda', + 'langs'=>'agenda', + 'position'=>160, + 'perms'=>'$user->rights->agenda->allactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); + $r++; + // Categories + $this->menu[$r]=array( + 'fk_menu' => 'r=1', + 'type' => 'left', + 'titre' => 'Categories', + 'mainmenu' => 'agenda', + 'url'=>'/categories/index.php?mainmenu=agenda&leftmenu=agenda&type=10', + 'langs' => 'agenda', + 'position' => 170, + 'perms' => '$user->rights->agenda->allactions->read', + 'enabled' => '$conf->categorie->enabled&&$conf->categorie->enabled', + 'target' => '', + 'user' => 2 + ); $r++; diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 9c52044291d..7fe182d6fab 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -498,3 +498,17 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_CANCEL','MO canceled','Executed when a MO is canceled','bom',663); ALTER TABLE llx_comment ADD COLUMN fk_user_modif integer DEFAULT NULL; + +CREATE TABLE llx_categorie_actioncomm +( + fk_categorie integer NOT NULL, + fk_actioncomm integer NOT NULL, + import_key varchar(14) +) ENGINE=innodb; + +ALTER TABLE llx_categorie_actioncomm ADD PRIMARY KEY pk_categorie_actioncomm (fk_categorie, fk_actioncomm); +ALTER TABLE llx_categorie_actioncomm ADD INDEX idx_categorie_actioncomm_fk_categorie (fk_categorie); +ALTER TABLE llx_categorie_actioncomm ADD INDEX idx_categorie_actioncomm_fk_actioncomm (fk_actioncomm); + +ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); +ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm (id); diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index d5a4ba16bf0..7207bbacc38 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -90,4 +90,5 @@ ShowCategory=Show tag/category ByDefaultInList=By default in list ChooseCategory=Choose category StocksCategoriesArea=Warehouses Categories Area -UseOrOperatorForCategories=Use or operator for categories \ No newline at end of file +ActionCommCategoriesArea=Events Categories Area +UseOrOperatorForCategories=Use or operator for categories From 2ea58b11cad4a11c3e152dd225a5ced7e8c1a661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 13 Nov 2019 20:36:32 +0100 Subject: [PATCH 024/421] wip --- htdocs/categories/class/categorie.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index e42f0fe32ff..dd136383221 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -78,7 +78,7 @@ class Categorie extends CommonObject 'user' => 7, 'bank_line' => 8, 'warehouse' => 9, - 'actioncomm' => 9, + 'actioncomm' => 10, ); /** @@ -133,7 +133,7 @@ class Categorie extends CommonObject 'bank_account'=> 'account', 'project' => 'project', 'warehouse'=> 'warehouse', - 'actioncomm' => 'warehouse', + 'actioncomm' => 'actioncomm', ); /** From 9dcf53c65e3d161e00502b4d5507698b297390cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 13 Nov 2019 20:56:36 +0100 Subject: [PATCH 025/421] add tables --- .../tables/llx_categorie_actioncomm.key.sql | 25 ++++++++++++++++++ .../mysql/tables/llx_categorie_actioncomm.sql | 26 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_categorie_actioncomm.key.sql create mode 100644 htdocs/install/mysql/tables/llx_categorie_actioncomm.sql diff --git a/htdocs/install/mysql/tables/llx_categorie_actioncomm.key.sql b/htdocs/install/mysql/tables/llx_categorie_actioncomm.key.sql new file mode 100644 index 00000000000..30357eb87bc --- /dev/null +++ b/htdocs/install/mysql/tables/llx_categorie_actioncomm.key.sql @@ -0,0 +1,25 @@ +-- ============================================================================ +-- Copyright (C) 2016 Charlie Benke +-- Copyright (C) 2016-2019 Frédéric France +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ + +ALTER TABLE llx_categorie_actioncomm ADD PRIMARY KEY pk_categorie_actioncomm (fk_categorie, fk_actioncomm); +ALTER TABLE llx_categorie_actioncomm ADD INDEX idx_categorie_actioncomm_fk_categorie (fk_categorie); +ALTER TABLE llx_categorie_actioncomm ADD INDEX idx_categorie_actioncomm_fk_actioncomm (fk_actioncomm); + +ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); +ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm (id); diff --git a/htdocs/install/mysql/tables/llx_categorie_actioncomm.sql b/htdocs/install/mysql/tables/llx_categorie_actioncomm.sql new file mode 100644 index 00000000000..52aa2a2c95d --- /dev/null +++ b/htdocs/install/mysql/tables/llx_categorie_actioncomm.sql @@ -0,0 +1,26 @@ +-- ============================================================================ +-- Copyright (C) 2016 Charlie Benke +-- Copyright (C) 2016-2019 Frédéric France +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- Table to link actioncomm tag/categories with actioncomms +-- =========================================================================== + +CREATE TABLE llx_categorie_actioncomm +( + fk_categorie integer NOT NULL, + fk_actioncomm integer NOT NULL, + import_key varchar(14) +) ENGINE=innodb; From 9040f6d9c7e248dde2906e91b5e719b9de796cf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 13 Nov 2019 21:18:34 +0100 Subject: [PATCH 026/421] can tag actioncomm --- htdocs/comm/action/card.php | 36 +++++++++++++++ htdocs/comm/action/class/actioncomm.class.php | 44 +++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 09c8e344794..dc33a189be2 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -44,6 +44,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Load translation files required by the page $langs->loadLangs(array("companies", "other", "commercial", "bills", "orders", "agenda")); @@ -374,6 +375,10 @@ if (empty($reshook) && $action == 'add') { if (! $object->error) { + // Category association + $categories = GETPOST('categories', 'array'); + $object->setCategories($categories); + unset($_SESSION['assignedtouser']); $moreparam=''; @@ -595,6 +600,10 @@ if (empty($reshook) && $action == 'update') if ($result > 0) { + // Category association + $categories = GETPOST('categories', 'array'); + $object->setCategories($categories); + unset($_SESSION['assignedtouser']); $db->commit(); @@ -1000,6 +1009,14 @@ if ($action == 'create') print ''; } + if ($conf->categorie->enabled) { + // Categories + print ''.$langs->trans("Categories").''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1); + print $form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, '', 0, '100%'); + print ""; + } + print ''; @@ -1411,6 +1428,19 @@ if ($id > 0) print $form->select_dolusers($object->userdoneid> 0?$object->userdoneid:-1, 'doneby', 1); print ''; } + // Tags-Categories + if ($conf->categorie->enabled) { + print ''.$langs->trans("Categories").''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1); + $c = new Categorie($db); + $cats = $c->containing($object->id, Categorie::TYPE_ACTIONCOMM); + $arrayselected = array(); + foreach ($cats as $cat) { + $arrayselected[] = $cat->id; + } + print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%'); + print ""; + } print ''; @@ -1716,6 +1746,12 @@ if ($id > 0) } print ''; } + // Categories + if ($conf->categorie->enabled) { + print ''.$langs->trans("Categories").''; + print $form->showCategories($object->id, 'actioncomm', 1); + print ""; + } print ''; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 97d3c4e397e..3e84c23dbc3 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1501,6 +1501,50 @@ class ActionComm extends CommonObject return $result; } + /** + * Sets object to supplied categories. + * + * Deletes object from existing categories not supplied. + * Adds it to non existing supplied categories. + * Existing categories are left untouch. + * + * @param int[]|int $categories Category or categories IDs + * @return void + */ + public function setCategories($categories) + { + // Handle single category + if (! is_array($categories)) { + $categories = array($categories); + } + + // Get current categories + include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $c = new Categorie($this->db); + $existing = $c->containing($this->id, Categorie::TYPE_ACTIONCOMM, 'id'); + + // Diff + if (is_array($existing)) { + $to_del = array_diff($existing, $categories); + $to_add = array_diff($categories, $existing); + } else { + $to_del = array(); // Nothing to delete + $to_add = $categories; + } + + // Process + foreach($to_del as $del) { + if ($c->fetch($del) > 0) { + $c->del_type($this, Categorie::TYPE_ACTIONCOMM); + } + } + foreach ($to_add as $add) { + if ($c->fetch($add) > 0) { + $c->add_type($this, Categorie::TYPE_ACTIONCOMM); + } + } + return; + } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** From 1a9c430e0075285578dfbbb159b136c5d03093b8 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 14 Nov 2019 04:53:13 +0100 Subject: [PATCH 027/421] Add migration --- .../mysql/data/llx_20_c_departements.sql | 130 +++++++++--------- .../install/mysql/migration/11.0.0-12.0.0.sql | 65 +++++++++ 2 files changed, 130 insertions(+), 65 deletions(-) create mode 100644 htdocs/install/mysql/migration/11.0.0-12.0.0.sql diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index 7e9417b487b..46d9b4d712e 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -42,97 +42,97 @@ insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,no insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values ( 4,'974','97411',3,'REUNION','Réunion'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values ( 6,'976','97601',3,'MAYOTTE','Mayotte'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'01','01053',5,'AIN','Ain'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (22,'02','02408',5,'AISNE','Aisne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (83,'03','03190',5,'ALLIER','Allier'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'01','01053',5,'AIN','Ain'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'02','02408',5,'AISNE','Aisne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'03','03190',5,'ALLIER','Allier'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'04','04070',4,'ALPES-DE-HAUTE-PROVENCE','Alpes-de-Haute-Provence'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'05','05061',4,'HAUTES-ALPES','Hautes-Alpes'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'06','06088',4,'ALPES-MARITIMES','Alpes-Maritimes'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'07','07186',5,'ARDECHE','Ardèche'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (21,'08','08105',4,'ARDENNES','Ardennes'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'09','09122',5,'ARIEGE','Ariège'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (21,'10','10387',5,'AUBE','Aube'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (91,'11','11069',5,'AUDE','Aude'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'12','12202',5,'AVEYRON','Aveyron'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'07','07186',5,'ARDECHE','Ardèche'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'08','08105',4,'ARDENNES','Ardennes'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'09','09122',5,'ARIEGE','Ariège'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'10','10387',5,'AUBE','Aube'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'11','11069',5,'AUDE','Aude'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'12','12202',5,'AVEYRON','Aveyron'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'13','13055',4,'BOUCHES-DU-RHONE','Bouches-du-Rhône'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (25,'14','14118',2,'CALVADOS','Calvados'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (83,'15','15014',2,'CANTAL','Cantal'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (54,'16','16015',3,'CHARENTE','Charente'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (54,'17','17300',3,'CHARENTE-MARITIME','Charente-Maritime'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'14','14118',2,'CALVADOS','Calvados'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'15','15014',2,'CANTAL','Cantal'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'16','16015',3,'CHARENTE','Charente'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'17','17300',3,'CHARENTE-MARITIME','Charente-Maritime'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'18','18033',2,'CHER','Cher'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (74,'19','19272',3,'CORREZE','Corrèze'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'19','19272',3,'CORREZE','Corrèze'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (94,'2A','2A004',3,'CORSE-DU-SUD','Corse-du-Sud'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (94,'2B','2B033',3,'HAUTE-CORSE','Haute-Corse'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (26,'21','21231',3,'COTE-D OR','Côte-d Or'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'21','21231',3,'COTE-D OR','Côte-d Or'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'22','22278',4,'COTES-D ARMOR','Côtes-d Armor'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (74,'23','23096',3,'CREUSE','Creuse'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (72,'24','24322',3,'DORDOGNE','Dordogne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (43,'25','25056',2,'DOUBS','Doubs'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'26','26362',3,'DROME','Drôme'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (23,'27','27229',5,'EURE','Eure'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'23','23096',3,'CREUSE','Creuse'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'24','24322',3,'DORDOGNE','Dordogne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'25','25056',2,'DOUBS','Doubs'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'26','26362',3,'DROME','Drôme'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'27','27229',5,'EURE','Eure'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'28','28085',1,'EURE-ET-LOIR','Eure-et-Loir'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'29','29232',2,'FINISTERE','Finistère'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (91,'30','30189',2,'GARD','Gard'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'31','31555',3,'HAUTE-GARONNE','Haute-Garonne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'32','32013',2,'GERS','Gers'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (72,'33','33063',3,'GIRONDE','Gironde'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (91,'34','34172',5,'HERAULT','Hérault'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'30','30189',2,'GARD','Gard'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'31','31555',3,'HAUTE-GARONNE','Haute-Garonne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'32','32013',2,'GERS','Gers'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'33','33063',3,'GIRONDE','Gironde'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'34','34172',5,'HERAULT','Hérault'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'35','35238',1,'ILLE-ET-VILAINE','Ille-et-Vilaine'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'36','36044',5,'INDRE','Indre'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'37','37261',1,'INDRE-ET-LOIRE','Indre-et-Loire'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'38','38185',5,'ISERE','Isère'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (43,'39','39300',2,'JURA','Jura'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (72,'40','40192',4,'LANDES','Landes'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'38','38185',5,'ISERE','Isère'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'39','39300',2,'JURA','Jura'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'40','40192',4,'LANDES','Landes'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'41','41018',0,'LOIR-ET-CHER','Loir-et-Cher'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'42','42218',3,'LOIRE','Loire'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (83,'43','43157',3,'HAUTE-LOIRE','Haute-Loire'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'42','42218',3,'LOIRE','Loire'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'43','43157',3,'HAUTE-LOIRE','Haute-Loire'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'44','44109',3,'LOIRE-ATLANTIQUE','Loire-Atlantique'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'45','45234',2,'LOIRET','Loiret'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'46','46042',2,'LOT','Lot'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (72,'47','47001',0,'LOT-ET-GARONNE','Lot-et-Garonne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (91,'48','48095',3,'LOZERE','Lozère'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'46','46042',2,'LOT','Lot'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'47','47001',0,'LOT-ET-GARONNE','Lot-et-Garonne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'48','48095',3,'LOZERE','Lozère'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'49','49007',0,'MAINE-ET-LOIRE','Maine-et-Loire'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (25,'50','50502',3,'MANCHE','Manche'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (21,'51','51108',3,'MARNE','Marne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (21,'52','52121',3,'HAUTE-MARNE','Haute-Marne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'50','50502',3,'MANCHE','Manche'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'51','51108',3,'MARNE','Marne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'52','52121',3,'HAUTE-MARNE','Haute-Marne'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'53','53130',3,'MAYENNE','Mayenne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (41,'54','54395',0,'MEURTHE-ET-MOSELLE','Meurthe-et-Moselle'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (41,'55','55029',3,'MEUSE','Meuse'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'54','54395',0,'MEURTHE-ET-MOSELLE','Meurthe-et-Moselle'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'55','55029',3,'MEUSE','Meuse'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'56','56260',2,'MORBIHAN','Morbihan'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (41,'57','57463',3,'MOSELLE','Moselle'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (26,'58','58194',3,'NIEVRE','Nièvre'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (31,'59','59350',2,'NORD','Nord'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (22,'60','60057',5,'OISE','Oise'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (25,'61','61001',5,'ORNE','Orne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (31,'62','62041',2,'PAS-DE-CALAIS','Pas-de-Calais'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (83,'63','63113',2,'PUY-DE-DOME','Puy-de-Dôme'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (72,'64','64445',4,'PYRENEES-ATLANTIQUES','Pyrénées-Atlantiques'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'65','65440',4,'HAUTES-PYRENEES','Hautes-Pyrénées'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (91,'66','66136',4,'PYRENEES-ORIENTALES','Pyrénées-Orientales'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (42,'67','67482',2,'BAS-RHIN','Bas-Rhin'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (42,'68','68066',2,'HAUT-RHIN','Haut-Rhin'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'69','69123',2,'RHONE','Rhône'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (43,'70','70550',3,'HAUTE-SAONE','Haute-Saône'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (26,'71','71270',0,'SAONE-ET-LOIRE','Saône-et-Loire'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'57','57463',3,'MOSELLE','Moselle'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'58','58194',3,'NIEVRE','Nièvre'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'59','59350',2,'NORD','Nord'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'60','60057',5,'OISE','Oise'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'61','61001',5,'ORNE','Orne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'62','62041',2,'PAS-DE-CALAIS','Pas-de-Calais'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'63','63113',2,'PUY-DE-DOME','Puy-de-Dôme'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'64','64445',4,'PYRENEES-ATLANTIQUES','Pyrénées-Atlantiques'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'65','65440',4,'HAUTES-PYRENEES','Hautes-Pyrénées'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'66','66136',4,'PYRENEES-ORIENTALES','Pyrénées-Orientales'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'67','67482',2,'BAS-RHIN','Bas-Rhin'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'68','68066',2,'HAUT-RHIN','Haut-Rhin'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'69','69123',2,'RHONE','Rhône'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'70','70550',3,'HAUTE-SAONE','Haute-Saône'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'71','71270',0,'SAONE-ET-LOIRE','Saône-et-Loire'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'72','72181',3,'SARTHE','Sarthe'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'73','73065',3,'SAVOIE','Savoie'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'74','74010',3,'HAUTE-SAVOIE','Haute-Savoie'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'73','73065',3,'SAVOIE','Savoie'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'74','74010',3,'HAUTE-SAVOIE','Haute-Savoie'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'75','75056',0,'PARIS','Paris'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (23,'76','76540',3,'SEINE-MARITIME','Seine-Maritime'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'76','76540',3,'SEINE-MARITIME','Seine-Maritime'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'77','77288',0,'SEINE-ET-MARNE','Seine-et-Marne'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'78','78646',4,'YVELINES','Yvelines'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (54,'79','79191',4,'DEUX-SEVRES','Deux-Sèvres'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (22,'80','80021',3,'SOMME','Somme'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'81','81004',2,'TARN','Tarn'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'82','82121',0,'TARN-ET-GARONNE','Tarn-et-Garonne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'79','79191',4,'DEUX-SEVRES','Deux-Sèvres'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'80','80021',3,'SOMME','Somme'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'81','81004',2,'TARN','Tarn'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'82','82121',0,'TARN-ET-GARONNE','Tarn-et-Garonne'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'83','83137',2,'VAR','Var'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'84','84007',0,'VAUCLUSE','Vaucluse'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'85','85191',3,'VENDEE','Vendée'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (54,'86','86194',3,'VIENNE','Vienne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (74,'87','87085',3,'HAUTE-VIENNE','Haute-Vienne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (41,'88','88160',4,'VOSGES','Vosges'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (26,'89','89024',5,'YONNE','Yonne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (43,'90','90010',0,'TERRITOIRE DE BELFORT','Territoire de Belfort'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'86','86194',3,'VIENNE','Vienne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'87','87085',3,'HAUTE-VIENNE','Haute-Vienne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'88','88160',4,'VOSGES','Vosges'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'89','89024',5,'YONNE','Yonne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'90','90010',0,'TERRITOIRE DE BELFORT','Territoire de Belfort'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'91','91228',5,'ESSONNE','Essonne'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'92','92050',4,'HAUTS-DE-SEINE','Hauts-de-Seine'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'93','93008',3,'SEINE-SAINT-DENIS','Seine-Saint-Denis'); diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql new file mode 100644 index 00000000000..52e421f8205 --- /dev/null +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -0,0 +1,65 @@ +-- +-- Be carefull to requests order. +-- This file must be loaded by calling /install/index.php page +-- when current version is 12.0.0 or higher. +-- +-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field); +-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table +-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex +-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres): +-- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid; +-- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid); +-- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq'); +-- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table; +-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL; +-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; +-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL; +-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL; +-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; +-- Note: fields with type BLOB/TEXT can't have default value. + + +-- Migration to the new regions (France) +UPDATE llx_c_regions set nom = 'Centre-Val de Loire' WHERE fk_pays = 1 AND code_region = 24; +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (1, 27, '21231', 0, 'Bourgogne-Franche-Comté'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (1, 28, '76540', 0, 'Normandie'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (1, 32, '59350', 4, 'Hauts-de-France'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (1, 44, '67482', 2, 'Grand Est'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (1, 75, '33063', 0, 'Nouvelle-Aquitaine'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (1, 76, '31355', 1, 'Occitanie'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (1, 84, '69123', 1, 'Auvergne-Rhône-Alpes'); + +UPDATE llx_c_departements set fk_region = 27 WHERE fk_region = 26 OR fk_region = 43; +UPDATE llx_c_departements set fk_region = 28 WHERE fk_region = 25 OR fk_region = 23; +UPDATE llx_c_departements set fk_region = 32 WHERE fk_region = 22 OR fk_region = 31; +UPDATE llx_c_departements set fk_region = 44 WHERE fk_region = 21 OR fk_region = 41 OR fk_region = 42; +UPDATE llx_c_departements set fk_region = 75 WHERE fk_region = 54 OR fk_region = 74 OR fk_region = 72; +UPDATE llx_c_departements set fk_region = 76 WHERE fk_region = 73 OR fk_region = 91; +UPDATE llx_c_departements set fk_region = 84 WHERE fk_region = 82 OR fk_region = 83; + +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 21; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 22; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 23; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 25; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 26; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 31; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 41; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 42; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 43; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 54; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 72; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 73; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 74; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 82; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 83; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 91; + From 3bac051521deb2f77df97c60fdb519471f1f5210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 14 Nov 2019 08:07:16 +0100 Subject: [PATCH 028/421] use class CONST --- htdocs/adherents/card.php | 2 +- htdocs/adherents/subscription.php | 2 +- htdocs/comm/action/card.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 417d4cd2c99..8f13769aa3e 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1753,7 +1753,7 @@ else { print '' . $langs->trans("Categories") . ''; print ''; - print $form->showCategories($object->id, 'member', 1); + print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); print ''; } diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index b591a29a6e9..85fd04c1325 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -532,7 +532,7 @@ if ($rowid > 0) { print '' . $langs->trans("Categories") . ''; print ''; - print $form->showCategories($object->id, 'member', 1); + print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); print ''; } diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index dc33a189be2..640569a5da1 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1749,7 +1749,7 @@ if ($id > 0) // Categories if ($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'actioncomm', 1); + print $form->showCategories($object->id, Categorie::TYPE_ACTIONCOMM, 1); print ""; } From 446c66da6203a5ef2d3f07ca9d3db48790025876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 14 Nov 2019 08:15:39 +0100 Subject: [PATCH 029/421] use class CONST --- htdocs/comm/card.php | 2 +- htdocs/compta/bank/card.php | 2 +- htdocs/contact/card.php | 2 +- htdocs/fourn/card.php | 2 +- htdocs/product/card.php | 2 +- htdocs/product/stock/card.php | 2 +- htdocs/projet/card.php | 2 +- htdocs/projet/comment.php | 2 +- htdocs/projet/contact.php | 2 +- htdocs/projet/element.php | 2 +- htdocs/projet/ganttview.php | 2 +- htdocs/projet/tasks.php | 2 +- htdocs/societe/card.php | 4 ++-- htdocs/user/card.php | 4 ++-- 14 files changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index a0263065dee..062d1658821 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -491,7 +491,7 @@ if ($object->id > 0) $langs->load("categories"); print '' . $langs->trans("CustomersCategoriesShort") . ''; print ''; - print $form->showCategories($object->id, 'customer', 1); + print $form->showCategories($object->id, Categorie::TYPE_CUSTOMER, 1); print ""; } diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 980cf6bd8f2..9f5707402a6 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -689,7 +689,7 @@ else // Categories if ($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'bank_account', 1); + print $form->showCategories($object->id, Categorie::TYPE_ACCOUNT, 1); print ""; } diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index f72edeb3a34..563f9906f16 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1355,7 +1355,7 @@ else if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { print '' . $langs->trans("Categories") . ''; print ''; - print $form->showCategories($object->id, 'contact', 1); + print $form->showCategories($object->id, Categorie::TYPE_CONTACT, 1); print ''; } diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index f52f5b089fd..32f6a9ad11b 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -312,7 +312,7 @@ if ($object->id > 0) $langs->load("categories"); print '' . $langs->trans("SuppliersCategoriesShort") . ''; print ''; - print $form->showCategories($object->id, 'supplier', 1); + print $form->showCategories($object->id, Categorie::TYPE_SUPPLIER, 1); print ""; } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index a5793cc66c8..32eb5c4b383 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1982,7 +1982,7 @@ else // Categories if ($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'product', 1); + print $form->showCategories($object->id, Categorie::TYPE_PRODUCT, 1); print ""; } diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 41e91b04d0c..2a69ae58ae8 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -454,7 +454,7 @@ else // Categories if($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'warehouse', 1); + print $form->showCategories($object->id, Categorie::TYPE_WAREHOUSE, 1); print ""; } print ""; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 51af2f2b14d..16f1dd7e439 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1069,7 +1069,7 @@ elseif ($object->id > 0) // Categories if($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'project', 1); + print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); print ""; } diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php index a7478163f47..4c9c4ca3ad3 100644 --- a/htdocs/projet/comment.php +++ b/htdocs/projet/comment.php @@ -160,7 +160,7 @@ print ''; // Categories if ($conf->categorie->enabled) { print '' . $langs->trans("Categories") . ''; - print $form->showCategories($object->id, 'project', 1); + print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); print ""; } diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 82eb598190b..f8ccdbf7210 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -279,7 +279,7 @@ if ($id > 0 || ! empty($ref)) // Categories if ($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'project', 1); + print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); print ""; } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 56d01faa342..1e3661516fb 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -255,7 +255,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_B // Categories if($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'project', 1); + print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); print ""; } diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 725d99fb673..42f79ae0f30 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -212,7 +212,7 @@ if (($id > 0 && is_numeric($id)) || ! empty($ref)) // Categories if($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'project', 1); + print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); print ""; } diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 9d9b8e69516..0775d5996b2 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -487,7 +487,7 @@ if ($id > 0 || !empty($ref)) // Categories if ($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'project', 1); + print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); print ""; } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 6b375679052..e8182f9c846 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2550,7 +2550,7 @@ else if ($object->prospect || $object->client || (! $object->fournisseur && ! empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER))) { print '' . $langs->trans("CustomersCategoriesShort") . ''; print ''; - print $form->showCategories($object->id, 'customer', 1); + print $form->showCategories($object->id, Categorie::TYPE_CUSTOMER, 1); print ""; } @@ -2558,7 +2558,7 @@ else if ($object->fournisseur) { print '' . $langs->trans("SuppliersCategoriesShort") . ''; print ''; - print $form->showCategories($object->id, 'supplier', 1); + print $form->showCategories($object->id, Categorie::TYPE_SUPPLIER, 1); print ""; } } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 7886c0ef728..d75d6abbc57 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1764,7 +1764,7 @@ else { print ''.$langs->trans("Categories").''; print ''; - print $form->showCategories($object->id, 'user', 1); + print $form->showCategories($object->id, Categorie::TYPE_USER, 1); print ''; } @@ -2626,7 +2626,7 @@ else { print $form->multiselectarray('usercats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); } else { - print $form->showCategories($object->id, 'user', 1); + print $form->showCategories($object->id, Categorie::TYPE_USER, 1); } print ""; } From 6e97697faae9cc5b07d3eee0bc938f87ba114b8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 14 Nov 2019 22:38:37 +0100 Subject: [PATCH 030/421] wip --- htdocs/categories/class/api_categories.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 0f2a425fe87..0e71f52a955 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -48,6 +48,11 @@ class Categories extends DolibarrApi 3 => 'member', 4 => 'contact', 5 => 'account', + //6 => 'project', + //7 => 'user', + //8 => 'bank_line', + //9 => 'warehouse', + //10 => 'actioncomm', ); /** From b3e09e050c3e07c0beb5a8dff8dd3f4652ee5a46 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 18 Nov 2019 11:36:12 +0100 Subject: [PATCH 031/421] fix missing param --- htdocs/comm/propal/list.php | 83 +++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index b1897916023..c29fac8405f 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -413,22 +413,25 @@ if ($resql) $param = '&viewstatut='.urlencode($viewstatut); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); - if ($sall) $param .= '&sall='.urlencode($sall); - if ($search_day) $param .= '&search_day='.urlencode($search_day); - if ($search_month) $param .= '&search_month='.urlencode($search_month); - if ($search_year) $param .= '&search_year='.urlencode($search_year); - if ($search_ref) $param .= '&search_ref='.urlencode($search_ref); - if ($search_refcustomer) $param .= '&search_refcustomer='.urlencode($search_refcustomer); - if ($search_refproject) $param .= '&search_refproject='.urlencode($search_refproject); - if ($search_societe) $param .= '&search_societe='.urlencode($search_societe); - if ($search_user > 0) $param .= '&search_user='.urlencode($search_user); - if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale); - if ($search_montant_ht) $param .= '&search_montant_ht='.urlencode($search_montant_ht); - if ($search_login) $param .= '&search_login='.urlencode($search_login); - if ($search_town) $param .= '&search_town='.urlencode($search_town); - if ($search_zip) $param .= '&search_zip='.urlencode($search_zip); - if ($socid > 0) $param .= '&socid='.urlencode($socid); - if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); + if ($sall) $param .= '&sall='.urlencode($sall); + if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start); + if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end); + if ($search_dateend_start) $param .= '&search_dateend_start='.urlencode($search_dateend_start); + if ($search_dateend_end) $param .= '&search_dateend_end='.urlencode($search_dateend_end); + if ($search_datedelivery_start) $param .= '&search_datedelivery_start='.urlencode($search_datedelivery_start); + if ($search_datedelivery_end) $param .= '&search_datedelivery_end='.urlencode($search_datedelivery_end); + if ($search_ref) $param .= '&search_ref='.urlencode($search_ref); + if ($search_refcustomer) $param .= '&search_refcustomer='.urlencode($search_refcustomer); + if ($search_refproject) $param .= '&search_refproject='.urlencode($search_refproject); + if ($search_societe) $param .= '&search_societe='.urlencode($search_societe); + if ($search_user > 0) $param .= '&search_user='.urlencode($search_user); + if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale); + if ($search_montant_ht) $param .= '&search_montant_ht='.urlencode($search_montant_ht); + if ($search_login) $param .= '&search_login='.urlencode($search_login); + if ($search_town) $param .= '&search_town='.urlencode($search_town); + if ($search_zip) $param .= '&search_zip='.urlencode($search_zip); + if ($socid > 0) $param .= '&socid='.urlencode($socid); + if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); if ($search_categ_cus > 0) $param .= '&search_categ_cus='.urlencode($search_categ_cus); if ($search_product_category != '') $param .= '&search_product_category='.$search_product_category; @@ -727,37 +730,37 @@ if ($resql) // Fields title print ''; - if (!empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['p.ref_client']['checked'])) print_liste_field_titre($arrayfields['p.ref_client']['label'], $_SERVER["PHP_SELF"], 'p.ref_client', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['pr.ref']['checked'])) print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['pr.title']['checked'])) print_liste_field_titre($arrayfields['pr.title']['label'], $_SERVER["PHP_SELF"], 'pr.title', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); - if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); - if (!empty($arrayfields['p.date']['checked'])) print_liste_field_titre($arrayfields['p.date']['label'], $_SERVER["PHP_SELF"], 'p.datep', '', $param, 'align="center"', $sortfield, $sortorder); - if (!empty($arrayfields['p.fin_validite']['checked'])) print_liste_field_titre($arrayfields['p.fin_validite']['label'], $_SERVER["PHP_SELF"], 'dfv', '', $param, 'align="center"', $sortfield, $sortorder); - if (!empty($arrayfields['p.date_livraison']['checked'])) print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'ddelivery', '', $param, 'align="center"', $sortfield, $sortorder); - if (!empty($arrayfields['ava.rowid']['checked'])) print_liste_field_titre($arrayfields['ava.rowid']['label'], $_SERVER["PHP_SELF"], 'availability', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, 'class="right"', $sortfield, $sortorder); - if (!empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'], $_SERVER["PHP_SELF"], 'p.tva', '', $param, 'class="right"', $sortfield, $sortorder); - if (!empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'class="right"', $sortfield, $sortorder); + if (!empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['p.ref_client']['checked'])) print_liste_field_titre($arrayfields['p.ref_client']['label'], $_SERVER["PHP_SELF"], 'p.ref_client', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['pr.ref']['checked'])) print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['pr.title']['checked'])) print_liste_field_titre($arrayfields['pr.title']['label'], $_SERVER["PHP_SELF"], 'pr.title', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); + if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); + if (!empty($arrayfields['p.date']['checked'])) print_liste_field_titre($arrayfields['p.date']['label'], $_SERVER["PHP_SELF"], 'p.datep', '', $param, 'align="center"', $sortfield, $sortorder); + if (!empty($arrayfields['p.fin_validite']['checked'])) print_liste_field_titre($arrayfields['p.fin_validite']['label'], $_SERVER["PHP_SELF"], 'dfv', '', $param, 'align="center"', $sortfield, $sortorder); + if (!empty($arrayfields['p.date_livraison']['checked'])) print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'ddelivery', '', $param, 'align="center"', $sortfield, $sortorder); + if (!empty($arrayfields['ava.rowid']['checked'])) print_liste_field_titre($arrayfields['ava.rowid']['label'], $_SERVER["PHP_SELF"], 'availability', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, 'class="right"', $sortfield, $sortorder); + if (!empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'], $_SERVER["PHP_SELF"], 'p.tva', '', $param, 'class="right"', $sortfield, $sortorder); + if (!empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'class="right"', $sortfield, $sortorder); if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); - if (!empty($arrayfields['p.total_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); - if (!empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); - if (!empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); + if (!empty($arrayfields['p.total_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); + if (!empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); + if (!empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (!empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (!empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (!empty($arrayfields['p.date_cloture']['checked'])) print_liste_field_titre($arrayfields['p.date_cloture']['label'], $_SERVER["PHP_SELF"], "p.date_cloture", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (!empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'class="right"', $sortfield, $sortorder); + if (!empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + if (!empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + if (!empty($arrayfields['p.date_cloture']['checked'])) print_liste_field_titre($arrayfields['p.date_cloture']['label'], $_SERVER["PHP_SELF"], "p.date_cloture", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + if (!empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print ''."\n"; From dbbcda9e999ebdb4f8d48abdf97b62cc03c4fae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20L=C3=A9onard?= Date: Wed, 20 Nov 2019 06:38:28 +0100 Subject: [PATCH 032/421] Add WYSIWYG editor to description field of projects --- htdocs/projet/card.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 493978f738e..45c76363933 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -27,6 +27,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php'; @@ -657,7 +658,8 @@ if ($action == 'create' && $user->rights->projet->creer) // Description print ''.$langs->trans("Description").''; print ''; - print ''; + $doleditor = new DolEditor('description', GETPOST("description", 'none'), '', 90, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_3, '90%'); + $doleditor->Create(); print ''; if ($conf->categorie->enabled) { @@ -913,7 +915,8 @@ elseif ($object->id > 0) // Description print ''.$langs->trans("Description").''; print ''; - print ''; + $doleditor = new DolEditor('description', $object->description, '', 90, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_3, '90%'); + $doleditor->Create(); print ''; // Tags-Categories From 8522faea7f86f000bf9d31f0ea043a24c1e59165 Mon Sep 17 00:00:00 2001 From: altairis Date: Wed, 20 Nov 2019 10:15:46 +0100 Subject: [PATCH 033/421] add conf --- htdocs/conf/conf.php | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 htdocs/conf/conf.php diff --git a/htdocs/conf/conf.php b/htdocs/conf/conf.php new file mode 100644 index 00000000000..bfadb6d5c55 --- /dev/null +++ b/htdocs/conf/conf.php @@ -0,0 +1,51 @@ + Date: Wed, 20 Nov 2019 10:36:26 +0100 Subject: [PATCH 034/421] NEW add WYSiWYG on member type's description --- htdocs/adherents/type.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index ecfd12142f4..23a8608c1e8 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -1,3 +1,4 @@ + * Copyright (C) 2003 Jean-Louis Bergamo @@ -65,7 +66,7 @@ $subscription = GETPOST("subscription", "int"); $duration_value = GETPOST('duration_value', 'int'); $duration_unit = GETPOST('duration_unit', 'alpha'); $vote = GETPOST("vote", "int"); -$comment = GETPOST("comment", 'alphanohtml'); +$comment = GETPOST("comment", 'none'); $mail_valid = GETPOST("mail_valid", 'none'); // Security check @@ -363,7 +364,9 @@ if ($action == 'create') print ''; print ''.$langs->trans("Description").''; - print ''; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%'); + $doleditor->Create(); print ''.$langs->trans("WelcomeEMail").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -806,10 +809,12 @@ if ($rowid > 0) print ''; print ''.$langs->trans("Description").''; - print ''; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%'); + $doleditor->Create(); + print ""; print ''.$langs->trans("WelcomeEMail").''; - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%'); $doleditor->Create(); print ""; From 54e528d659cb13670bbd801fa9ff30151f7ca7e6 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 20 Nov 2019 09:38:32 +0000 Subject: [PATCH 035/421] Fixing style errors. --- htdocs/adherents/type.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 23a8608c1e8..ae54d9fec08 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -364,7 +364,7 @@ if ($action == 'create') print ''; print ''.$langs->trans("Description").''; - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%'); $doleditor->Create(); From 789e751e4a2963d7c169708af68a08b723449604 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 20 Nov 2019 10:55:58 +0100 Subject: [PATCH 036/421] Update type.php --- htdocs/adherents/type.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index ae54d9fec08..fd43988ccf5 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -1,4 +1,3 @@ - * Copyright (C) 2003 Jean-Louis Bergamo @@ -809,7 +808,7 @@ if ($rowid > 0) print ''; print ''.$langs->trans("Description").''; - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%'); $doleditor->Create(); print ""; From f1a9daf77e1740bbef9eb12c91ba7242c8e718af Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 20 Nov 2019 12:42:56 +0100 Subject: [PATCH 037/421] NEW add total of value in product stat --- htdocs/product/stats/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 5ca7992be31..0b0399e424f 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2005 Eric Seigne * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2019 Thibault FOUCARt * * 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 @@ -351,6 +352,7 @@ if ($result || empty($id)) $url = DOL_URL_ROOT.'/viewimage.php?modulepart='.$graphfiles[$key]['modulepart'].'&entity='.$object->entity.'&file='.urlencode($graphfiles[$key]['file']); $px->draw($dir."/".$graphfiles[$key]['file'], $url); + $graphfiles[$key]['total'] = $px->total(); $graphfiles[$key]['output'] = $px->show(); } else @@ -405,7 +407,7 @@ if ($result || empty($id)) // Label print ''; print $graphfiles[$key]['label']; - print ''; + print ' ('.$graphfiles[$key]['total'].')'; print ''.$linktoregenerate.''; print ''; // Image From 2c810988a6204c09ec973df96ac36eb1a3395387 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 20 Nov 2019 12:43:49 +0100 Subject: [PATCH 038/421] Update dolgraph.class.php --- htdocs/core/class/dolgraph.class.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 37f1d6036c6..4cd58a63378 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1124,7 +1124,20 @@ class DolGraph $this->stringtoshow .= ''."\n"; } - + /** + * Output HTML string to total value + * + * @return string HTML string to total value + */ + public function total() + { + $value = 0; + foreach($this->data as $valarray) // Loop on each x + { + $value += $valarray[1]; + } + return $value; + } /** * Output HTML string to show graph From 3209d550c2d083b72bee1b7af202329485578186 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 20 Nov 2019 11:45:12 +0000 Subject: [PATCH 039/421] Fixing style errors. --- htdocs/core/class/dolgraph.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 4cd58a63378..c6d610ca5f0 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1131,12 +1131,12 @@ class DolGraph */ public function total() { - $value = 0; - foreach($this->data as $valarray) // Loop on each x + $value = 0; + foreach($this->data as $valarray) // Loop on each x { - $value += $valarray[1]; - } - return $value; + $value += $valarray[1]; + } + return $value; } /** From 0a125f73b5ae8ef858ec3a901b2f68045ddbb16c Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 20 Nov 2019 14:21:35 +0100 Subject: [PATCH 040/421] NEW add units in product list --- htdocs/product/list.php | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 33ad0b4806c..2e383f18a0e 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -173,9 +173,10 @@ $arrayfields = array( 'p.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>1, 'enabled'=>(!empty($conf->barcode->enabled))), 'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(!empty($conf->service->enabled) && (string) $type == '1')), 'p.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled))), - 'p.length'=>array('label'=>$langs->trans("Length"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->global->PRODUCT_DISABLE_SIZE))), - 'p.surface'=>array('label'=>$langs->trans("Surface"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->global->PRODUCT_DISABLE_SURFACE))), - 'p.volume'=>array('label'=>$langs->trans("Volume"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->global->PRODUCT_DISABLE_VOLUME))), + 'p.length'=>array('label'=>$langs->trans("Length"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE))), + 'p.surface'=>array('label'=>$langs->trans("Surface"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SURFACE))), + 'p.volume'=>array('label'=>$langs->trans("Volume"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_VOLUME))), + 'cu.label'=>array('label'=>$langs->trans("DefaultUnitToShow"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->global->PRODUCT_USE_UNITS))), 'p.sellprice'=>array('label'=>$langs->trans("SellingPrice"), 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES)), 'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(!empty($user->rights->fournisseur->lire))), 'p.numbuyprice'=>array('label'=>$langs->trans("BuyingPriceNumShort"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire))), @@ -289,6 +290,7 @@ $sql .= ' p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte $sql .= ' p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy,'; $sql .= ' p.datec as date_creation, p.tms as date_update, p.pmp, p.stock,'; $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units,'; +if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ' p.fk_unit, cu.label as cu_label,'; $sql .= ' MIN(pfp.unitprice) as minsellprice'; if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { $sql .= ', pac.rowid prod_comb_id'; @@ -311,6 +313,7 @@ if (!empty($conf->global->MAIN_MULTILANGS)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; } +if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_units cu ON cu.rowid = p.fk_unit"; $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; @@ -376,6 +379,7 @@ $sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.tva_tx, p.pric $sql .= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,"; $sql .= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.pmp, p.stock,'; $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units'; +if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ', p.fk_unit'; if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { $sql .= ', pac.rowid'; @@ -639,6 +643,13 @@ if ($resql) print ''; } + // Unit + if (!empty($arrayfields['cu.label']['checked'])) + { + print ''; + print ''; + } + // Sell price if (!empty($arrayfields['p.sellprice']['checked'])) { @@ -759,6 +770,7 @@ if ($resql) if (!empty($arrayfields['p.length']['checked'])) print_liste_field_titre($arrayfields['p.length']['label'], $_SERVER["PHP_SELF"], "p.length", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.surface']['checked'])) print_liste_field_titre($arrayfields['p.surface']['label'], $_SERVER["PHP_SELF"], "p.surface", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.volume']['checked'])) print_liste_field_titre($arrayfields['p.volume']['label'], $_SERVER["PHP_SELF"], "p.volume", "", $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['cu.label']['checked'])) print_liste_field_titre($arrayfields['cu.label']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.sellprice']['checked'])) { print_liste_field_titre($arrayfields['p.sellprice']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); } @@ -875,6 +887,9 @@ if ($resql) $product_static->volume_units = $obj->volume_units; $product_static->surface = $obj->surface; $product_static->surface_units = $obj->surface_units; + if (!empty($conf->global->PRODUCT_USE_UNITS)) { + $product_static->fk_unit = $obj->fk_unit; + } if ((!empty($conf->stock->enabled) && $user->rights->stock->lire && $search_type != 1) || !empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) // To optimize call of load_stock { @@ -986,6 +1001,16 @@ if ($resql) print ''; if (!$i) $totalarray['nbfield']++; } + // Unit + if (!empty($arrayfields['cu.label']['checked'])) + { + print ''; + if ($obj->cu_label !== '') { + print $langs->trans($obj->cu_label); + } + print ''; + if (!$i) $totalarray['nbfield']++; + } // Sell price if (!empty($arrayfields['p.sellprice']['checked'])) From 38b083b766cb560017afa1a7b81f68ed632d60cf Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 20 Nov 2019 14:43:29 +0100 Subject: [PATCH 041/421] FIX unit translate in product list if null --- htdocs/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 2e383f18a0e..745876a7400 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -1005,7 +1005,7 @@ if ($resql) if (!empty($arrayfields['cu.label']['checked'])) { print ''; - if ($obj->cu_label !== '') { + if (!empty($obj->cu_label)) { print $langs->trans($obj->cu_label); } print ''; From b7517377a700810b27e251d27c6b948bdb3365f6 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 20 Nov 2019 15:00:34 +0100 Subject: [PATCH 042/421] FIX goup by unit label in product list --- htdocs/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 745876a7400..2396b345fb8 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -379,7 +379,7 @@ $sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.tva_tx, p.pric $sql .= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,"; $sql .= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.pmp, p.stock,'; $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units'; -if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ', p.fk_unit'; +if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ', p.fk_unit, cu.label'; if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { $sql .= ', pac.rowid'; From f15087a97db8f900bd724c97fdcce57788c60b1b Mon Sep 17 00:00:00 2001 From: altairis Date: Fri, 22 Nov 2019 15:14:32 +0100 Subject: [PATCH 043/421] remove conf --- htdocs/conf/conf.php | 51 -------------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 htdocs/conf/conf.php diff --git a/htdocs/conf/conf.php b/htdocs/conf/conf.php deleted file mode 100644 index bfadb6d5c55..00000000000 --- a/htdocs/conf/conf.php +++ /dev/null @@ -1,51 +0,0 @@ - Date: Fri, 22 Nov 2019 15:14:55 +0100 Subject: [PATCH 044/421] allow time consumed to be linked to another task --- htdocs/projet/tasks/time.php | 102 +++++++++++++++++++++++++---------- 1 file changed, 73 insertions(+), 29 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 0f9e9fb6357..c534789c812 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -5,6 +5,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018 Frédéric France + * Copyright (C) 2019 Christophe Battarel * * 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 @@ -225,34 +226,70 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$_POST["cancel if (!$error) { - $object->fetch($id, $ref); - // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) - - $object->timespent_id = $_POST["lineid"]; - $object->timespent_note = $_POST["timespent_note_line"]; - $object->timespent_old_duration = $_POST["old_duration"]; - $object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds - $object->timespent_duration += $_POST["new_durationmin"] * 60; // We store duration in seconds - if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered - { - $object->timespent_date = dol_mktime(GETPOST("timelinehour"), GETPOST("timelinemin"), 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); - $object->timespent_withhour = 1; - } - else + if ($_POST['taskid'] != $id) { - $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); + $id = $_POST['taskid']; + + $object->fetchTimeSpent(GETPOST('lineid', 'int')); + // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) + $result = $object->delTimeSpent($user); + + $object->fetch($id); + $object->timespent_note = $_POST["timespent_note_line"]; + $object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds + $object->timespent_duration += ($_POST["new_durationmin"] ? $_POST["new_durationmin"] : 0) * 60; // We store duration in seconds + if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered + { + $object->timespent_date = dol_mktime(GETPOST("timelinehour"), GETPOST("timelinemin"), 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); + $object->timespent_withhour = 1; + } + else + { + $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); + } + $object->timespent_fk_user = $_POST["userid_line"]; + $result = $object->addTimeSpent($user); + if ($result >= 0) + { + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans($object->error), null, 'errors'); + $error++; + } } - $object->timespent_fk_user = $_POST["userid_line"]; + else + { + $object->fetch($id, $ref); + // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) - $result = $object->updateTimeSpent($user); - if ($result >= 0) - { - setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans($object->error), null, 'errors'); - $error++; + $object->timespent_id = $_POST["lineid"]; + $object->timespent_note = $_POST["timespent_note_line"]; + $object->timespent_old_duration = $_POST["old_duration"]; + $object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds + $object->timespent_duration += $_POST["new_durationmin"] * 60; // We store duration in seconds + if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered + { + $object->timespent_date = dol_mktime(GETPOST("timelinehour"), GETPOST("timelinemin"), 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); + $object->timespent_withhour = 1; + } + else + { + $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); + } + $object->timespent_fk_user = $_POST["userid_line"]; + + $result = $object->updateTimeSpent($user); + if ($result >= 0) + { + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans($object->error), null, 'errors'); + $error++; + } } } else @@ -1195,10 +1232,17 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task { print ''; - $tasktmp->id = $task_time->fk_task; - $tasktmp->ref = $task_time->ref; - $tasktmp->label = $task_time->label; - print $tasktmp->getNomUrl(1, 'withproject', 'time'); + if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) + { + $formproject->selectTasks(-1, GETPOST('taskid', 'int')?GETPOST('taskid', 'int'):$task_time->fk_task, 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, ''); + } + else + { + $tasktmp->id = $task_time->fk_task; + $tasktmp->ref = $task_time->ref; + $tasktmp->label = $task_time->label; + print $tasktmp->getNomUrl(1, 'withproject', 'time'); + } print ''; if (!$i) $totalarray['nbfield']++; } From 7f24d1fe407941af8545d726e6a98205f8874e46 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 22 Nov 2019 14:18:09 +0000 Subject: [PATCH 045/421] Fixing style errors. --- htdocs/projet/tasks/time.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index c534789c812..9fb95609cb6 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -229,11 +229,11 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$_POST["cancel if ($_POST['taskid'] != $id) { $id = $_POST['taskid']; - + $object->fetchTimeSpent(GETPOST('lineid', 'int')); // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) $result = $object->delTimeSpent($user); - + $object->fetch($id); $object->timespent_note = $_POST["timespent_note_line"]; $object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds @@ -259,7 +259,7 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$_POST["cancel $error++; } } - else + else { $object->fetch($id, $ref); // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) From 4d9894e58e40e6b326f4d49909b9cbc7e9d40919 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 22 Nov 2019 15:49:06 +0100 Subject: [PATCH 046/421] Update card.php --- 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 0b0399e424f..24387ef8b73 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2005 Eric Seigne * Copyright (C) 2013 Juanjo Menent - * Copyright (C) 2019 Thibault FOUCARt + * Copyright (C) 2019 Thibault FOUCART * * 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 From 35f02c5165bf94d76b10767d45d257255bf354af Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 25 Nov 2019 10:25:09 +0100 Subject: [PATCH 047/421] NEW add width and height measures in product list --- htdocs/product/list.php | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 2396b345fb8..8df44bfeea8 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -174,6 +174,8 @@ $arrayfields = array( 'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(!empty($conf->service->enabled) && (string) $type == '1')), 'p.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled))), 'p.length'=>array('label'=>$langs->trans("Length"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE))), + 'p.width'=>array('label'=>$langs->trans('Width'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE))), + 'p.height'=>array('label'=>$langs->trans('Height'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE))), 'p.surface'=>array('label'=>$langs->trans("Surface"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SURFACE))), 'p.volume'=>array('label'=>$langs->trans("Volume"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_VOLUME))), 'cu.label'=>array('label'=>$langs->trans("DefaultUnitToShow"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->global->PRODUCT_USE_UNITS))), @@ -289,7 +291,7 @@ $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.fk_product_type, p.barcode, p $sql .= ' p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; $sql .= ' p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy,'; $sql .= ' p.datec as date_creation, p.tms as date_update, p.pmp, p.stock,'; -$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units,'; +$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.height, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units,'; if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ' p.fk_unit, cu.label as cu_label,'; $sql .= ' MIN(pfp.unitprice) as minsellprice'; if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { @@ -378,7 +380,7 @@ $sql .= $hookmanager->resPrint; $sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type,"; $sql .= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,"; $sql .= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.pmp, p.stock,'; -$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units'; +$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.height, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units'; if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ', p.fk_unit, cu.label'; if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { @@ -630,6 +632,18 @@ if ($resql) print ''; print ''; } + // Width + if (!empty($arrayfields['p.width']['checked'])) + { + print ''; + print ''; + } + // Height + if (!empty($arrayfields['p.height']['checked'])) + { + print ''; + print ''; + } // Surface if (!empty($arrayfields['p.surface']['checked'])) { @@ -768,6 +782,8 @@ if ($resql) } if (!empty($arrayfields['p.weight']['checked'])) print_liste_field_titre($arrayfields['p.weight']['label'], $_SERVER["PHP_SELF"], "p.weight", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.length']['checked'])) print_liste_field_titre($arrayfields['p.length']['label'], $_SERVER["PHP_SELF"], "p.length", "", $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['p.width']['checked'])) print_liste_field_titre($arrayfields['p.width']['label'], $_SERVER['PHP_SELF'], 'p.width', '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['p.height']['checked'])) print_liste_field_titre($arrayfields['p.height']['label'], $_SERVER['PHP_SELF'], 'p.height', '', $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.surface']['checked'])) print_liste_field_titre($arrayfields['p.surface']['label'], $_SERVER["PHP_SELF"], "p.surface", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.volume']['checked'])) print_liste_field_titre($arrayfields['p.volume']['label'], $_SERVER["PHP_SELF"], "p.volume", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['cu.label']['checked'])) print_liste_field_titre($arrayfields['cu.label']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'center '); @@ -985,6 +1001,22 @@ if ($resql) print ''; if (!$i) $totalarray['nbfield']++; } + // Width + if (!empty($arrayfields['p.width']['checked'])) + { + print ''; + print $obj->width; + print ''; + if (!$i) $totalarray['nbfield']++; + } + // Height + if (!empty($arrayfields['p.height']['checked'])) + { + print ''; + print $obj->height; + print ''; + if (!$i) $totalarray['nbfield']++; + } // Surface if (!empty($arrayfields['p.surface']['checked'])) { From f6bc48e6d7a40e3dd983997b0eae6b5f6c28a264 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 28 Nov 2019 22:13:11 +0100 Subject: [PATCH 048/421] FIX minimal stripe update for compatibility cf https://stripe.com/guides/important-update-for-connect --- htdocs/stripe/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/config.php b/htdocs/stripe/config.php index 17ca74b7955..3eb7feae0d5 100644 --- a/htdocs/stripe/config.php +++ b/htdocs/stripe/config.php @@ -55,4 +55,4 @@ else \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']); \Stripe\Stripe::setAppInfo("Dolibarr Stripe", DOL_VERSION, "https://www.dolibarr.org"); // add dolibarr version -\Stripe\Stripe::setApiVersion("2019-05-16"); // force version API +\Stripe\Stripe::setApiVersion("2019-09-09"); // force version API From b9c0f961c9d890330c2027e7566f440fe2cc0c02 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 28 Nov 2019 22:17:49 +0100 Subject: [PATCH 049/421] Update stripe.class.php --- htdocs/stripe/class/stripe.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 626f5533da4..d1b661841db 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -393,7 +393,7 @@ class Stripe extends CommonObject "currency" => $currency_code, "payment_method_types" => array("card"), "description" => $description, - "statement_descriptor" => dol_trunc($tag, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + "statement_descriptor_suffix" => dol_trunc($tag, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) //"save_payment_method" => true, "metadata" => $metadata ); @@ -683,7 +683,7 @@ class Stripe extends CommonObject $charge = \Stripe\Charge::create(array( "amount" => "$stripeamount", "currency" => "$currency", - "statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + "statement_descriptor_suffix" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) "description" => "Stripe payment: ".$description, "capture" => $capture, "metadata" => $metadata, @@ -693,7 +693,7 @@ class Stripe extends CommonObject $paymentarray = array( "amount" => "$stripeamount", "currency" => "$currency", - "statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + "statement_descriptor_suffix" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) "description" => "Stripe payment: ".$description, "capture" => $capture, "metadata" => $metadata, @@ -721,7 +721,7 @@ class Stripe extends CommonObject $paymentarray = array( "amount" => "$stripeamount", "currency" => "$currency", - "statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + "statement_descriptor_suffix" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) "description" => "Stripe payment: ".$description, "capture" => $capture, "metadata" => $metadata, From 16d08bd9031f6e50cde860a8a11018dd0bd9872a Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 28 Nov 2019 22:19:52 +0100 Subject: [PATCH 050/421] Update newpayment.php --- htdocs/public/payment/newpayment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index dbceb483f97..a3667af0c6a 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -495,7 +495,7 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) 'metadata' => $metadata, 'customer' => $customer->id, 'source' => $card, - 'statement_descriptor' => dol_trunc($FULLTAG, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + 'statement_descriptor_suffix' => dol_trunc($FULLTAG, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) ), array("idempotency_key" => "$FULLTAG", "stripe_account" => "$stripeacc")); // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) if (empty($charge)) From 753439efee7b0f21f8f023778b11263afa02afc4 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 28 Nov 2019 23:23:08 +0100 Subject: [PATCH 051/421] Update stripe.php --- htdocs/stripe/admin/stripe.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index c3c008a5874..4444dd4c540 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -161,7 +161,7 @@ print ''; dol_fiche_head($head, 'stripeaccount', '', -1); -$stripearrayofwebhookevents=array('payout.created','payout.paid','charge.pending','charge.refunded','charge.succeeded','charge.failed','payment_intent.succeeded','payment_intent.payment_failed','payment_method.attached','payment_method.updated','payment_method.card_automatically_updated','payment_method.detached','source.chargeable','customer.deleted'); +$stripearrayofwebhookevents=array('account.updated','payout.created','payout.paid','charge.pending','charge.refunded','charge.succeeded','charge.failed','payment_intent.succeeded','payment_intent.payment_failed','payment_method.attached','payment_method.updated','payment_method.card_automatically_updated','payment_method.detached','source.chargeable','customer.deleted'); print $langs->trans("StripeDesc")."
\n"; From 4bd4719aa660984a4d381f1cd5725d80d0e16566 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 1 Dec 2019 10:03:29 +0000 Subject: [PATCH 052/421] Fixing style errors. --- htdocs/stripe/class/stripe.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index ef902b6164c..48127874e12 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -969,10 +969,10 @@ class Stripe extends CommonObject if (!in_array($currency, $arrayzerounitcurrency)) $stripefee = round($fee * 100); else $stripefee = round($fee); - $paymentarray = array( + $paymentarray = array( "amount" => "$stripeamount", "currency" => "$currency", - "statement_descriptor_suffix" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + "statement_descriptor_suffix" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) "description" => "Stripe payment: ".$description, "capture" => $capture, "metadata" => $metadata, From acbd8efa7d18e2bf2a3e9b00ac5db25f1e0c4159 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 8 Dec 2019 23:16:49 +0100 Subject: [PATCH 053/421] NEW: Takepos supplements --- htdocs/langs/en_US/cashdesk.lang | 2 ++ htdocs/takepos/admin/setup.php | 18 +++++++++++ htdocs/takepos/ajax/ajax.php | 1 + htdocs/takepos/invoice.php | 51 +++++++++++++++++++++++++++++++- htdocs/takepos/takepos.php | 18 +++++++---- 5 files changed, 84 insertions(+), 6 deletions(-) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 0516de208fc..8bf34a3ae17 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -77,3 +77,5 @@ InvoiceIsAlreadyValidated=Invoice is already validated NoLinesToBill=No lines to bill CustomReceipt=Custom Receipt ReceiptName=Receipt Name +ProductSupplements=Product Supplements +SupplementCategory=Supplement category diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 2e82f0471bd..c78f744e1d2 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -75,6 +75,8 @@ if (GETPOST('action', 'alpha') == 'set') $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_ORDER_NOTES", GETPOST('TAKEPOS_ORDER_NOTES', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_PHONE_BASIC_LAYOUT", GETPOST('TAKEPOS_PHONE_BASIC_LAYOUT', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS", GETPOST('TAKEPOS_SUPPLEMENTS', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS_CATEGORY", GETPOST('TAKEPOS_SUPPLEMENTS_CATEGORY', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_AUTO_PRINT_TICKETS", GETPOST('TAKEPOS_AUTO_PRINT_TICKETS', 'int'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_NUMPAD", GETPOST('TAKEPOS_NUMPAD', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_NUM_TERMINALS", GETPOST('TAKEPOS_NUM_TERMINALS', 'alpha'), 'chaine', 0, '', $conf->entity); @@ -222,6 +224,22 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) print ''; print $form->selectyesno("TAKEPOS_PHONE_BASIC_LAYOUT", $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT, 1); print ''; + + print ''; + print $langs->trans("ProductSupplements"); + print ''; + print $form->selectyesno("TAKEPOS_SUPPLEMENTS", $conf->global->TAKEPOS_SUPPLEMENTS, 1); + print ''; + + if ($conf->global->TAKEPOS_SUPPLEMENTS) + { + print ''; + print $langs->trans("SupplementCategory"); + print ''; + print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0); + print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY'); + print "\n"; + } } print ''; diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index 7e3049f9f6e..74b24d78570 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -45,6 +45,7 @@ $id = GETPOST('id', 'int'); if ($action == 'getProducts') { $object = new Categorie($db); + if ($category=="supplements") $category=$conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY; $result = $object->fetch($category); if ($result > 0) { diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 23bc09a7268..0b7ebff8548 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -87,6 +87,7 @@ $placeid = 0; // $placeid is id of invoice $number = GETPOST('number', 'alpha'); $idline = GETPOST('idline', 'int'); +$selectedline = GETPOST('selectedline', 'int'); $desc = GETPOST('desc', 'alpha'); $pay = GETPOST('pay', 'alpha'); $amountofpayment = price2num(GETPOST('amount', 'alpha')); @@ -276,7 +277,23 @@ if ($action == "addline") $price_base_type = $prod->multiprices_base_type[$customer->price_level]; } - $idoflineadded = $invoice->addline($prod->description, $price, 1, $tva_tx, $prod->localtax1_tx, $prod->localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, 0, null, 0, '', 0, 100, '', null, 0); + if ($conf->global->TAKEPOS_SUPPLEMENTS) + { + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + $cat = new Categorie($db); + $categories = $cat->containing($idproduct, 'product'); + $found = (array_search($conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, array_column($categories, 'id'))); + if ($found !== false) // If this product is a supplement + { + $sql = "SELECT fk_parent_line FROM ".MAIN_DB_PREFIX."facturedet where rowid=$selectedline"; + $resql = $db->query($sql); + $row = $db->fetch_array($resql); + if ($row[0]==null) $parent_line=$selectedline; + else $parent_line=$row[0]; //If the parent line is already a supplement, add the supplement to the main product + } + } + + $idoflineadded = $invoice->addline($prod->description, $price, 1, $tva_tx, $prod->localtax1_tx, $prod->localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, $parent_line, null, 0, '', 0, 100, '', null, 0); $invoice->fetch($placeid); } @@ -689,6 +706,37 @@ if ($placeid > 0) $tmplines = array_reverse($invoice->lines); foreach ($tmplines as $line) { + if ($line->fk_parent_line!=false) + { + $htmlsupplements[$line->fk_parent_line].='fk_parent_line].=' order'; + $htmlsupplements[$line->fk_parent_line].= '" id="'.$line->id.'">'; + $htmlsupplements[$line->fk_parent_line].= ''; + $htmlsupplements[$line->fk_parent_line].= img_picto('', 'rightarrow'); + if ($line->product_label) $htmlsupplements[$line->fk_parent_line] .= $line->product_label; + if ($line->product_label && $line->desc) $htmlsupplements[$line->fk_parent_line] .= '
'; + if ($line->product_label != $line->desc) + { + $firstline = dolGetFirstLineOfText($line->desc); + if ($firstline != $line->desc) + { + $htmlsupplements[$line->fk_parent_line] .= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc); + } + else + { + $htmlsupplements[$line->fk_parent_line] .= $line->desc; + } + } + $htmlsupplements[$line->fk_parent_line] .= ''; + if ($_SESSION["basiclayout"] != 1) + { + $htmlsupplements[$line->fk_parent_line] .= ''.vatrate($line->remise_percent, true).''; + $htmlsupplements[$line->fk_parent_line] .= ''.$line->qty.''; + $htmlsupplements[$line->fk_parent_line] .= ''.price($line->total_ttc).''; + } + $htmlsupplements[$line->fk_parent_line] .= ''."\n"; + continue; + } $htmlforlines = ''; $htmlforlines .= ''.price($line->total_ttc).''; } $htmlforlines .= ''."\n"; + $htmlforlines .= $htmlsupplements[$line->id]; print $htmlforlines; } diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index ef987c84d86..b4810b23595 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -233,10 +233,14 @@ function LoadProducts(position, issubcat) { console.log("LoadProducts"); var maxproduct = ; - $('#catimg'+position).animate({opacity: '0.5'}, 1); - $('#catimg'+position).animate({opacity: '1'}, 100); - if (issubcat==true) currentcat=$('#prodiv'+position).data('rowid'); - else currentcat=$('#catdiv'+position).data('rowid'); + if (position=="supplements") currentcat="supplements"; + else + { + $('#catimg'+position).animate({opacity: '0.5'}, 1); + $('#catimg'+position).animate({opacity: '1'}, 100); + if (issubcat==true) currentcat=$('#prodiv'+position).data('rowid'); + else currentcat=$('#catdiv'+position).data('rowid'); + } if (currentcat == undefined) return; pageproducts=0; ishow=0; //product to show counter @@ -353,7 +357,7 @@ function ClickProduct(position) { console.log("Click on product at position "+position+" for idproduct "+idproduct); if (idproduct=="") return; // Call page invoice.php to generate the section with product lines - $("#poslines").load("invoice.php?action=addline&place="+place+"&idproduct="+idproduct, function() { + $("#poslines").load("invoice.php?action=addline&place="+place+"&idproduct="+idproduct+"&selectedline="+selectedline, function() { //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); } @@ -723,6 +727,10 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) { $menus[$r++]=array('title'=>'
'.$langs->trans("OrderNotes").'
', 'action'=>'TakeposOrderNotes();'); } + if ($conf->global->TAKEPOS_SUPPLEMENTS) + { + $menus[$r++]=array('title'=>'
'.$langs->trans("ProductSupplements").'
', 'action'=>'LoadProducts(\'supplements\');'); + } } if ($conf->global->TAKEPOSCONNECTOR) { From caaa95da6aaf691dd42c3e86284a3aeb91cf41af Mon Sep 17 00:00:00 2001 From: atm-greg Date: Wed, 11 Dec 2019 15:33:36 +0100 Subject: [PATCH 054/421] hook on ics generation to add more events in eventarray --- htdocs/comm/action/class/actioncomm.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 69f748412a1..6f262076616 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1721,6 +1721,13 @@ class ActionComm extends CommonObject } $diff++; } + + $parameters=array('filters' => $filters, 'eventarray' => &$eventarray); + $reshook=$hookmanager->executeHooks('addMoreEventsExport', $parameters); // Note that $action and $object may have been modified by hook + if ($reshook > 0) + { + $eventarray = $hookmanager->resArray; + } } else { From b715ecd7d9a2d2af35ca7d6dca33f70f9edea615 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Wed, 11 Dec 2019 16:42:03 +0100 Subject: [PATCH 055/421] FIX bookmark URLs get truncated to 255 chars --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_bookmark.key.sql | 1 - htdocs/install/mysql/tables/llx_bookmark.sql | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 4bacfa9b765..f8f5f912025 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -545,3 +545,6 @@ ALTER TABLE llx_mrp_production ADD INDEX idx_mrp_production_fk_mo (fk_mo); ALTER TABLE llx_emailcollector_emailcollector ADD UNIQUE INDEX uk_emailcollector_emailcollector_ref(ref, entity); ALTER TABLE llx_website ADD COLUMN use_manifest integer; + +ALTER TABLE llx_bookmark DROP INDEX uk_bookmark_url; +ALTER TABLE llx_bookmark MODIFY COLUMN url TEXT; -- change from VARCHAR(255) to allow longer URLs diff --git a/htdocs/install/mysql/tables/llx_bookmark.key.sql b/htdocs/install/mysql/tables/llx_bookmark.key.sql index f933939ceb7..7f4090d32f4 100644 --- a/htdocs/install/mysql/tables/llx_bookmark.key.sql +++ b/htdocs/install/mysql/tables/llx_bookmark.key.sql @@ -17,5 +17,4 @@ -- =================================================================== -ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_url (fk_user, url); ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_title (fk_user, title); diff --git a/htdocs/install/mysql/tables/llx_bookmark.sql b/htdocs/install/mysql/tables/llx_bookmark.sql index 1c11525528c..6a76ed38343 100644 --- a/htdocs/install/mysql/tables/llx_bookmark.sql +++ b/htdocs/install/mysql/tables/llx_bookmark.sql @@ -21,7 +21,7 @@ create table llx_bookmark rowid integer AUTO_INCREMENT PRIMARY KEY, fk_user integer NOT NULL, dateb datetime, - url varchar(255) NOT NULL, + url TEXT, target varchar(16), title varchar(64), favicon varchar(24), From 5d955fa7e00c362fe7f3f9b2b5274d787286b74c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Dec 2019 13:51:13 +0100 Subject: [PATCH 056/421] Update 10.0.0-11.0.0.sql --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index f8f5f912025..d6e34030408 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -548,3 +548,4 @@ ALTER TABLE llx_website ADD COLUMN use_manifest integer; ALTER TABLE llx_bookmark DROP INDEX uk_bookmark_url; ALTER TABLE llx_bookmark MODIFY COLUMN url TEXT; -- change from VARCHAR(255) to allow longer URLs +ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_title (fk_user, title); From b6c9de39289d191ea82b2e9733dd63ec330ebc4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 17 Dec 2019 14:49:18 +0100 Subject: [PATCH 057/421] upload odt models for order --- .../modules/commande/doc/doc_generic_order_odt.modules.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 794e7c57a29..b753f323023 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -118,7 +118,7 @@ class doc_generic_order_odt extends ModelePDFCommandes $form = new Form($this->db); $texte = $this->description.".
\n"; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; @@ -177,6 +177,11 @@ class doc_generic_order_odt extends ModelePDFCommandes } $texte .= '
'; } + // Add select to upload a new template file. TODO Copy this feature on other admin pages. + $texte.= '
'.$langs->trans("UploadNewTemplate").' '; + $texte.= ''; + $texte.= ''; + $texte.= '
'; $texte .= ''; From 0f5bf891e2916ac74a7ab85dec94ef812c134195 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Dec 2019 12:29:16 +0100 Subject: [PATCH 058/421] Update viewcat.php --- htdocs/categories/viewcat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index a71fa14ebdd..895147175de 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -197,7 +197,7 @@ $head = categories_prepare_head($object,$type); dol_fiche_head($head, 'card', $title, -1, 'category'); -$linkback=(GETPOST('linkback') ? GETPOST('linkback'):DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type); +$linkback=(GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type); $linkback = ''.$langs->trans("BackToList").''; $object->next_prev_filter=" type = ".$object->type; $object->ref = $object->label; From 5012a66ecb6303de583490fd22ef7741e30e6268 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Dec 2019 12:29:52 +0100 Subject: [PATCH 059/421] Update viewcat.php --- htdocs/categories/viewcat.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 895147175de..95760ee87aa 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -197,8 +197,8 @@ $head = categories_prepare_head($object,$type); dol_fiche_head($head, 'card', $title, -1, 'category'); -$linkback=(GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type); -$linkback = ''.$langs->trans("BackToList").''; +$backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type); +$linkback = ''.$langs->trans("BackToList").''; $object->next_prev_filter=" type = ".$object->type; $object->ref = $object->label; $morehtmlref='
'.$langs->trans("Root").' >> '; From 43c12db1292fef8a553a53fa851840a136879c1d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Dec 2019 10:41:59 +0100 Subject: [PATCH 060/421] Fix load of CSS using dolibarr server --- htdocs/public/website/styles.css.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/public/website/styles.css.php b/htdocs/public/website/styles.css.php index 0cf70fdf2b1..e8e4e9a8378 100644 --- a/htdocs/public/website/styles.css.php +++ b/htdocs/public/website/styles.css.php @@ -82,7 +82,9 @@ if (empty($pageid)) { $object->fetch(0, $website); } + $objectpage=new WebsitePage($db); + /* Not required for CSS file $array=$objectpage->fetchAll($object->id); if (is_array($array) && count($array) > 0) @@ -90,13 +92,16 @@ if (empty($pageid)) $firstrep=reset($array); $pageid=$firstrep->id; } + */ } +/* Not required for CSS file if (empty($pageid)) { $langs->load("website"); print $langs->trans("PreviewOfSiteNotYetAvailable"); exit; } +*/ // Security: Delete string ../ into $original_file global $dolibarr_main_data_root; From 863fa7360d5acf903272796e75badc0f83690982 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 19 Dec 2019 09:57:37 +0000 Subject: [PATCH 061/421] Fixing style errors. --- htdocs/core/lib/multicurrency.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/multicurrency.lib.php b/htdocs/core/lib/multicurrency.lib.php index d9d0140fba1..f17d79c6207 100644 --- a/htdocs/core/lib/multicurrency.lib.php +++ b/htdocs/core/lib/multicurrency.lib.php @@ -68,4 +68,4 @@ function multicurrencyLimitPrepareHead($aCurrencies) } return $head; -} \ No newline at end of file +} From 2ae779a13e24f61e9d04879334a135e0e13f20dd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Dec 2019 11:08:42 +0100 Subject: [PATCH 062/421] Fix can set zero as value for max number of decimal --- htdocs/admin/limits.php | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index 02e27813c6f..8bc356e18d9 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -94,13 +94,13 @@ llxHeader(); print load_fiche_titre($langs->trans("LimitsSetup"), '', 'title_setup'); +$currencycode = (! empty($currencycode)?$currencycode:$conf->currency); +$aCurrencies = array($conf->currency); // Default currency always first position + if (! empty($conf->multicurrency->enabled) && ! empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/multicurrency.lib.php'; - $currencycode = (! empty($currencycode)?$currencycode:$conf->currency); - $aCurrencies = array($conf->currency); // Default currency always first position - $sql = 'SELECT rowid, code FROM '.MAIN_DB_PREFIX.'multicurrency'; $sql.= ' WHERE entity = '.$conf->entity; $sql.= ' AND code != "'.$conf->currency.'"'; // Default currency always first position @@ -111,12 +111,12 @@ if (! empty($conf->multicurrency->enabled) && ! empty($conf->global->MULTICURREN { $aCurrencies[] = $obj->code; } + } - if (! empty($aCurrencies) && count($aCurrencies) > 1) - { - $head = multicurrencyLimitPrepareHead($aCurrencies); - dol_fiche_head($head, $currencycode, '', -1, "multicurrency"); - } + if (! empty($aCurrencies) && count($aCurrencies) > 1) + { + $head = multicurrencyLimitPrepareHead($aCurrencies); + dol_fiche_head($head, $currencycode, '', -1, "multicurrency"); } } @@ -139,18 +139,18 @@ if ($action == 'edit') print ''; print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly")); - print ''; + print ''; print ''; print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly")); - print ''; + print ''; print ''.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").''; - print ''; + print ''; print ''; print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly")); - print ''; + print ''; print ''; @@ -170,18 +170,18 @@ else print ''; print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly")); - print ''.(! empty($conf->global->$mainmaxdecimalsunit)?$conf->global->$mainmaxdecimalsunit:$conf->global->MAIN_MAX_DECIMALS_UNIT).''; + print ''.(isset($conf->global->$mainmaxdecimalsunit)?$conf->global->$mainmaxdecimalsunit:$conf->global->MAIN_MAX_DECIMALS_UNIT).''; print ''; print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly")); - print ''.(! empty($conf->global->$mainmaxdecimalstot)?$conf->global->$mainmaxdecimalstot:$conf->global->MAIN_MAX_DECIMALS_TOT).''; + print ''.(isset($conf->global->$mainmaxdecimalstot)?$conf->global->$mainmaxdecimalstot:$conf->global->MAIN_MAX_DECIMALS_TOT).''; print ''.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").''; - print ''.(! empty($conf->global->$mainmaxdecimalsshown)?$conf->global->$mainmaxdecimalsshown:$conf->global->MAIN_MAX_DECIMALS_SHOWN).''; + print ''.(isset($conf->global->$mainmaxdecimalsshown)?$conf->global->$mainmaxdecimalsshown:$conf->global->MAIN_MAX_DECIMALS_SHOWN).''; print ''; print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly")); - print ''.(! empty($conf->global->$mainroundingruletot)?$conf->global->$mainroundingruletot:$conf->global->MAIN_ROUNDING_RULE_TOT).''; + print ''.(isset($conf->global->$mainroundingruletot)?$conf->global->$mainroundingruletot:$conf->global->MAIN_ROUNDING_RULE_TOT).''; print ''; @@ -190,6 +190,14 @@ else print '
'; } +if (! empty($conf->multicurrency->enabled) && ! empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) +{ + if (! empty($aCurrencies) && count($aCurrencies) > 1) + { + dol_fiche_end(); + } +} + if (empty($mysoc->country_code)) { $langs->load("errors"); From 3d19e1321bbe3b6f7e22c6e0cfc903e1a839add9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 19 Dec 2019 11:10:55 +0100 Subject: [PATCH 063/421] NEW upload odt models for proposal --- .../propale/doc/doc_generic_proposal_odt.modules.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index b955da102ab..b4b3d2fb3e0 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2010-2012 Laurent Destailleur * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2016 Charlie Benke - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2019 Frédéric France * * 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 @@ -115,7 +115,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $form = new Form($this->db); $texte = $this->description.".
\n"; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; @@ -205,7 +205,11 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte .= ''; } } - + // Add select to upload a new template file. TODO Copy this feature on other admin pages. + $texte .= '
'.$langs->trans("UploadNewTemplate").' '; + $texte .= ''; + $texte .= ''; + $texte .= '
'; $texte .= ''; $texte .= ''; From 0f30e6f73bc37f8c3fcb992a509c9704ab9972bb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Dec 2019 11:35:50 +0100 Subject: [PATCH 064/421] Update dispatch.php --- htdocs/fourn/commande/dispatch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 7a98344d8fb..7d25bd7bdc0 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -55,7 +55,7 @@ $action = GETPOST('action', 'aZ09'); $fk_default_warehouse = GETPOST('fk_default_warehouse', 'int'); if ($user->socid) - $socid = $user->societe_id; + $socid = $user->socid; $result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande'); if (empty($conf->stock->enabled)) { From 2f41a53bb48f7452ae2794f35e0c17394d19ef18 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 19 Dec 2019 10:38:19 +0000 Subject: [PATCH 065/421] Fixing style errors. --- htdocs/fourn/commande/dispatch.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 7d25bd7bdc0..46b2f6a50ad 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -240,7 +240,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) $qty = "qty_".$reg[1].'_'.$reg[2]; $ent = "entrepot_".$reg[1].'_'.$reg[2]; if (empty(GETPOST($ent))) $ent = $fk_default_warehouse; - $pu = "pu_".$reg[1].'_'.$reg[2]; // This is unit price including discount + $pu = "pu_".$reg[1].'_'.$reg[2]; // This is unit price including discount $fk_commandefourndet = "fk_commandefourndet_".$reg[1].'_'.$reg[2]; if (!empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) { @@ -490,7 +490,6 @@ if ($id > 0 || !empty($ref)) { || $object->statut == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY || $object->statut == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) { - require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); $formproduct->loadWarehouses(); From 07b8deaf234839f6bb5e6e8af73df7295ccc8cb1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Dec 2019 12:05:18 +0100 Subject: [PATCH 066/421] Fix clean of constant _TABS_ was forgotten --- htdocs/install/repair.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index b46e9713983..e433ec27f8c 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -68,18 +68,23 @@ $actiondone=1; print '

'.$langs->trans("Repair").'

'; print 'Option standard (\'test\' or \'confirmed\') is '.(GETPOST('standard', 'alpha')?GETPOST('standard', 'alpha'):'undefined').'
'."\n"; +// Disable modules +print 'Option force_disable_of_modules_not_found (\'test\' or \'confirmed\') is '.(GETPOST('force_disable_of_modules_not_found', 'alpha')?GETPOST('force_disable_of_modules_not_found', 'alpha'):'undefined').'
'."\n"; +// Files print 'Option restore_thirdparties_logos (\'test\' or \'confirmed\') is '.(GETPOST('restore_thirdparties_logos', 'alpha')?GETPOST('restore_thirdparties_logos', 'alpha'):'undefined').'
'."\n"; print 'Option restore_user_pictures (\'test\' or \'confirmed\') is '.(GETPOST('restore_user_pictures', 'alpha')?GETPOST('restore_user_pictures', 'alpha'):'undefined').'
'."\n"; +print 'Option rebuild_product_thumbs (\'test\' or \'confirmed\') is '.(GETPOST('rebuild_product_thumbs', 'alpha')?GETPOST('rebuild_product_thumbs', 'alpha'):'undefined').'
'."\n"; +// Clean tables and data print 'Option clean_linked_elements (\'test\' or \'confirmed\') is '.(GETPOST('clean_linked_elements', 'alpha')?GETPOST('clean_linked_elements', 'alpha'):'undefined').'
'."\n"; print 'Option clean_menus (\'test\' or \'confirmed\') is '.(GETPOST('clean_menus', 'alpha')?GETPOST('clean_menus', 'alpha'):'undefined').'
'."\n"; print 'Option clean_orphelin_dir (\'test\' or \'confirmed\') is '.(GETPOST('clean_orphelin_dir', 'alpha')?GETPOST('clean_orphelin_dir', 'alpha'):'undefined').'
'."\n"; print 'Option clean_product_stock_batch (\'test\' or \'confirmed\') is '.(GETPOST('clean_product_stock_batch', 'alpha')?GETPOST('clean_product_stock_batch', 'alpha'):'undefined').'
'."\n"; -print 'Option set_empty_time_spent_amount (\'test\' or \'confirmed\') is '.(GETPOST('set_empty_time_spent_amount', 'alpha')?GETPOST('set_empty_time_spent_amount', 'alpha'):'undefined').'
'."\n"; -print 'Option rebuild_product_thumbs (\'test\' or \'confirmed\') is '.(GETPOST('rebuild_product_thumbs', 'alpha')?GETPOST('rebuild_product_thumbs', 'alpha'):'undefined').'
'."\n"; -print 'Option force_disable_of_modules_not_found (\'test\' or \'confirmed\') is '.(GETPOST('force_disable_of_modules_not_found', 'alpha')?GETPOST('force_disable_of_modules_not_found', 'alpha'):'undefined').'
'."\n"; print 'Option clean_perm_table (\'test\' or \'confirmed\') is '.(GETPOST('clean_perm_table', 'alpha')?GETPOST('clean_perm_table', 'alpha'):'undefined').'
'."\n"; -print 'Option force_utf8_on_tables, for mysql/mariadb only (\'test\' or \'confirmed\') is '.(GETPOST('force_utf8_on_tables', 'alpha')?GETPOST('force_utf8_on_tables', 'alpha'):'undefined').'
'."\n"; print 'Option repair_link_dispatch_lines_supplier_order_lines, (\'test\' or \'confirmed\') is '.(GETPOST('repair_link_dispatch_lines_supplier_order_lines', 'alpha')?GETPOST('repair_link_dispatch_lines_supplier_order_lines', 'alpha'):'undefined').'
'."\n"; +// Init data +print 'Option set_empty_time_spent_amount (\'test\' or \'confirmed\') is '.(GETPOST('set_empty_time_spent_amount', 'alpha')?GETPOST('set_empty_time_spent_amount', 'alpha'):'undefined').'
'."\n"; +// Structure +print 'Option force_utf8_on_tables, for mysql/mariadb only (\'test\' or \'confirmed\') is '.(GETPOST('force_utf8_on_tables', 'alpha')?GETPOST('force_utf8_on_tables', 'alpha'):'undefined').'
'."\n"; print '
'; print ''; @@ -345,13 +350,13 @@ if ($ok && GETPOST('standard', 'alpha')) // clean declaration constants if ($ok && GETPOST('standard', 'alpha')) { - print ''; + print ''; $sql ="SELECT name, entity, value"; $sql.=" FROM ".MAIN_DB_PREFIX."const as c"; $sql.=" WHERE name LIKE 'MAIN_MODULE_%_TPL' OR name LIKE 'MAIN_MODULE_%_CSS' OR name LIKE 'MAIN_MODULE_%_JS' OR name LIKE 'MAIN_MODULE_%_HOOKS'"; $sql.=" OR name LIKE 'MAIN_MODULE_%_TRIGGERS' OR name LIKE 'MAIN_MODULE_%_THEME' OR name LIKE 'MAIN_MODULE_%_SUBSTITUTIONS' OR name LIKE 'MAIN_MODULE_%_MODELS'"; - $sql.=" OR name LIKE 'MAIN_MODULE_%_MENUS' OR name LIKE 'MAIN_MODULE_%_LOGIN' OR name LIKE 'MAIN_MODULE_%_BARCODE'"; + $sql.=" OR name LIKE 'MAIN_MODULE_%_MENUS' OR name LIKE 'MAIN_MODULE_%_LOGIN' OR name LIKE 'MAIN_MODULE_%_BARCODE' OR name LIKE 'MAIN_MODULE_%_TABS_%'"; $sql.=" ORDER BY name, entity"; $resql = $db->query($sql); @@ -376,7 +381,7 @@ if ($ok && GETPOST('standard', 'alpha')) $sql2 ="SELECT COUNT(*) as nb"; $sql2.=" FROM ".MAIN_DB_PREFIX."const as c"; - $sql2.=" WHERE name LIKE 'MAIN_MODULE_".$name."'"; + $sql2.=" WHERE name = 'MAIN_MODULE_".$name."'"; $sql2.=" AND entity = ".$obj->entity; $resql2 = $db->query($sql2); if ($resql2) @@ -384,7 +389,7 @@ if ($ok && GETPOST('standard', 'alpha')) $obj2 = $db->fetch_object($resql2); if ($obj2 && $obj2->nb == 0) { - // Module not found, so we canremove entry + // Module not found, so we can remove entry $sqldelete = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = '".$db->escape($obj->name)."' AND entity = ".$obj->entity; if (GETPOST('standard', 'alpha') == 'confirmed') From 2ad483413e729131ec46e3d7484d82599646e7cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Dec 2019 12:05:34 +0100 Subject: [PATCH 067/421] Better place to force the default warehouse --- htdocs/fourn/commande/dispatch.php | 28 +++++++++++++--------------- htdocs/langs/en_US/stocks.lang | 1 + 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 46b2f6a50ad..eb9093888af 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -569,20 +569,6 @@ if ($id > 0 || !empty($ref)) { if ($num) { $entrepot = new Entrepot($db); $listwarehouses=$entrepot->list_array(1); - // entrepot par défaut - print $langs->trans("Warehouse").' : '; - if (count($listwarehouses)>1) - { - print $form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 1, 0, 0, '', 0, 0, $disabled); - } - elseif (count($listwarehouses)==1) - { - print $form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 0, 0, 0, '', 0, 0, $disabled); - } - else - { - print $langs->trans("NoWarehouseDefined"); - } print ''; @@ -613,7 +599,19 @@ if ($id > 0 || !empty($ref)) { } } - print ''; + print ''; // Enable hooks to append additional columns $parameters = array(); diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index ecee37908ce..3e01db9fffb 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -215,3 +215,4 @@ StockDecrease=Stock decrease InventoryForASpecificWarehouse=Inventory for a specific warehouse InventoryForASpecificProduct=Inventory for a specific product StockIsRequiredToChooseWhichLotToUse=Stock is required to choose which lot to use +ForceTo=Force to \ No newline at end of file From 0636682e91fd0880ccec9f9a5d1720f5904911f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Dec 2019 13:41:43 +0100 Subject: [PATCH 068/421] FIX The substitution variable array was not complete --- htdocs/core/menus/standard/auguria.lib.php | 9 +++++---- htdocs/core/menus/standard/eldy.lib.php | 9 +++++---- htdocs/core/menus/standard/empty.php | 11 +++-------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index cc8a2d42ce5..e35f45576d1 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -52,6 +52,8 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout $menuArbo = new Menubase($db, 'auguria'); $newTabMenu = $menuArbo->menuTopCharger('', '', $type_user, 'auguria', $tabMenu); + $substitarray = getCommonSubstitutionArray($langs, 0, null, null); + if (empty($noout)) print_start_menu_array_auguria(); global $usemenuhider; @@ -75,8 +77,6 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout $showmode=dol_auguria_showmenu($type_user, $newTabMenu[$i], $listofmodulesforexternal); if ($showmode == 1) { - $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user); - $substitarray['__USERID__'] = $user->id; // For backward compatibility $newTabMenu[$i]['url'] = make_substitutions($newTabMenu[$i]['url'], $substitarray); $url = $shorturl = $newTabMenu[$i]['url']; @@ -314,6 +314,8 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t print "\n"; } + $substitarray = getCommonSubstitutionArray($langs, 0, null, null); + // We update newmenu with entries found into database $menuArbo = new Menubase($db, 'auguria'); $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, ($user->socid?1:0), 'auguria', $tabMenu); @@ -512,8 +514,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t } // $menu_array[$i]['url'] can be a relative url, a full external url. We try substitution - $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user); - $substitarray['__USERID__'] = $user->id; // For backward compatibility + $menu_array[$i]['url'] = make_substitutions($menu_array[$i]['url'], $substitarray); $url = $shorturl = $shorturlwithoutparam = $menu_array[$i]['url']; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index d1db12b9e2e..7799ac48690 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -52,6 +52,8 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $id = 'mainmenu'; $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); + $substitarray = getCommonSubstitutionArray($langs, 0, null, null); + if (empty($noout)) print_start_menu_array(); $usemenuhider = 1; @@ -448,8 +450,6 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $showmode = isVisibleToUserType($type_user, $newTabMenu[$i], $listofmodulesforexternal); if ($showmode == 1) { - $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user); - $substitarray['__USERID__'] = $user->id; // For backward compatibility $newTabMenu[$i]['url'] = make_substitutions($newTabMenu[$i]['url'], $substitarray); // url = url from host, shorturl = relative path into dolibarr sources @@ -679,6 +679,8 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM print "\n"; } + $substitarray = getCommonSubstitutionArray($langs, 0, null, null); + /** * We update newmenu with entries found into database * -------------------------------------------------- @@ -1982,8 +1984,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // $menu_array[$i]['url'] can be a relative url, a full external url. We try substitution - $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user); - $substitarray['__USERID__'] = $user->id; // For backward compatibility + $menu_array[$i]['url'] = make_substitutions($menu_array[$i]['url'], $substitarray); $url = $shorturl = $shorturlwithoutparam = $menu_array[$i]['url']; diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index 290ef0a959c..923f4e84965 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -146,6 +146,7 @@ class MenuManager $this->menu->add('/index.php', $langs->trans("Home"), 0, $showmode, $this->atarget, 'home', '', 10, $id, $idsel, $classname); + $substitarray = getCommonSubstitutionArray($langs, 0, null, null); // $this->menu->liste is top menu //var_dump($this->menu->liste);exit; @@ -156,8 +157,6 @@ class MenuManager print '
    '; print '
  • '; - $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user); - $substitarray['__USERID__'] = $user->id; // For backward compatibility $val['url'] = make_substitutions($val['url'], $substitarray); if ($val['enabled'] == 1) @@ -257,8 +256,6 @@ class MenuManager if ($showmenu) // Visible (option to hide when not allowed is off or allowed) { - $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user); - $substitarray['__USERID__'] = $user->id; // For backward compatibility $val2['url'] = make_substitutions($val2['url'], $substitarray); $relurl2 = dol_buildpath($val2['url'], 1); @@ -453,13 +450,13 @@ class MenuManager /* if ($mode == 'jmobile') { + $substitarray = getCommonSubstitutionArray($langs, 0, null, null); + foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' { print '
      '; print '
    • '; - $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user); - $substitarray['__USERID__'] = $user->id; // For backward compatibility $val['url'] = make_substitutions($val['url'], $substitarray); if ($val['enabled'] == 1) @@ -487,8 +484,6 @@ class MenuManager } foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' { - $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user); - $substitarray['__USERID__'] = $user->id; // For backward compatibility $val2['url'] = make_substitutions($val2['url'], $substitarray); $relurl2=dol_buildpath($val2['url'],1); From 43ff015157b3dc9caec9a8212f650ddb5acd56c4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Dec 2019 19:09:56 +0100 Subject: [PATCH 069/421] Fix pb with svg images --- htdocs/core/lib/images.lib.php | 6 +++--- htdocs/product/class/product.class.php | 12 ++++++++---- htdocs/theme/eldy/global.inc.php | 3 ++- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 1d1a6b8c7b9..1e6ebfa6d85 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -33,7 +33,7 @@ $quality = 80; * Return if a filename is file name of a supported image format * * @param string $file Filename - * @return int -1=Not image filename, 0=Image filename but format not supported by PHP, 1=Image filename with format supported by this PHP + * @return int -1=Not image filename, 0=Image filename but format not supported for conversion by PHP, 1=Image filename with format supported by this PHP */ function image_format_supported($file) { @@ -57,12 +57,12 @@ function image_format_supported($file) { if (!function_exists($imgfonction)) { - // Fonctions de conversion non presente dans ce PHP + // Fonctions of conversion not available in this PHP return 0; } } - // Filename is a format image and supported by this PHP + // Filename is a format image and supported for conversion by this PHP return 1; } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e32f0c32f8f..8b7d27073c0 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4835,8 +4835,10 @@ class Product extends CommonObject global $conf; $dir = $sdir; - if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { $dir .= '/'.get_exdir($this->id, 2, 0, 0, $this, 'product').$this->id."/photos/"; - } else { $dir .= '/'.get_exdir(0, 0, 0, 0, $this, 'product').dol_sanitizeFileName($this->ref).'/'; + if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { + $dir .= '/'.get_exdir($this->id, 2, 0, 0, $this, 'product').$this->id."/photos/"; + } else { + $dir .= '/'.get_exdir(0, 0, 0, 0, $this, 'product').dol_sanitizeFileName($this->ref).'/'; } $nbphoto = 0; @@ -4847,9 +4849,11 @@ class Product extends CommonObject if (is_resource($handle)) { while (($file = readdir($handle)) !== false) { - if (!utf8_check($file)) { $file = utf8_encode($file); // To be sure data is stored in UTF8 in memory + if (!utf8_check($file)) { + $file = utf8_encode($file); // To be sure data is stored in UTF8 in memory } - if (dol_is_file($dir.$file) && image_format_supported($file) > 0) { return true; + if (dol_is_file($dir.$file) && image_format_supported($file) >= 0) { + return true; } } } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index a15b6a3dd81..d18c3806363 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1446,7 +1446,7 @@ div.heightref { min-height: 80px; } div.divphotoref { - padding-: 20px; + padding-: 10px; } div.paginationref { padding-bottom: 10px; @@ -3602,6 +3602,7 @@ label.radioprivate { .photowithmargin { margin-bottom: 2px; margin-top: 10px; + margin-right: 10px; } .photowithborder { border: 1px solid #f0f0f0; From 19c14f354e330dbc1dfff80fd00af1fe2261499c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 21 Dec 2019 14:01:40 +0100 Subject: [PATCH 070/421] Fix specimen --- htdocs/comm/action/class/actioncomm.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 38af9bfd4fd..2de1b00c683 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1814,7 +1814,9 @@ class ActionComm extends CommonObject $this->location = 'Location'; $this->transparency = 1; // 1 means opaque $this->priority = 1; - $this->note = 'Note'; + $this->note = "This is a 'public' note"; + $this->note_public = "This is a 'public' note."; + $this->note_private = "This is a 'private' note."; $this->userownerid = $user->id; $this->userassigned[$user->id] = array('id'=>$user->id, 'transparency'=> 1); From 4312a4b0161c5d6bd648e44497a236134ecd6ecd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 22 Dec 2019 16:06:32 +0100 Subject: [PATCH 071/421] Typo --- htdocs/langs/en_US/accountancy.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index bc6cd99caa4..2459c78c15a 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -200,7 +200,7 @@ DeleteMvt=Delete Ledger lines DelMonth=Month to delete DelYear=Year to delete DelJournal=Journal to delete -ConfirmDeleteMvt=This will delete all lines of the Ledger for the year/month and/or from a specific journal (At least one criterion is required). You will have to reuse the feature 'Registration inaccounting' to have the deleted record back in the ledger. +ConfirmDeleteMvt=This will delete all lines of the Ledger for the year/month and/or from a specific journal (At least one criterion is required). You will have to reuse the feature 'Registration in accounting' to have the deleted record back in the ledger. ConfirmDeleteMvtPartial=This will delete the transaction from the Ledger (all lines related to same transaction will be deleted) FinanceJournal=Finance journal ExpenseReportsJournal=Expense reports journal From 30b8affdb7b4817838062feb3bf6fc84ea4d0b45 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 22 Dec 2019 21:32:19 +0100 Subject: [PATCH 072/421] Fix look and feel v11 --- htdocs/admin/facture_situation.php | 38 +++++++++++++++++------------- htdocs/admin/payment.php | 4 ++++ htdocs/core/lib/invoice.lib.php | 2 +- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/htdocs/admin/facture_situation.php b/htdocs/admin/facture_situation.php index 459fc801bae..3a4949b99a4 100644 --- a/htdocs/admin/facture_situation.php +++ b/htdocs/admin/facture_situation.php @@ -73,20 +73,26 @@ print load_fiche_titre($langs->trans("BillsSetup"), $linkback, 'title_setup'); $head = invoice_admin_prepare_head(); dol_fiche_head($head, 'situation', $langs->trans("InvoiceSituation"), -1, 'invoice'); + +print ''.$langs->trans("SituationInvoiceDesc").'

      '; + + /* * Numbering module */ -print load_fiche_titre($langs->trans("InvoiceSituation"), '', ''); -$var=0; - print ''; print ''; -_updateBtn(); +print '
      '; // You can use div-table-responsive-no-min if you dont need reserved height for your table print '

*** Clean module_parts entries of modules not enabled

*** Clean constant record of modules not enabled
'.$langs->trans("Warehouse").''.$langs->trans("Warehouse"); + + // Select warehouse to force it everywhere + if (count($listwarehouses)>1) + { + print '
'.$langs->trans("ForceTo").' '.$form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 1, 0, 0, '', 0, 0, $disabled); + } + elseif (count($listwarehouses)==1) + { + print '
'.$langs->trans("ForceTo").' '.$form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 0, 0, 0, '', 0, 0, $disabled); + } + + print '
'; +print ''; +print ''; +print ''; +print ''; +print "\n"; _printOnOff('INVOICE_USE_SITUATION', $langs->trans('UseSituationInvoices')); _printOnOff('INVOICE_USE_SITUATION_CREDIT_NOTE', $langs->trans('UseSituationInvoicesCreditNote')); @@ -100,12 +106,9 @@ $metas = array( ); _printInputFormPart('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', $langs->trans('RetainedwarrantyDefaultPercent'), '', $metas); - - - // Conditions paiements $inputCount = empty($inputCount)?1:($inputCount+1); -print ''; +print ''; print ''; print ''; print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'.$langs->trans('PaymentConditionsShortRetainedWarranty').' '; @@ -115,6 +118,9 @@ print '
'; +print '
'; + +print '
'; _updateBtn(); @@ -134,8 +140,8 @@ $db->close(); function _updateBtn() { global $langs; - print '
'; - print ''; + print '
'; + print ''; print '
'; } @@ -150,9 +156,9 @@ function _updateBtn() */ function _printOnOff($confkey, $title = false, $desc = '') { - global $var, $bc, $langs; - $var=!$var; - print ''; + global $langs; + + print ''; print ''.($title?$title:$langs->trans($confkey)); if (!empty($desc)) { print '
'.$langs->trans($desc).''; @@ -179,8 +185,8 @@ function _printOnOff($confkey, $title = false, $desc = '') */ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = array(), $type = 'input', $help = false) { - global $var, $bc, $langs, $conf, $db, $inputCount; - $var=!$var; + global $langs, $conf, $db, $inputCount; + $inputCount = empty($inputCount)?1:($inputCount+1); $form=new Form($db); @@ -200,7 +206,7 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra $metascompil .= ' '.$key.'="'.$values.'" '; } - print ''; + print ''; print ''; if (!empty($help)) { diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index a62aa14764c..dddf914a957 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -109,6 +109,7 @@ dol_fiche_head($head, 'payment', $langs->trans("Invoices"), -1, 'invoice'); print load_fiche_titre($langs->trans("PaymentsNumberingModule"), '', ''); +print '
'; print ''; print ''; print ''; @@ -226,6 +227,7 @@ foreach ($dirmodels as $reldir) } print '
'.$langs->trans("Name").'
'; +print '
'; print "
"; @@ -235,6 +237,7 @@ print ''; print ''; print ''; +print '
'; print ''; print ''; print ''; @@ -251,6 +254,7 @@ print '\n"; print '
'.$langs->trans("Parameter").''; print "
'; +print '
'; dol_fiche_end(); diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index f2818f72872..de1334c37a5 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -137,7 +137,7 @@ function invoice_admin_prepare_head() $head[$h][2] = 'payment'; $h++; - if ($conf->global->INVOICE_USE_SITUATION) { + if ($conf->global->INVOICE_USE_SITUATION || $conf->global->MAIN_FEATURES_LEVEL >= 1) { $head[$h][0] = DOL_URL_ROOT.'/admin/facture_situation.php'; $head[$h][1] = $langs->trans("InvoiceSituation"); $head[$h][2] = 'situation'; From a076c3c20cf4f04503c8024d3f260d37c4d06be1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Dec 2019 13:48:38 +0100 Subject: [PATCH 073/421] Add mig file for v12 --- .../install/mysql/migration/11.0.0-12.0.0.sql | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 htdocs/install/mysql/migration/11.0.0-12.0.0.sql diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql new file mode 100644 index 00000000000..3ee1d145b3c --- /dev/null +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -0,0 +1,38 @@ +-- +-- Be carefull to requests order. +-- This file must be loaded by calling /install/index.php page +-- when current version is 12.0.0 or higher. +-- +-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field); +-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table +-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex +-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres): +-- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid; +-- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid); +-- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq'); +-- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table; +-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL; +-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; +-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL; +-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL; +-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; +-- Note: fields with type BLOB/TEXT can't have default value. + + +-- Missing in v11 + + + +-- For v12 + + + From c6ed605d26a398f171dbdec69b0def5c2bd25580 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Dec 2019 13:49:13 +0100 Subject: [PATCH 074/421] Add missing fk_user in import list --- htdocs/core/class/html.formother.class.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index e5b3f8fbb6e..3d639d0dfcb 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -71,9 +71,11 @@ class FormOther public function select_export_model($selected = '', $htmlname = 'exportmodelid', $type = '', $useempty = 0, $fk_user = null) { // phpcs:enable - $sql = "SELECT rowid, label"; + global $conf; + + $sql = "SELECT rowid, label, fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."export_model"; - $sql .= " WHERE type = '".$type."'"; + $sql .= " WHERE type = '".$this->db->escape($type)."'"; if (!empty($fk_user)) $sql .= " AND fk_user IN (0, ".$fk_user.")"; // An export model $sql .= " ORDER BY rowid"; $result = $this->db->query($sql); @@ -99,6 +101,11 @@ class FormOther print ''; $i++; } From e1446d10d5675ed89cfe79a55339b2a786a82177 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Dec 2019 13:51:12 +0100 Subject: [PATCH 075/421] Prepare v12 --- .travis.yml | 9 ++++++--- htdocs/filefunc.inc.php | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3a996915ca7..ebe45b5748a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -401,9 +401,12 @@ script: php upgrade.php 9.0.0 10.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log php upgrade2.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log php step5.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log - php upgrade.php 10.0.0 11.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log - php upgrade2.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log - php step5.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log + php upgrade.php 10.0.0 11.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade10001100.log + php upgrade2.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-2.log + php step5.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-3.log + php upgrade.php 11.0.0 12.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade11001200.log + php upgrade2.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-2.log + php step5.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-3.log # Enable modules not enabled into original dump php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKETSUP,MAIN_MODULE_ACCOUNTING > $TRAVIS_BUILD_DIR/enablemodule.log echo $? diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 401a2c01380..18e2992930c 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', '11.0.0-beta'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (! defined('DOL_VERSION')) define('DOL_VERSION', '12.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('EURO')) define('EURO', chr(128)); From f09aecbdd83633a1dc295bf5dbde0ff2e32bdca1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Dec 2019 14:28:55 +0100 Subject: [PATCH 076/421] v12 --- htdocs/install/check.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 6b6cfb2911d..9d197c752dc 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -464,7 +464,8 @@ else array('from'=>'7.0.0', 'to'=>'8.0.0'), array('from'=>'8.0.0', 'to'=>'9.0.0'), array('from'=>'9.0.0', 'to'=>'10.0.0'), - array('from'=>'10.0.0', 'to'=>'11.0.0') + array('from'=>'10.0.0', 'to'=>'11.0.0'), + array('from'=>'11.0.0', 'to'=>'12.0.0') ); $count = 0; From 908e8be0dabf6f83e9ca6b6a66a470d85f0f55d4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Dec 2019 16:25:45 +0100 Subject: [PATCH 077/421] PHP Min bill 5.6 for Dolibarr 12 --- ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index e3a5ef0cbbe..0e62d5c79fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,13 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +WARNING: + +Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: +* PHP 5.5 is no more supported. Minimum PHP is now 5.6+. + + + ***** ChangeLog for 11.0.0 compared to 10.0.0 ***** For Users: From d24da574981c7bbfae88979ef0e91cb39f388d65 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Dec 2019 16:26:42 +0100 Subject: [PATCH 078/421] Update changelog --- ChangeLog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0e62d5c79fc..b3417c85c05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,14 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 12.0.0 compared to 11.0.0 ***** +For Users: + + +For Developers or integrators: + + + WARNING: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: From 14c510f4bee86f2eb5f9022a0391c769cce3fd33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Dec 2019 19:14:00 +0100 Subject: [PATCH 079/421] Remove php 5.5 --- .travis.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7699ca9c3ea..653bc480ce9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,6 @@ addons: - pgloader php: -- '5.5' - '5.6' - '7.0' - '7.1' @@ -60,8 +59,6 @@ matrix: - php: nightly # We exclude some combinations not usefull to save Travis CPU exclude: - - php: '5.6' - env: DB=mariadb - php: '7.0' env: DB=mariadb - php: '7.1' @@ -70,8 +67,6 @@ matrix: env: DB=mariadb - php: '7.3' env: DB=mariadb - - php: '5.6' - env: DB=postgresql - php: '7.0' env: DB=postgresql - php: '7.1' From 85f3f553c216de504d5c094e2816019c3aebd1e5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Dec 2019 20:32:44 +0100 Subject: [PATCH 080/421] Fix travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 653bc480ce9..0aaa07158c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -285,7 +285,7 @@ script: # Ensure we catch errors set -e #parallel-lint --exclude htdocs/includes --blame . - parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame . + parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/composer/autoload_static.php --blame . set +e echo From 6f97d163f95046d662dd98420499f30086abfcb8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Dec 2019 22:41:34 +0100 Subject: [PATCH 081/421] Fix: the stripe_account is not filled --- htdocs/stripe/class/stripe.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 931cfbfa83e..160bb28bef3 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -246,8 +246,8 @@ class Stripe extends CommonObject } // Create customer in Dolibarr - $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_account (fk_soc, login, key_account, site, status, entity, date_creation, fk_user_creat)"; - $sql .= " VALUES (".$object->id.", '', '".$this->db->escape($customer->id)."', 'stripe', ".$status.", ".$conf->entity.", '".$this->db->idate(dol_now())."', ".$user->id.")"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_account (fk_soc, login, key_account, site, site_account, status, entity, date_creation, fk_user_creat)"; + $sql .= " VALUES (".$object->id.", '', '".$this->db->escape($customer->id)."', 'stripe', '".$this->db->escape($stripearrayofkeysbyenv[$status]['publishable_key'])."', ".$status.", ".$conf->entity.", '".$this->db->idate(dol_now())."', ".$user->id.")"; $resql = $this->db->query($sql); if (!$resql) { From 7359c4140d7a5615a68ae44c9c43654e0e8fdf0d Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Tue, 24 Dec 2019 09:54:02 +0100 Subject: [PATCH 082/421] FIX 12.0 - bookmark URLs get truncated to 255 chars - PR rescheduled for merging into the next major version (v12.0) --- .../install/mysql/migration/10.0.0-11.0.0.sql | 4 --- .../install/mysql/migration/11.0.0-12.0.0.sql | 34 +++++++++++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 htdocs/install/mysql/migration/11.0.0-12.0.0.sql diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index d6e34030408..4bacfa9b765 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -545,7 +545,3 @@ ALTER TABLE llx_mrp_production ADD INDEX idx_mrp_production_fk_mo (fk_mo); ALTER TABLE llx_emailcollector_emailcollector ADD UNIQUE INDEX uk_emailcollector_emailcollector_ref(ref, entity); ALTER TABLE llx_website ADD COLUMN use_manifest integer; - -ALTER TABLE llx_bookmark DROP INDEX uk_bookmark_url; -ALTER TABLE llx_bookmark MODIFY COLUMN url TEXT; -- change from VARCHAR(255) to allow longer URLs -ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_title (fk_user, title); diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql new file mode 100644 index 00000000000..7062ac5d58b --- /dev/null +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -0,0 +1,34 @@ +-- +-- Be careful with the order of the requests. +-- This file must be loaded by calling /install/index.php page +-- when current version is 12.0.0 or higher. +-- +-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field); +-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table +-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex +-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres): +-- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid; +-- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid); +-- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq'); +-- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table; +-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL; +-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; +-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL; +-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL; +-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; +-- Note: fields with type BLOB/TEXT can't have a default value. + +-- Missing in v11 +ALTER TABLE llx_bookmark DROP INDEX uk_bookmark_url; +ALTER TABLE llx_bookmark MODIFY COLUMN url TEXT; -- change from VARCHAR(255) to allow longer URLs +ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_title (fk_user, title); + From 4333cf2040d6a1fd36968b20729d8a2733b965a2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Dec 2019 12:53:10 +0100 Subject: [PATCH 083/421] Show the stripe accoutn of a cu_ and a card_ --- htdocs/install/mysql/migration/11.0.0-12.0.0.sql | 2 +- htdocs/install/mysql/tables/llx_societe_rib.sql | 3 ++- htdocs/societe/class/companypaymentmode.class.php | 1 + htdocs/societe/paymentmodes.php | 8 ++++---- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 3ee1d145b3c..7436d8d8c3d 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -34,5 +34,5 @@ -- For v12 - +ALTER TABLE llx_societe_rib ADD COLUMN stripe_account varchar(128); diff --git a/htdocs/install/mysql/tables/llx_societe_rib.sql b/htdocs/install/mysql/tables/llx_societe_rib.sql index 45084179908..7d00d9fb1dd 100644 --- a/htdocs/install/mysql/tables/llx_societe_rib.sql +++ b/htdocs/install/mysql/tables/llx_societe_rib.sql @@ -28,7 +28,7 @@ create table llx_societe_rib fk_soc integer NOT NULL, datec datetime, tms timestamp, - + -- For BAN bank varchar(255), -- bank name code_banque varchar(128), -- bank code @@ -66,6 +66,7 @@ create table llx_societe_rib --For Stripe stripe_card_ref varchar(128), -- 'card_...' + stripe_account varchar(128), -- 'pk_live_...' comment varchar(255), ipaddress varchar(68), diff --git a/htdocs/societe/class/companypaymentmode.class.php b/htdocs/societe/class/companypaymentmode.class.php index aa0c083f4f7..781a25ac8c0 100644 --- a/htdocs/societe/class/companypaymentmode.class.php +++ b/htdocs/societe/class/companypaymentmode.class.php @@ -110,6 +110,7 @@ class CompanyPaymentMode extends CommonObject 'preapproval_key' =>array('type'=>'varchar(255)', 'label'=>'Preapproval key', 'enabled'=>1, 'visible'=>-2, 'position'=>160), 'total_amount_of_all_payments' =>array('type'=>'double(24,8)', 'label'=>'Total amount of all payments', 'enabled'=>1, 'visible'=>-2, 'position'=>165), 'stripe_card_ref' =>array('type'=>'varchar(128)', 'label'=>'Stripe card ref', 'enabled'=>1, 'visible'=>-2, 'position'=>170), + 'stripe_account' =>array('type'=>'varchar(128)', 'label'=>'Stripe account', 'enabled'=>1, 'visible'=>-2, 'position'=>171), 'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>175), 'starting_date' =>array('type'=>'date', 'label'=>'Starting date', 'enabled'=>1, 'visible'=>-2, 'position'=>180), 'ending_date' =>array('type'=>'date', 'label'=>'Ending date', 'enabled'=>1, 'visible'=>-2, 'position'=>185), diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 9bf2a40f069..52af815827f 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -847,7 +847,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $permissiontowrite = $user->rights->societe->creer; // Stripe customer key 'cu_....' stored into llx_societe_account print ''; - print $form->editfieldkey("StripeCustomerId", 'key_account', $stripecu, $object, $permissiontowrite, 'string', '', 0, 2, 'socid', 'Publishable key '.$site_account); + print $form->editfieldkey("StripeCustomerId", 'key_account', $stripecu, $object, $permissiontowrite, 'string', '', 0, 2, 'socid'); print ''; print $form->editfieldval("StripeCustomerId", 'key_account', $stripecu, $object, $permissiontowrite, 'string', '', null, null, '', 2, '', 'socid'); if (!empty($conf->stripe->enabled) && $stripecu && $action != 'editkey_account') @@ -859,7 +859,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { $url = 'https://dashboard.stripe.com/'.$connect.'customers/'.$stripecu; } - print ' '.img_picto($langs->trans('ShowInStripe'), 'globe').''; + print ' '.img_picto($langs->trans('ShowInStripe').' - Publishable key '.$site_account, 'globe').''; } print ''; if (empty($stripecu)) @@ -913,7 +913,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { $url = 'https://dashboard.stripe.com/connect/accounts/'.$stripesupplieracc; } - print ' '.img_picto($langs->trans('ShowInStripe'), 'globe').''; + print ' '.img_picto($langs->trans('ShowInStripe').' - Publishable key '.$site_account, 'globe').''; } print ''; if (empty($stripesupplieracc)) @@ -1065,7 +1065,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { $url = 'https://dashboard.stripe.com/'.$connect.'search?query='.$companypaymentmodetemp->stripe_card_ref; } - print ' '.img_picto($langs->trans('ShowInStripe'), 'globe').''; + print ' '.img_picto($langs->trans('ShowInStripe').' - Publishable key '.$companypaymentmodetemp->stripe_account, 'globe').''; } print ''; print ''; From 23b4e3ad6d601b25e3cb414bf8f95df39862b714 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 26 Dec 2019 09:50:15 +0100 Subject: [PATCH 084/421] FIX resolve conflicts --- htdocs/comm/propal/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index b5a0d1d72aa..b3d915e3985 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -273,7 +273,7 @@ $sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.c $sql.= " typent.code as typent_code,"; $sql.= " ava.rowid as availability,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; -$sql.= ' p.rowid, p.entity, p.note_private, p.note_public, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,'; +$sql .= " p.rowid, p.entity, p.note_private, p.note_public, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,"; $sql.= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,'; $sql.= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,"; $sql.= ' u.login'; @@ -764,8 +764,8 @@ if ($resql) $objectstatic->id=$obj->rowid; $objectstatic->ref=$obj->ref; - $objectstatic->note_private=$obj->note_private; - $objectstatic->note_public=$obj->note_public; + $objectstatic->note_private = $obj->note_private; + $objectstatic->note_public = $obj->note_public; $companystatic->id=$obj->socid; $companystatic->name=$obj->name; From bf1bf10a536d361e1a3c5097ec4b8c887ae36d13 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 26 Dec 2019 09:56:35 +0100 Subject: [PATCH 085/421] FIX resolve conflicts --- htdocs/comm/propal/list.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index b3d915e3985..1f462d6a205 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -269,14 +269,14 @@ $help_url='EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'; $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; -$sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; -$sql.= " typent.code as typent_code,"; -$sql.= " ava.rowid as availability,"; -$sql.= " state.code_departement as state_code, state.nom as state_name,"; +$sql .= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; +$sql .= " typent.code as typent_code,"; +$sql .= " ava.rowid as availability,"; +$sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " p.rowid, p.entity, p.note_private, p.note_public, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,"; -$sql.= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,'; -$sql.= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,"; -$sql.= ' u.login'; +$sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,'; +$sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,"; +$sql .= ' u.login'; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user"; if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc"; // Add fields from extrafields @@ -762,8 +762,8 @@ if ($resql) { $obj = $db->fetch_object($resql); - $objectstatic->id=$obj->rowid; - $objectstatic->ref=$obj->ref; + $objectstatic->id = $obj->rowid; + $objectstatic->ref = $obj->ref; $objectstatic->note_private = $obj->note_private; $objectstatic->note_public = $obj->note_public; From 046aba8abd7325962c0a1ca501a2ba00a05b8fab Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 26 Dec 2019 10:14:05 +0100 Subject: [PATCH 086/421] FIX indented errors --- htdocs/comm/propal/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 7716cf2a96e..e307d8727f4 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -764,8 +764,8 @@ if ($resql) $objectstatic->id = $obj->rowid; $objectstatic->ref = $obj->ref; - $objectstatic->note_private = $obj->note_private; - $objectstatic->note_public = $obj->note_public; + $objectstatic->note_private = $obj->note_private; + $objectstatic->note_public = $obj->note_public; $companystatic->id = $obj->socid; $companystatic->name = $obj->name; From ea4c236311527795128fea2552848b79bfb7b693 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Dec 2019 13:05:03 +0100 Subject: [PATCH 087/421] fix alignment --- htdocs/admin/defaultvalues.php | 4 ++-- htdocs/admin/translation.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index 8ddd453b458..29043720dee 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -193,14 +193,14 @@ $enabledisablehtml .= $langs->trans("EnableDefaultValues").' '; if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) { // Button off, click to enable - $enabledisablehtml .= ''; + $enabledisablehtml .= ''; $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off'); $enabledisablehtml .= ''; } else { // Button on, click to disable - $enabledisablehtml .= ''; + $enabledisablehtml .= ''; $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on'); $enabledisablehtml .= ''; } diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index c3b38ca7a45..5e98d7c5503 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -208,14 +208,14 @@ $enabledisablehtml .= $langs->trans("EnableOverwriteTranslation").' '; if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) { // Button off, click to enable - $enabledisablehtml .= ''; + $enabledisablehtml .= ''; $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off'); $enabledisablehtml .= ''; } else { // Button on, click to disable - $enabledisablehtml .= ''; + $enabledisablehtml .= ''; $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on'); $enabledisablehtml .= ''; } From ece8390277b289d123800cdc9be0b3756e5696ce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Dec 2019 13:23:18 +0100 Subject: [PATCH 088/421] Add tables to store translation of all objects (like llx_product_lang) --- htdocs/admin/ihm.php | 6 ++-- .../install/mysql/migration/11.0.0-12.0.0.sql | 19 ++++++++++++ .../mysql/tables/llx_object_lang.key.sql | 20 ++++++++++++ .../install/mysql/tables/llx_object_lang.sql | 31 +++++++++++++++++++ 4 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 htdocs/install/mysql/tables/llx_object_lang.key.sql create mode 100644 htdocs/install/mysql/tables/llx_object_lang.sql diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index fa83d5d4839..fc34171a3e5 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -83,7 +83,7 @@ if ($action == 'update') { dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["MAIN_LANG_DEFAULT"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV+1, 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["MAIN_MULTILANGS"], 'chaine', 0, '', $conf->entity); + //dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["MAIN_MULTILANGS"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"], 'chaine', 0, '', $conf->entity); @@ -241,13 +241,15 @@ print ''; // Default language print ''.$langs->trans("DefaultLanguage").''; print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300', 2); +print ''; print ''; print ' '; print ''; // Multilingual GUI print ''.$langs->trans("EnableMultilangInterface").''; -print $form->selectyesno('MAIN_MULTILANGS', $conf->global->MAIN_MULTILANGS, 1); +//print $form->selectyesno('MAIN_MULTILANGS', $conf->global->MAIN_MULTILANGS, 1); +print ajax_constantonoff('MAIN_MULTILANGS'); print ''; print ' '; print ''; diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 7436d8d8c3d..b0ecc2b9639 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -36,3 +36,22 @@ ALTER TABLE llx_societe_rib ADD COLUMN stripe_account varchar(128); + +create table llx_object_lang +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_object integer DEFAULT 0 NOT NULL, + type_object varchar(32) NOT NULL, -- 'thirdparty', 'contact', '...' + property varchar(32) NOT NULL, + lang varchar(5) DEFAULT 0 NOT NULL, + value text, + import_key varchar(14) DEFAULT NULL +)ENGINE=innodb; + + + +ALTER TABLE llx_object_lang ADD UNIQUE INDEX uk_object_lang (fk_object, type_object, property, lang); + + + + diff --git a/htdocs/install/mysql/tables/llx_object_lang.key.sql b/htdocs/install/mysql/tables/llx_object_lang.key.sql new file mode 100644 index 00000000000..31cda3c8bfa --- /dev/null +++ b/htdocs/install/mysql/tables/llx_object_lang.key.sql @@ -0,0 +1,20 @@ +-- ============================================================================ +-- Copyright (C) 2019 Laurent Destailleur +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ + + +ALTER TABLE llx_object_lang ADD UNIQUE INDEX uk_object_lang (fk_object, type_object, property, lang); diff --git a/htdocs/install/mysql/tables/llx_object_lang.sql b/htdocs/install/mysql/tables/llx_object_lang.sql new file mode 100644 index 00000000000..9bbc296d27c --- /dev/null +++ b/htdocs/install/mysql/tables/llx_object_lang.sql @@ -0,0 +1,31 @@ +-- ============================================================================ +-- Copyright (C) 2019 Laurent Destailleur +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ + + +-- Table to store some translations of values of objects + +create table llx_object_lang +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_object integer DEFAULT 0 NOT NULL, + type_object varchar(32) NOT NULL, -- 'thirdparty', 'contact', '...' + property varchar(32) NOT NULL, + lang varchar(5) DEFAULT 0 NOT NULL, + value text, + import_key varchar(14) DEFAULT NULL +)ENGINE=innodb; From 9c4d7044a3144b760c74f53546257fb983d0ccd5 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 26 Dec 2019 16:18:26 +0100 Subject: [PATCH 089/421] FIX sql bad request in product buying price extrafields --- htdocs/product/fournisseurs.php | 132 ++++++++++++++++++-------------- 1 file changed, 76 insertions(+), 56 deletions(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index bd93ef60a26..0abb57d8951 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -265,32 +265,31 @@ if (empty($reshook)) $extralabels = $extrafields->fetch_name_optionals_label("product_fournisseur_price"); $extrafield_values = $extrafields->getOptionalsFromPost("product_fournisseur_price"); + if (!empty($extrafield_values)) { + $resql = $db->query("SELECT fk_object FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields WHERE fk_object = " . $object->product_fourn_price_id); + // Insert a new extrafields row, if none exists + if ($db->num_rows($resql) != 1) { + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields (fk_object, "; + foreach ($extrafield_values as $key => $value) { + $sql .= str_replace('options_', '', $key) . ', '; + } + $sql = substr($sql, 0, strlen($sql) - 2) . ") VALUES (" . $object->product_fourn_price_id . ", "; + foreach ($extrafield_values as $key => $value) { + $sql .= '"' . $value . '", '; + } + $sql = substr($sql, 0, strlen($sql) - 2) . ')'; + } // else update the existing one + else { + $sql = "UPDATE " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields SET "; + foreach ($extrafield_values as $key => $value) { + $sql .= str_replace('options_', '', $key) . ' = "' . $value . '", '; + } + $sql = substr($sql, 0, strlen($sql) - 2) . ' WHERE fk_object = ' . $object->product_fourn_price_id; + } - $sql = ""; - $resql = $db->query("SELECT * FROM ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields WHERE fk_object = ".$object->product_fourn_price_id); - // Insert a new extrafields row, if none exists - if ($db->num_rows($resql) != 1) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields (fk_object, "; - foreach ($extrafield_values as $key => $value) { - $sql .= str_replace('options_', '', $key).', '; - } - $sql = substr($sql, 0, strlen($sql) - 2).") VALUES (".$object->product_fourn_price_id.", "; - foreach ($extrafield_values as $key => $value) { - $sql .= '"'.$value.'", '; - } - $sql = substr($sql, 0, strlen($sql) - 2).')'; - } - // else update the existing one - else { - $sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields SET "; - foreach ($extrafield_values as $key => $value) { - $sql .= str_replace('options_', '', $key).' = "'.$value.'", '; - } - $sql = substr($sql, 0, strlen($sql) - 2).' WHERE fk_object = '.$object->product_fourn_price_id; - } - - // Execute the sql command from above - $db->query($sql); + // Execute the sql command from above + $db->query($sql); + } $newprice = price2num(GETPOST("price", "alpha")); @@ -765,25 +764,36 @@ SCRIPT; print ''; } + // Extrafields $extrafields->fetch_name_optionals_label("product_fournisseur_price"); $extralabels = $extrafields->attributes["product_fournisseur_price"]['label']; - // Extrafields - $resql = $db->query("SELECT * FROM ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields WHERE fk_object = ".$rowid); + $extrafield_values = $extrafields->getOptionalsFromPost("product_fournisseur_price"); if (!empty($extralabels)) { - if ($db->num_rows($resql) != 1) { - foreach ($extralabels as $key => $value) { - if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && ($extrafields->attributes["product_fournisseur_price"]['list'][$key] == 1 || $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 3 || ($action == "update_price" && $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 4))) { - print 'attributes["product_fournisseur_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>'.$langs->trans($value).''.$extrafields->showInputField($key, '', '', '', '', '', 0, 'product_fournisseur_price').''; - } - } - } else { - $resql = $db->fetch_object($resql); - foreach ($extralabels as $key => $value) { - if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && ($extrafields->attributes["product_fournisseur_price"]['list'][$key] == 1 || $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 3 || ($action == "update_price" && $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 4))) { - print 'attributes["product_fournisseur_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>'.$langs->trans($value).''.$extrafields->showInputField($key, $resql->{$key}, '', '', '', '', 0, 'product_fournisseur_price').''; - } - } - } + if (empty($rowid)) { + foreach ($extralabels as $key => $value) { + if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && ($extrafields->attributes["product_fournisseur_price"]['list'][$key] == 1 || $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 3 || ($action == "update_price" && $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 4))) { + print 'attributes["product_fournisseur_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>'.$langs->trans($value).''.$extrafields->showInputField($key, GETPOSTISSET('options_' . $key) ? $extrafield_values['options_' . $key] : '', '', '', '', '', 0, 'product_fournisseur_price').''; + } + } + } else { + $sql = "SELECT"; + $sql .= " fk_object"; + foreach ($extralabels as $key => $value) { + $sql .= ", " . $key; + } + $sql .= " FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields"; + $sql .= " WHERE fk_object = " . $rowid; + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + foreach ($extralabels as $key => $value) { + if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && ($extrafields->attributes["product_fournisseur_price"]['list'][$key] == 1 || $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 3 || ($action == "update_price" && $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 4))) { + print 'attributes["product_fournisseur_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>'.$langs->trans($value).''.$extrafields->showInputField($key, GETPOSTISSET('options_' . $key) ? $extrafield_values['options_' . $key] : $obj->{$key}, '', '', '', '', 0, 'product_fournisseur_price').''; + } + } + $db->free($resql); + } + } } if (is_object($hookmanager)) @@ -1008,22 +1018,32 @@ SCRIPT; print ''; // Extrafields - $resql = $db->query("SELECT * FROM ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields WHERE fk_object = ".$productfourn->product_fourn_price_id); if (!empty($extralabels)) { - if ($db->num_rows($resql) != 1) { - foreach ($extralabels as $key => $value) { - if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) { - print ""; - } - } - } else { - $resql = $db->fetch_object($resql); - foreach ($extralabels as $key => $value) { - if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) { - print ''.$extrafields->showOutputField($key, $resql->{$key}).""; - } - } - } + $sql = "SELECT"; + $sql .= " fk_object"; + foreach ($extralabels as $key => $value) { + $sql .= ", " . $key; + } + $sql .= " FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields"; + $sql .= " WHERE fk_object = " . $productfourn->product_fourn_price_id; + $resql = $db->query($sql); + if ($resql) { + if ($db->num_rows($resql) != 1) { + foreach ($extralabels as $key => $value) { + if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) { + print ""; + } + } + } else { + $obj = $db->fetch_object($resql); + foreach ($extralabels as $key => $value) { + if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) { + print ''.$extrafields->showOutputField($key, $obj->{$key}).""; + } + } + } + $db->free($resql); + } } if (is_object($hookmanager)) From 0b6124f804ca1a2c6617757b2c5afe612080c2c7 Mon Sep 17 00:00:00 2001 From: Manu Bryk Date: Fri, 27 Dec 2019 00:11:49 +0100 Subject: [PATCH 090/421] New Ref more visible when create a ticket When customers call support to trace a ticket, they don't have easily ref of the ticket. Add Ref to the subject of mail for customers and for TICKET_NOTIFICATION_EMAIL_TO. Add ref also to the notification message when customers create a new ticket. --- htdocs/langs/en_US/ticket.lang | 6 +++--- htdocs/public/ticket/create_ticket.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 79c4978b660..a565ecb59b8 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -251,9 +251,9 @@ ShowListTicketWithTrackId=Display ticket list from track ID ShowTicketWithTrackId=Display ticket from track ID TicketPublicDesc=You can create a support ticket or check from an existing ID. YourTicketSuccessfullySaved=Ticket has been successfully saved! -MesgInfosPublicTicketCreatedWithTrackId=A new ticket has been created with ID %s. +MesgInfosPublicTicketCreatedWithTrackId=A new ticket has been created with ID %s and Ref %s. PleaseRememberThisId=Please keep the tracking number that we might ask you later. -TicketNewEmailSubject=Ticket creation confirmation +TicketNewEmailSubject=Ticket creation confirmation - Ref %s TicketNewEmailSubjectCustomer=New support ticket TicketNewEmailBody=This is an automatic email to confirm you have registered a new ticket. TicketNewEmailBodyCustomer=This is an automatic email to confirm a new ticket has just been created into your account. @@ -272,7 +272,7 @@ Subject=Subject ViewTicket=View ticket ViewMyTicketList=View my ticket list ErrorEmailMustExistToCreateTicket=Error: email address not found in our database -TicketNewEmailSubjectAdmin=New ticket created +TicketNewEmailSubjectAdmin=New ticket created - Ref %s TicketNewEmailBodyAdmin=

Ticket has just been created with ID #%s, see information:

SeeThisTicketIntomanagementInterface=See ticket in management interface TicketPublicInterfaceForbidden=The public interface for the tickets was not enabled diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index b69d28f0cb0..c4a3b71e6ad 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -203,7 +203,7 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) { // Send email to customer - $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubject'); + $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubject', $object->ref); $message .= ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody'))."\n\n"; $message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket')."\n"; @@ -245,7 +245,7 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) { if ($sendto) { - $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin'); + $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin', $object->ref); $message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id)."\n\n"; $message_admin .= '