From b01369a32ea5c89d212149d2551f19caf412b743 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Apr 2015 15:25:24 +0200 Subject: [PATCH 01/24] Error management --- htdocs/core/class/stats.class.php | 45 +++++++++++++++++-------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index 8a4ffd29d68..ff9f29f55ff 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -31,7 +31,7 @@ abstract class Stats { protected $db; var $_lastfetchdate=array(); // Dates of cache file read by methods - var $cachefilesuffix=''; // Suffix to add to name of cache file (to avoid file name conflicts) + var $cachefilesuffix=''; // Suffix to add to name of cache file (to avoid file name conflicts) /** * Return nb of elements by month for several years @@ -76,7 +76,7 @@ abstract class Stats dol_syslog(get_class($this).'::'.__FUNCTION__." cache file ".$newpathofdestfile." is not found or older than now - cachedelay (".$nowgmt." - ".$cachedelay.") so we can't use it."); } } - + // Load file into $data if ($foundintocache) // Cache file found and is not too old { @@ -203,11 +203,14 @@ abstract class Stats dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk."); if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp); $fp = fopen($newpathofdestfile, 'w'); - fwrite($fp, json_encode($data)); - fclose($fp); - if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; - @chmod($newpathofdestfile, octdec($newmask)); - + if ($fp) + { + fwrite($fp, json_encode($data)); + fclose($fp); + if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; + @chmod($newpathofdestfile, octdec($newmask)); + } + else dol_syslog("Failed to write cache file", LOG_ERR); $this->_lastfetchdate[get_class($this).'_'.__FUNCTION__]=$nowgmt; } @@ -309,21 +312,23 @@ abstract class Stats dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk."); if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp); $fp = fopen($newpathofdestfile, 'w'); - fwrite($fp, json_encode($data)); - fclose($fp); - if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; - @chmod($newpathofdestfile, octdec($newmask)); - + if ($fp) + { + fwrite($fp, json_encode($data)); + fclose($fp); + if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; + @chmod($newpathofdestfile, octdec($newmask)); + } $this->_lastfetchdate[get_class($this).'_'.__FUNCTION__]=$nowgmt; } return $data; - } - - + } + + // Here we have low level of shared code called by XxxStats.class.php - + /** * Return nb of elements by year * @@ -532,8 +537,8 @@ abstract class Stats return $data; } - - + + /** * Return number or total of product refs * @@ -544,7 +549,7 @@ abstract class Stats function _getAllByProduct($sql, $limit=10) { global $langs; - + $result=array(); $res=array(); @@ -567,6 +572,6 @@ abstract class Stats else dol_print_error($this->db); return $result; - } + } } From 2dfaf08f6188400038fb6ee32f7d6f67eeba545c Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 7 Apr 2015 18:54:38 +0200 Subject: [PATCH 02/24] Closes #2545 Bug: Missing object_margin.png in Amarok theme Conflicts: ChangeLog --- ChangeLog | 4 ++++ htdocs/theme/amarok/img/object_margin.png | Bin 0 -> 579 bytes 2 files changed, 4 insertions(+) create mode 100644 htdocs/theme/amarok/img/object_margin.png diff --git a/ChangeLog b/ChangeLog index 456f58e3d60..22a6f55fda4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -209,6 +209,10 @@ Dolibarr better: - Fix: Bad SEPA xml file creation - Fix: [ bug #1892 ] PHP Fatal error when using USER_UPDATE_SESSION trigger and adding a supplier invoice payment - Fix: Showing system error if not enough stock of product into orders creation with lines +- Fix: [ bug #2543 ] Untranslated "Contract" origin string when creating an invoice from a contract +- Fix: [ bug #2534 ] SQL error when editing a supplier invoice line +- Fix: [ bug #2535 ] Untranslated string in "Linked objects" page of a project +- Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/theme/amarok/img/object_margin.png b/htdocs/theme/amarok/img/object_margin.png new file mode 100644 index 0000000000000000000000000000000000000000..13e4b92c9ce2e0a3698d31fcfc2b82704653f7a0 GIT binary patch literal 579 zcmV-J0=)f+P)AcnU72+nI~k7O&wbPhKp(25S7yLez;ORgKES18>^qZMxkS#t4;4mP!Tkxe+YuKR~p# z$@oMS%NT}+&HxFcfQVpOE|z7b`l*-e*o5sSUdH9q`!{4z zY}=+hGKO=k6tl2Go9vMSK*{xkcH6fG93;^_SAQs`< z{(cHnFI|}=th_KaaqN?Qc zCjh-}k1uO$6!RW|XLIq=Wef@DrfbBaWOD(c3Aube1@!k|XJ_aB{QRpKpjs>h)nXxF zV!T4J5a9bh)6?g%EknKjAqAw@>R4{yeRvJ19-WzA_asS(wl*I>ee~caz)y}P@RPTh R<>vqZ002ovPDHLkV1h?{2Q~lz literal 0 HcmV?d00001 From 1ab70a70869575a9aa5a874ce46c781b0c353dfb Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 7 Apr 2015 20:05:56 +0200 Subject: [PATCH 03/24] Solves #2542 Bug: Contracts store localtax preferences Conflicts: htdocs/compta/facture.php --- ChangeLog | 1 + htdocs/compta/facture.php | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 22a6f55fda4..619cae68ef4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -213,6 +213,7 @@ Dolibarr better: - Fix: [ bug #2534 ] SQL error when editing a supplier invoice line - Fix: [ bug #2535 ] Untranslated string in "Linked objects" page of a project - Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme +- Fix: [ bug #2542 ] Contracts store localtax preferences ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 87cbbec398b..903844ece09 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2015 Juanjo Menent * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2013 Jean-Francois FERRY * Copyright (C) 2013-2014 Florian Henry @@ -1045,8 +1045,12 @@ if (empty($reshook)) $lines[$i]->fetch_optionals($lines[$i]->rowid); $array_option = $lines[$i]->array_options; } + + // View third's localtaxes for now + $localtax1_tx = get_localtax($lines[$i]->tva_tx, 1, $object->client); + $localtax2_tx = get_localtax($lines[$i]->tva_tx, 2, $object->client); - $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_option); + $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $localtax1_tx, $localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_option); if ($result > 0) { $lineid = $result; From d7ba9b3312ae22df2b7f0b4fbabdf38e3d948714 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 7 Apr 2015 20:40:48 +0200 Subject: [PATCH 04/24] Fix: Bad permission assignments for stock movements actions Conflicts: htdocs/core/menus/standard/eldy.lib.php htdocs/product/stock/mouvement.php --- ChangeLog | 1 + htdocs/core/menus/init_menu_auguria.sql | 4 ++-- htdocs/core/menus/standard/eldy.lib.php | 6 +++--- htdocs/product/stock/mouvement.php | 3 ++- htdocs/product/stock/product.php | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 619cae68ef4..61ef5f890d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -214,6 +214,7 @@ Dolibarr better: - Fix: [ bug #2535 ] Untranslated string in "Linked objects" page of a project - Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme - Fix: [ bug #2542 ] Contracts store localtax preferences +- Fix: Bad permission assignments for stock movements actions ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index e550a20ad5f..a020f607acc 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -103,8 +103,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3101__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/card.php?action=create', 'MenuNewWarehouse', 1, 'stocks', '$user->rights->stock->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3102__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/list.php', 'List', 1, 'stocks', '$user->rights->stock->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3104__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/mouvement.php', 'Movements', 1, 'stocks', '$user->rights->stock->mouvement->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3105__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/replenish.php', 'Replenishments', 1, 'stocks', '$user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php', 'StockTransfer', 1, 'stocks', '$user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3105__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/replenish.php', 'Replenishments', 1, 'stocks', '$user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php', 'StockTransfer', 1, 'stocks', '$user->rights->stock->mouvement->creer', '', 2, 5, __ENTITY__); -- Product - Categories insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3200__+MAX_llx_menu__, 'products', 'cat', 3__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=0', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index c88c8375a41..6b94b251d50 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1,7 +1,7 @@ * Copyright (C) 2010 Regis Houssin - * Copyright (C) 2012-2014 Juanjo Menent + * Copyright (C) 2012-2015 Juanjo Menent * Copyright (C) 2013 Cédric Salvador * * This program is free software; you can redistribute it and/or modify @@ -1061,8 +1061,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer); $newmenu->add("/product/stock/list.php", $langs->trans("List"), 1, $user->rights->stock->lire); $newmenu->add("/product/stock/mouvement.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire); - if ($conf->fournisseur->enabled) $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire); - if ($conf->fournisseur->enabled) $newmenu->add("/product/stock/massstockmove.php", $langs->trans("StockTransfer"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire); + if ($conf->fournisseur->enabled) $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire); + $newmenu->add("/product/stock/massstockmove.php", $langs->trans("StockTransfer"), 1, $user->rights->stock->mouvement->creer); } // Expeditions diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 83d856ed0cc..177d8c5e0b3 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2006 Rodolphe Quiedeville * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2014 Regis Houssin + * Copyright (C) 2015 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -387,7 +388,7 @@ if ($resql) { print "
\n"; - if ($user->rights->stock->creer) + if ($user->rights->stock->mouvement->creer) { print ''.$langs->trans("StockCorrection").''; } diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 9bc0cd6f9c3..6dad4256aef 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2013-2015 Juanjo Menent * Copyright (C) 2014 Cédric Gross * * This program is free software; you can redistribute it and/or modify @@ -646,7 +646,7 @@ if (empty($action) && $product->id) { print "
\n"; - if ($user->rights->stock->creer) + if ($user->rights->stock->mouvement->creer) { print ''.$langs->trans("StockCorrection").''; } From 856238c8760c5cc306b471172b52d38c7cd3eced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 8 Apr 2015 09:09:11 +0200 Subject: [PATCH 05/24] Accounts "from" & "to" need to have same currency --- htdocs/compta/bank/virement.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/virement.php b/htdocs/compta/bank/virement.php index 5583edbe357..0c2c62c052f 100644 --- a/htdocs/compta/bank/virement.php +++ b/htdocs/compta/bank/virement.php @@ -79,7 +79,7 @@ if ($action == 'add') $accountto=new Account($db); $accountto->fetch(GETPOST('account_to','int')); - if ($accountto->id != $accountfrom->id) + if (($accountto->id != $accountfrom->id) && ($accountto->currency_code == $accountfrom->currency_code)) { $db->begin(); From 7f62892609edd60c32ca7536c059275cc4a19564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 8 Apr 2015 09:19:41 +0200 Subject: [PATCH 06/24] Display total with currency code --- htdocs/compta/bank/treso.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 91c41aa5e3c..292742315bb 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -329,8 +329,8 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) // Solde actuel $var=!$var; print ''; - print ''.$langs->trans("FutureBalance").''; - print ''.price($solde).''; + print ''.$langs->trans("FutureBalance").' ('.$acct->currency_code.')'; + print ''.price($solde, 0, $langs, 0, 0, -1, $acct->currency_code).''; print ''; print ""; From 94087f539f09576e9afdaec1956e2359641366ec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 11:50:40 +0200 Subject: [PATCH 07/24] Fix style --- htdocs/fourn/commande/card.php | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 995c493df51..33b5eaf79e3 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -950,40 +950,40 @@ if (empty($reshook)) if (empty($lines[$i]->subprice) || $lines[$i]->qty <= 0) continue; - $label = (! empty($lines [$i]->label) ? $lines [$i]->label : ''); - $desc = (! empty($lines [$i]->desc) ? $lines [$i]->desc : $lines [$i]->libelle); - $product_type = (! empty($lines [$i]->product_type) ? $lines [$i]->product_type : 0); + $label = (! empty($lines[$i]->label) ? $lines[$i]->label : ''); + $desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : $lines[$i]->libelle); + $product_type = (! empty($lines[$i]->product_type) ? $lines[$i]->product_type : 0); // Reset fk_parent_line for no child products and special product - if (($lines [$i]->product_type != 9 && empty($lines [$i]->fk_parent_line)) || $lines [$i]->product_type == 9) { + if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) { $fk_parent_line = 0; } // Extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines [$i], 'fetch_optionals')) // For avoid conflicts if + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if // trigger used { - $lines [$i]->fetch_optionals($lines [$i]->rowid); - $array_option = $lines [$i]->array_options; + $lines[$i]->fetch_optionals($lines[$i]->rowid); + $array_option = $lines[$i]->array_options; } - $idprod = $productsupplier->find_min_price_product_fournisseur($lines [$i]->fk_product, $lines [$i]->qty); + $idprod = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty); $res = $productsupplier->fetch($idProductFourn); $result = $object->addline( $desc, - $lines [$i]->subprice, - $lines [$i]->qty, - $lines [$i]->tva_tx, - $lines [$i]->localtax1_tx, - $lines [$i]->localtax2_tx, - $lines [$i]->fk_product, + $lines[$i]->subprice, + $lines[$i]->qty, + $lines[$i]->tva_tx, + $lines[$i]->localtax1_tx, + $lines[$i]->localtax2_tx, + $lines[$i]->fk_product, $productsupplier->product_fourn_price_id, $productsupplier->ref_fourn, - $lines [$i]->remise_percent, + $lines[$i]->remise_percent, 'HT', 0, - $lines [$i]->product_type, + $lines[$i]->product_type, '', '', null, @@ -996,7 +996,7 @@ if (empty($reshook)) } // Defined the new fk_parent_line - if ($result > 0 && $lines [$i]->product_type == 9) { + if ($result > 0 && $lines[$i]->product_type == 9) { $fk_parent_line = $result; } } From 17fa1ce5b6b5263108d0d91186f83cef1e88ddff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 12:22:52 +0200 Subject: [PATCH 08/24] Fix #2552 --- htdocs/langs/en_US/errors.lang | 2 + htdocs/product/fournisseurs.php | 119 +++++++++++++++++--------------- 2 files changed, 64 insertions(+), 57 deletions(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 37670b7f003..6a7da2d3ece 100755 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -167,6 +167,8 @@ ErrorGlobalVariableUpdater2=Missing parameter '%s' ErrorGlobalVariableUpdater3=The requested data was not found in result ErrorGlobalVariableUpdater4=SOAP client failed with error '%s' ErrorGlobalVariableUpdater5=No global variable selected +ErrorFieldMustBeANumeric=Field %s must be a numeric value +ErrorFieldMustBeAnInteger=Field %s must be an integer # Warnings WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index f35e6628ad6..2d0b9a81576 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -43,6 +43,7 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $rowid=GETPOST('rowid','int'); $action=GETPOST('action', 'alpha'); +$cancel=GETPOST('cancel', 'alpha'); $socid=GETPOST('socid', 'int'); $backtopage=GETPOST('backtopage','alpha'); $error=0; @@ -77,6 +78,8 @@ if (! $sortorder) $sortorder="ASC"; * Actions */ +if ($cancel) $action=''; + $parameters=array('socid'=>$socid, 'id_prod'=>$id); $reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -97,59 +100,70 @@ if (empty($reshook)) } } -if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel")) -{ - $id_fourn=GETPOST("id_fourn"); - if (empty($id_fourn)) $id_fourn=GETPOST("search_id_fourn"); - $ref_fourn=GETPOST("ref_fourn"); - if (empty($ref_fourn)) $ref_fourn=GETPOST("search_ref_fourn"); - $quantity=GETPOST("qty"); - $remise_percent=price2num(GETPOST('remise_percent','alpha')); - $npr = preg_match('/\*/', $_POST['tva_tx']) ? 1 : 0 ; - $tva_tx = str_replace('*','', GETPOST('tva_tx','alpha')); - $tva_tx = price2num($tva_tx); - $price_expression = GETPOST('eid', 'int') ? GETPOST('eid', 'int') : ''; // Discard expression if not in expression mode - $delivery_time_days = GETPOST('delivery_time_days', 'int') ? GETPOST('delivery_time_days', 'int') : ''; + if ($action == 'updateprice') + { + $id_fourn=GETPOST("id_fourn"); + if (empty($id_fourn)) $id_fourn=GETPOST("search_id_fourn"); + $ref_fourn=GETPOST("ref_fourn"); + if (empty($ref_fourn)) $ref_fourn=GETPOST("search_ref_fourn"); + $quantity=GETPOST("qty"); + $remise_percent=price2num(GETPOST('remise_percent','alpha')); + $npr = preg_match('/\*/', $_POST['tva_tx']) ? 1 : 0 ; + $tva_tx = str_replace('*','', GETPOST('tva_tx','alpha')); + $tva_tx = price2num($tva_tx); + $price_expression = GETPOST('eid', 'int') ? GETPOST('eid', 'int') : ''; // Discard expression if not in expression mode + $delivery_time_days = GETPOST('delivery_time_days', 'int') ? GETPOST('delivery_time_days', 'int') : ''; - if ($tva_tx == '') - { - $error++; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("VATRateForSupplierProduct")), 'errors'); - } - if (empty($quantity)) - { - $error++; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Qty")), 'errors'); - } - if (empty($ref_fourn)) - { - $error++; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("RefSupplier")), 'errors'); - } - if ($id_fourn <= 0) - { - $error++; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Supplier")), 'errors'); - } - if ($_POST["price"] < 0 || $_POST["price"] == '') - { - if ($price_expression === '') // Return error of missing price only if price_expression not set + if ($tva_tx == '') { $error++; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Price")), 'errors'); + $langs->load("errors"); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("VATRateForSupplierProduct")), 'errors'); } - else + if (! is_numeric($tva_tx)) { - $_POST["price"] = 0; + $error++; + $langs->load("errors"); + setEventMessage($langs->trans("ErrorFieldMustBeANumeric",'eeee'), 'errors'); + } + if (empty($quantity)) + { + $error++; + $langs->load("errors"); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Qty")), 'errors'); + } + if (empty($ref_fourn)) + { + $error++; + $langs->load("errors"); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("RefSupplier")), 'errors'); + } + if ($id_fourn <= 0) + { + $error++; + $langs->load("errors"); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Supplier")), 'errors'); + } + if ($_POST["price"] < 0 || $_POST["price"] == '') + { + if ($price_expression === '') // Return error of missing price only if price_expression not set + { + $error++; + $langs->load("errors"); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Price")), 'errors'); + } + else + { + $_POST["price"] = 0; + } } - } $product = new ProductFournisseur($db); $result=$product->fetch($id); if ($result <= 0) { $error++; - setEventMessage($product->error, 'errors'); + setEventMessages($product->error, $product->errors, 'errors'); } if (! $error) @@ -222,13 +236,10 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel")) $db->rollback(); } } - } - - if (GETPOST('cancel') == $langs->trans("Cancel")) - { - $action = ''; - header("Location: fournisseurs.php?id=".$_GET["id"]); - exit; + else + { + $action = 'add_price'; + } } } @@ -253,10 +264,6 @@ if ($id || $ref) { if ($action <> 'edit' && $action <> 're-edit') { - /* - * En mode visu - */ - $head=product_prepare_head($product); $titre=$langs->trans("CardProduct".$product->type); $picto=($product->type== Product::TYPE_SERVICE?'service':'product'); @@ -325,6 +332,8 @@ if ($id || $ref) print ''; print ''; print ''; + print ''; + print ''; } else { @@ -487,11 +496,7 @@ if ($id || $ref) print ''; } - /* ************************************************************************** */ - /* */ - /* Barre d'action */ - /* */ - /* ************************************************************************** */ + // Actions buttons print "\n
\n"; From 1efa5bcabdd1a6c5eaab13e863afa3db52589c04 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 12:44:11 +0200 Subject: [PATCH 09/24] Fix: Avoid duplicate tooltip --- .../fourn/class/fournisseur.product.class.php | 18 +++++++++++------- htdocs/product/list.php | 7 +++++-- htdocs/societe/class/societe.class.php | 2 +- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index adc1f3a50fc..8f839b08452 100755 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -631,17 +631,19 @@ class ProductFournisseur extends Product /** * Display supplier of product * - * @param int $withpicto Add picto - * @param string $option Target of link ('', 'customer', 'prospect', 'supplier') - * @return string String with supplier price + * @param int $withpicto Add picto + * @param string $option Target of link ('', 'customer', 'prospect', 'supplier') + * @param int $maxlen Max length of name + * @param integer $notooltip 1=Disable tooltip + * @return string String with supplier price * TODO Remove this method. Use getNomUrl directly. */ - function getSocNomUrl($withpicto=0,$option='supplier') + function getSocNomUrl($withpicto=0,$option='supplier',$maxlen=0,$notooltip=0) { $thirdparty = new Fournisseur($this->db); $thirdparty->fetch($this->fourn_id); - return $thirdparty->getNomUrl($withpicto,$option); + return $thirdparty->getNomUrl($withpicto,$option,$maxlen,$notooltip); } /** @@ -649,13 +651,15 @@ class ProductFournisseur extends Product * * @param int $showunitprice Show "Unit price" into output string * @param int $showsuptitle Show "Supplier" into output string + * @param int $maxlen Max length of name + * @param integer $notooltip 1=Disable tooltip * @return string String with supplier price */ - function display_price_product_fournisseur($showunitprice=1,$showsuptitle=1) + function display_price_product_fournisseur($showunitprice=1,$showsuptitle=1,$maxlen=0,$notooltip=0) { global $langs; $langs->load("suppliers"); - $out=($showunitprice?price($this->fourn_unitprice).' '.$langs->trans("HT").'   (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1, 'supplier').' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':''); + $out=($showunitprice?price($this->fourn_unitprice).' '.$langs->trans("HT").'   (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':''); return $out; } diff --git a/htdocs/product/list.php b/htdocs/product/list.php index f9503778411..ededdbaff01 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -476,8 +476,11 @@ else { if ($product_fourn->product_fourn_price_id > 0) { - $htmltext=$product_fourn->display_price_product_fournisseur(); - if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) print $form->textwithpicto(price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"),$htmltext); + if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) + { + $htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1); + print $form->textwithpicto(price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"),$htmltext); + } else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"); } } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 7e2bdeef3a6..7f8df5ed810 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1727,7 +1727,7 @@ class Societe extends CommonObject * * @param int $withpicto Add picto into link (0=No picto, 1=Include picto with link, 2=Picto only) * @param string $option Target of link ('', 'customer', 'prospect', 'supplier') - * @param int $maxlen Max length of text + * @param int $maxlen Max length of name * @param integer $notooltip 1=Disable tooltip * @return string String with URL */ From b3355df3bf7f3215b237bf140372d1abfb34e2f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 13:00:03 +0200 Subject: [PATCH 10/24] Fix delivery delay could not be set to unknown --- htdocs/fourn/class/fournisseur.product.class.php | 14 +++++++------- htdocs/fourn/commande/card.php | 2 +- htdocs/product/fournisseurs.php | 13 +++++++------ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 8f839b08452..280ea8cec2e 100755 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -154,7 +154,7 @@ class ProductFournisseur extends Product * @param float $remise_percent Discount regarding qty (percent) * @param float $remise Discount regarding qty (amount) * @param int $newnpr Set NPR or not - * @param int $delivery_time_days Delay in days for delivery (max) + * @param int $delivery_time_days Delay in days for delivery (max). May be '' if not defined. * @return int <0 if KO, >=0 if OK */ function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0, $delivery_time_days=0) @@ -167,7 +167,7 @@ class ProductFournisseur extends Product if (empty($charges)) $charges=0; if (empty($availability)) $availability=0; if (empty($remise_percent)) $remise_percent=0; - if (empty($delivery_time_days)) $delivery_time_days=0; + if ($delivery_time_days != '' && ! is_numeric($delivery_time_days)) $delivery_time_days = ''; if ($price_base_type == 'TTC') { //$ttx = get_default_tva($fourn,$mysoc,$this->id); // We must use the VAT rate defined by user and not calculate it @@ -202,7 +202,7 @@ class ProductFournisseur extends Product $sql.= " entity = ".$conf->entity.","; $sql.= " info_bits = ".$newnpr.","; $sql.= " charges = ".$charges.","; - $sql.= " delivery_time_days = ".$delivery_time_days; + $sql.= " delivery_time_days = ".($delivery_time_days != '' ? $delivery_time_days : 'null'); $sql.= " WHERE rowid = ".$this->product_fourn_price_id; // TODO Add price_base_type and price_ttc @@ -437,16 +437,16 @@ class ProductFournisseur extends Product $prodfourn->fourn_remise_percent = $record["remise_percent"]; $prodfourn->fourn_remise = $record["remise"]; $prodfourn->fourn_unitprice = $record["unitprice"]; - $prodfourn->fourn_charges = $record["charges"]; - $prodfourn->fourn_unitcharges = $record["unitcharges"]; + $prodfourn->fourn_charges = $record["charges"]; + $prodfourn->fourn_unitcharges = $record["unitcharges"]; $prodfourn->fourn_tva_tx = $record["tva_tx"]; $prodfourn->fourn_id = $record["fourn_id"]; $prodfourn->fourn_name = $record["supplier_name"]; $prodfourn->fk_availability = $record["fk_availability"]; $prodfourn->delivery_time_days = $record["delivery_time_days"]; $prodfourn->id = $prodid; - $prodfourn->fourn_tva_npr = $record["info_bits"]; - $prodfourn->fk_supplier_price_expression = $record["fk_supplier_price_expression"]; + $prodfourn->fourn_tva_npr = $record["info_bits"]; + $prodfourn->fk_supplier_price_expression = $record["fk_supplier_price_expression"]; if (!empty($prodfourn->fk_supplier_price_expression)) { $priceparser = new PriceParser($this->db); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 33b5eaf79e3..b1d20b72371 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1911,7 +1911,7 @@ elseif (! empty($object->id)) print ''; - // Delai livraison jours + // Delivery delay (in days) print ''; print ''.$langs->trans('NbDaysToDelivery').' '.img_picto($langs->trans('DescNbDaysToDelivery'), 'info', 'style="cursor:help"').''; print ''.$object->getMaxDeliveryTimeDay($langs).''; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 2d0b9a81576..9d7a9215ef1 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -201,7 +201,7 @@ if (empty($reshook)) { $error++; - setEventMessage($product->error, 'errors'); + setEventMessage($product->error, $product->errors, 'errors'); } else { @@ -528,13 +528,9 @@ if ($id || $ref) print_liste_field_titre($langs->trans("QtyMin"),$_SERVER["PHP_SELF"],"pfp.quantity","",$param,'align="right"',$sortfield,$sortorder); print ''.$langs->trans("VATRate").''; print ''.$langs->trans("PriceQtyMinHT").''; - // Charges ???? - if ($conf->global->PRODUCT_CHARGES) - { - if (! empty($conf->margin->enabled)) print ''.$langs->trans("Charges").''; - } print_liste_field_titre($langs->trans("UnitPriceHT"),$_SERVER["PHP_SELF"],"pfp.unitprice","",$param,'align="right"',$sortfield,$sortorder); print ''.$langs->trans("DiscountQtyMin").''; + print_liste_field_titre($langs->trans("NbDaysToDelivery"),$_SERVER["PHP_SELF"],"pfp.delivery_time_days","",$param,'align="right"',$sortfield,$sortorder); // Charges ???? if ($conf->global->PRODUCT_CHARGES) { @@ -606,6 +602,11 @@ if ($id || $ref) print price2num($productfourn->fourn_remise_percent).'%'; print ''; + // Delivery delay + print ''; + print $productfourn->delivery_time_days; + print ''; + // Charges ???? if ($conf->global->PRODUCT_CHARGES) { From fc803e70008a6cc7a59655a05ea5310e85f99997 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 17:33:38 +0200 Subject: [PATCH 11/24] Fix permission lost when enabled/disabled module. --- htdocs/admin/supplier_order.php | 46 +++++++------------- htdocs/core/modules/modFournisseur.class.php | 20 +++++++++ htdocs/fourn/commande/card.php | 2 +- 3 files changed, 36 insertions(+), 32 deletions(-) diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 5a3c3808201..b7c7d3b5c3d 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -182,43 +182,27 @@ else if ($action == 'set_SUPPLIER_ORDER_OTHER') $res3=1; }*/ - // TODO We add/delete permission until permission can have a condition on a global var - $r_id = 1190; - $entity = $conf->entity; - $r_desc=$langs->trans("Permission1190"); - $r_modul='fournisseur'; - $r_type='w'; - $r_perms='commande'; - $r_subperms='approve2'; - $r_def=0; + // TODO We add/delete permission here until permission can have a condition on a global var + include_once DOL_DOCUMENT_ROOT.'/core/modules/modFournisseur.class.php'; + $newmodule=new modFournisseur($db); + // clear default rights array + $newmodule->rights=array(); + // add new right + $r=0; + $newmodule->rights[$r][0] = 1190; + $newmodule->rights[$r][1] = $langs->trans("Permission1190"); + $newmodule->rights[$r][2] = 'w'; + $newmodule->rights[$r][3] = 0; + $newmodule->rights[$r][4] = 'commande'; + $newmodule->rights[$r][5] = 'approve2'; if ($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def"; - $sql.= " (id, entity, libelle, module, type, bydefault, perms, subperms)"; - $sql.= " VALUES "; - $sql.= "(".$r_id.",".$entity.",'".$db->escape($r_desc)."','".$r_modul."','".$r_type."',".$r_def.",'".$r_perms."','".$r_subperms."')"; - - $resqlinsert=$db->query($sql,1); - if (! $resqlinsert) - { - if ($db->errno() != "DB_ERROR_RECORD_ALREADY_EXISTS") - { - setEventMessage($db->lasterror(),'errors'); - $error++; - } - } + $newmodule->insert_permissions(1); } else { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."rights_def"; - $sql.= " WHERE id = ".$r_id; - $resqldelete=$db->query($sql,1); - if (! $resqldelete) - { - setEventMessage($db->lasterror(),'errors'); - $error++; - } + $newmodule->delete_permissions(); } } diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 2e42c1f8b66..dc537426179 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -161,6 +161,14 @@ class modFournisseur extends DolibarrModules $this->rights[$r][4] = 'commande'; $this->rights[$r][5] = 'approuver'; + /*$r++; + $this->rights[$r][0] = 1191; + $this->rights[$r][1] = 'Approuver une commande fournisseur (si supérieur hiérarchique)'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'commande'; + $this->rights[$r][5] = 'approve_ifsupervisor_advance';*/ + $r++; $this->rights[$r][0] = 1186; $this->rights[$r][1] = 'Commander une commande fournisseur'; @@ -250,6 +258,18 @@ class modFournisseur extends DolibarrModules $this->rights[$r][4] = 'commande'; $this->rights[$r][5] = 'export'; + if ($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) + { + $r++; + $this->rights[$r][0] = 1190; + $this->rights[$r][1] = 'Approve supplier order (second level)'; // $langs->trans("Permission1190"); + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'commande'; + $this->rights[$r][5] = 'approve2'; + } + + // Exports //-------- $r=0; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index b1d20b72371..e2f7fb0ca03 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -190,7 +190,7 @@ if (empty($reshook)) if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } - if ($action == 'reopen' && $user->rights->fournisseur->commande->approuver) + if ($action == 'reopen') // no test on permission here, permission to use will depends on status { if (in_array($object->statut, array(1, 2, 5, 6, 7, 9))) { From 0987aa1c747228184c17261592834329ca7c4e9b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 17:42:28 +0200 Subject: [PATCH 12/24] Bad trans key --- htdocs/core/menus/standard/eldy.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 09f4321e668..748f7111e54 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -695,7 +695,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if ((empty($leftmenu) || $leftmenu=="orders_suppliers") && empty($conf->global->SUPPLIER_ORDER_HIDE_VALIDATED)) $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->fournisseur->commande->lire); if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=2", $langs->trans("StatusOrderApprovedShort"), 2, $user->rights->fournisseur->commande->lire); if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=3", $langs->trans("StatusOrderOnProcessShort"), 2, $user->rights->fournisseur->commande->lire); - if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=4", $langs->trans("StatusOrderReceivedPartially"), 2, $user->rights->fournisseur->commande->lire); + if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=4", $langs->trans("StatusOrderReceivedPartiallyShort"), 2, $user->rights->fournisseur->commande->lire); if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=5", $langs->trans("StatusOrderReceivedAll"), 2, $user->rights->fournisseur->commande->lire); if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=6,7", $langs->trans("StatusOrderCanceled"), 2, $user->rights->fournisseur->commande->lire); if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=9", $langs->trans("StatusOrderRefused"), 2, $user->rights->fournisseur->commande->lire); From 742b50b532e131fc0e10db473152479b7765a56f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Wed, 8 Apr 2015 17:58:40 +0200 Subject: [PATCH 13/24] [Contributing] Added a link to the forum --- CONTRIBUTING.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6e779b97463..a603fd242cc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,7 +3,10 @@ How to contribute to Dolibarr Bug reports and feature requests -------------------------------- -** NEW ** + +*Note*: Issues are not a support forum. If you need help using the software, please use [the forums](http://www.dolibarr.org/forum). + +**NEW** Issues are now managed on [GitHub](https://github.com/Dolibarr/dolibarr/Issues). From 1bbecc0912976a1f7306a4bb8940e5e772b2d7c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 19:26:36 +0200 Subject: [PATCH 14/24] Restore link to stock for products. --- htdocs/comm/card.php | 2 +- htdocs/core/lib/product.lib.php | 2 +- htdocs/fourn/card.php | 6 +++--- htdocs/langs/en_US/orders.lang | 4 +++- htdocs/product/class/product.class.php | 2 +- htdocs/product/stock/product.php | 13 +++++++------ 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 14bf6e42fe8..beaa179cb60 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -627,7 +627,7 @@ if ($id > 0) print ''; print ''; - print '
'; + print '
'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' '.$num.''; print ''; //if($num2 > 0) print ''; //else print ''; diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index a35ab95a24a..87e22ac8cc9 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -93,7 +93,7 @@ function product_prepare_head($object) $head[$h][2] = 'referers'; $h++; - if($object->isproduct()) // Si produit stockable + if ($object->isproduct() || ($object->isservice() && ! empty($conf->global->STOCK_SUPPORTS_SERVICES))) // If physical product we can stock (or service with option) { if (! empty($conf->stock->enabled) && $user->rights->stock->lire) { diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 97004783ae6..3794fa1e184 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -364,7 +364,7 @@ if ($object->id > 0) /* - * Last orders + * Last supplier orders */ $orderstatic = new CommandeFournisseur($db); @@ -409,7 +409,7 @@ if ($object->id > 0) print ''; print '
'.$langs->trans("LastCustomerOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').''.img_picto($langs->trans("CreateInvoiceForThisCustomer"),'object_bill').''.img_picto($langs->trans("NoOrdersToInvoice"),'object_bill').'
'; - print ''; + print '
'.$langs->trans("LastOrders",($num<$MAXLIST?"":$MAXLIST)).'
'; print ''; print ''; print '
'.$langs->trans("LastSupplierOrders",($num<$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; @@ -455,7 +455,7 @@ if ($object->id > 0) } /* - * Last invoices + * Last supplier invoices */ $MAXLIST=5; diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 278fb39f0ee..088e239d955 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -79,7 +79,9 @@ NoOpenedOrders=No opened orders NoOtherOpenedOrders=No other opened orders NoDraftOrders=No draft orders OtherOrders=Other orders -LastOrders=Last %s orders +LastOrders=Last %s customer orders +LastCustomerOrders=Last %s customer orders +LastSupplierOrders=Last %s supplier orders LastModifiedOrders=Last %s modified orders LastClosedOrders=Last %s closed orders AllOrders=All orders diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 397f06ce156..c3f8cf5994d 100755 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3689,7 +3689,7 @@ class Product extends CommonObject */ function isproduct() { - return ($this->type != Product::TYPE_PRODUCT ? true : false); + return ($this->type == Product::TYPE_PRODUCT ? true : false); } /** diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index b5639228325..39a81abe86d 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -821,8 +821,9 @@ if (empty($action) && $product->id) /* - * Stock detail + * Stock detail (by warehouse). Do not go down into batch. */ + print '
'; print ''; print ''; @@ -870,9 +871,9 @@ if ($resql) print ''; print ''; // PMP - print ''; // Ditto : Show PMP from movement or from product + print ''; // Value purchase - print ''; // Ditto : Show PMP from movement or from product + print ''; // Sell price print ''; // Value sell print ''; // Ditto : Show PMP from movement or from product + if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price*$obj->reel,'MT'),1).''; else print $langs->trans("Variable"); print ''; ; $total += $obj->reel; if (price2num($product->pmp)) $totalwithpmp += $obj->reel; - $totalvalue = $totalvalue + ($product->pmp*$obj->reel); // Ditto : Show PMP from movement or from product - $totalvaluesell = $totalvaluesell + ($product->price*$obj->reel); // Ditto : Show PMP from movement or from product + $totalvalue = $totalvalue + ($product->pmp*$obj->reel); + $totalvaluesell = $totalvaluesell + ($product->price*$obj->reel); //Batch Detail if ((! empty($conf->productbatch->enabled)) && $product->hasbatch()) { From aaef3a41c015667ff58d4e3cd6d39dcc4b159467 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 19:33:06 +0200 Subject: [PATCH 15/24] Short label into table --- htdocs/langs/en_US/productbatch.lang | 1 + htdocs/langs/en_US/stocks.lang | 1 + htdocs/product/stock/mouvement.php | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/productbatch.lang b/htdocs/langs/en_US/productbatch.lang index 45263681965..8508a26e96d 100644 --- a/htdocs/langs/en_US/productbatch.lang +++ b/htdocs/langs/en_US/productbatch.lang @@ -7,6 +7,7 @@ ProductStatusNotOnBatchShort=No Batch=Batch/Serial atleast1batchfield=Eat-by date or Sell-by date or Batch number batch_number=Batch/Serial number +BatchNumberShort=Batch/Serial l_eatby=Eat-by date l_sellby=Sell-by date DetailBatchNumber=Batch/Serial details diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 9019240490b..998168decdd 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -132,3 +132,4 @@ ShowWarehouse=Show warehouse MovementCorrectStock=Stock content correction for product %s MovementTransferStock=Stock transfer of product %s into another warehouse WarehouseMustBeSelectedAtFirstStepWhenProductBatchModuleOn=Source warehouse must be defined here when batch module is on. It will be used to list wich lot/serial is available for product that required lot/serial data for movement. If you want to send products from different warehouses, just make the shipment into several steps. +InventoryCodeShort=Inv./Mov. code \ No newline at end of file diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 9182708ec8d..913be813815 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -440,13 +440,13 @@ if ($resql) if (! empty($conf->productbatch->enabled)) { $langs->load("productbatch"); - print ''; + print ''; print ''; print ''; } print_liste_field_titre($langs->trans("Warehouse"),$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"], "m.fk_user_author","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("InventoryCode"),$_SERVER["PHP_SELF"], "m.inventorycode","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("InventoryCodeShort"),$_SERVER["PHP_SELF"], "m.inventorycode","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("LabelMovement"),$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Units"),$_SERVER["PHP_SELF"], "m.value","",$param,'align="right"',$sortfield,$sortorder); From 091420f8aefb3b1eaa9bb3712a4a0ccec7945b84 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 20:40:01 +0200 Subject: [PATCH 16/24] Close #2568 --- htdocs/projet/tasks.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 1b69fd5757e..eafe92c5aa4 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -412,7 +412,7 @@ else } print '
'.$langs->trans("Warehouse").''.$langs->trans("NumberOfUnit").''.$entrepotstatic->getNomUrl(1).''.$obj->reel.($obj->reel<0?' '.img_warning():'').''.(price2num($product->pmp)?price2num($product->pmp,'MU'):'').''.(price2num($product->pmp)?price2num($product->pmp,'MU'):'').''.(price2num($product->pmp)?price(price2num($product->pmp*$obj->reel,'MT')):'').''.(price2num($product->pmp)?price(price2num($product->pmp*$obj->reel,'MT')):'').''; if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price,'MU'),1); @@ -880,13 +881,13 @@ if ($resql) print ''; - if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price*$obj->reel,'MT'),1).'
'.$langs->trans("batch_number").''.$langs->trans("BatchNumberShort").''.$langs->trans("l_eatby").''.$langs->trans("l_sellby").'
'; - print ''; + print ''; // print ''; print ''; print ''; From e3bbbaf2e147a1da6e40f9a1fc44feec7b63e9a2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 20:52:18 +0200 Subject: [PATCH 17/24] Comments --- htdocs/install/mysql/tables/llx_facture_rec.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_facture_rec.sql b/htdocs/install/mysql/tables/llx_facture_rec.sql index cba4b580cf0..7c1151f36ca 100644 --- a/htdocs/install/mysql/tables/llx_facture_rec.sql +++ b/htdocs/install/mysql/tables/llx_facture_rec.sql @@ -50,9 +50,9 @@ create table llx_facture_rec note_private text, note_public text, - usenewprice integer DEFAULT 0, - frequency integer, - unit_frequency varchar(2) DEFAULT 'd', + usenewprice integer DEFAULT 0, -- update invoice with current price of product instead of recorded price + frequency integer, -- frequency (for example: 3 for every 3 month) + unit_frequency varchar(2) DEFAULT 'm', -- 'm' for month (date_when must be a day <= 28), 'y' for year, ... date_when datetime DEFAULT NULL, -- date for next gen (when an invoice is generated, this field must be updated with next date) date_last_gen datetime DEFAULT NULL, -- date for last gen (date with last successfull generation of invoice) From c4daca2bac72f4908333219e61c9a3078b86f916 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 21:34:04 +0200 Subject: [PATCH 18/24] Fix #1682 --- htdocs/core/class/commonobject.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ac87f1e693d..db4c1fc5a03 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1887,10 +1887,11 @@ abstract class CommonObject * @param int $targetid Object target id * @param string $targettype Object target type * @param string $clause 'OR' or 'AND' clause used when both source id and target id are provided + * @param int $alsosametype 0=Return only links to different object than source. 1=Include also link to objects of same type. * @return void * @see add_object_linked, updateObjectLinked, deleteObjectLinked */ - function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR') + function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR',$alsosametype=1) { global $conf; @@ -1924,7 +1925,7 @@ abstract class CommonObject return -1; } - // Links beetween objects are stored in this table + // Links between objects are stored in table element_element $sql = 'SELECT fk_source, sourcetype, fk_target, targettype'; $sql.= ' FROM '.MAIN_DB_PREFIX.'element_element'; $sql.= " WHERE "; @@ -1983,7 +1984,7 @@ abstract class CommonObject $classpath = $element.'/class'; - // To work with non standard path + // To work with non standard classpath or module name if ($objecttype == 'facture') { $classpath = 'compta/facture/class'; } @@ -2019,7 +2020,7 @@ abstract class CommonObject $classfile = 'fournisseur.commande'; $classname = 'CommandeFournisseur'; } - if ($conf->$module->enabled && $element != $this->element) + if ($conf->$module->enabled && (($element != $this->element) || $alsosametype)) { dol_include_once('/'.$classpath.'/'.$classfile.'.class.php'); From ddde869ca498db71acaaa8e1cd8d977a5e78ed50 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 21:35:27 +0200 Subject: [PATCH 19/24] Sync transifex --- htdocs/langs/fr_FR/admin.lang | 2 +- htdocs/langs/fr_FR/bills.lang | 6 +++--- htdocs/langs/fr_FR/categories.lang | 14 +++++++------- htdocs/langs/fr_FR/cron.lang | 2 +- htdocs/langs/fr_FR/donations.lang | 10 +++++----- htdocs/langs/fr_FR/errors.lang | 16 ++++++++-------- htdocs/langs/fr_FR/main.lang | 10 +++++----- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 4dea57677d3..dedbc1d5f50 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1606,7 +1606,7 @@ SalariesSetup=Configuration du module salariés SortOrder=Ordre de tri Format=Format TypePaymentDesc=0:Type de paiement client, 1:Type de paiement fournisseur, 2:Paiement de type client et fournisseur -IncludePath=Chemin Include (définir dans la variable %s) +IncludePath=Chemin Include (défini dans la variable %s) ExpenseReportsSetup=Configuration du module Notes de frais TemplatePDFExpenseReports=Modèles de documents pour générer les document de Notes de frais NoModueToManageStockDecrease=Aucun module capable d'assurer la réduction de stock en automatique a été activé. La réduction de stock se fera donc uniquement sur mise à jour manuelle. diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 9e79b16af11..a6a4c1a85a4 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -190,7 +190,7 @@ AlreadyPaid=Déjà réglé AlreadyPaidBack=Déjà remboursé AlreadyPaidNoCreditNotesNoDeposits=Déjà réglé (hors avoirs et acomptes) Abandoned=Abandonné -RemainderToPay=Restant impayé +RemainderToPay=Reste à payer RemainderToTake=Montant restant à percevoir RemainderToPayBack=Montant à rembourser Rest=Créance @@ -294,8 +294,8 @@ TotalOfTwoDiscountMustEqualsOriginal=La somme du montant des 2 nouvelles réduct ConfirmRemoveDiscount=Êtes-vous sûr de vouloir supprimer cette réduction ? RelatedBill=Facture associée RelatedBills=Factures associées -RelatedCustomerInvoices=Related customer invoices -RelatedSupplierInvoices=Related supplier invoices +RelatedCustomerInvoices=Factures clients liées +RelatedSupplierInvoices=Factures fournisseurs liées LatestRelatedBill=Dernière facture en rapport WarningBillExist=Attention, une ou plusieurs factures existent déjà diff --git a/htdocs/langs/fr_FR/categories.lang b/htdocs/langs/fr_FR/categories.lang index 5a6ac7abc31..c310342feff 100644 --- a/htdocs/langs/fr_FR/categories.lang +++ b/htdocs/langs/fr_FR/categories.lang @@ -1,9 +1,9 @@ # Dolibarr language file - Source file is en_US - categories -Rubrique=Tag/Category -Rubriques=Tags/Categories -categories=tags/categories -TheCategorie=The tag/category -NoCategoryYet=No tag/category of this type created +Rubrique=Label/Catégorie +Rubriques=Labels/Catégories +categories=labels/catégories +TheCategorie=Le label/Catégorie +NoCategoryYet=Aucun label/catégorie de ce type n'a été créé In=Dans AddIn=Ajouter dans modify=modifier @@ -18,8 +18,8 @@ ContactsCategoriesArea=Contacts tags/categories area MainCats=Main tags/categories SubCats=Sous-catégories CatStatistics=Statistiques -CatList=List of tags/categories -AllCats=All tags/categories +CatList=Liste des labels/catégories +AllCats=Tous les labels/catégories ViewCat=View tag/category NewCat=Add tag/category NewCategory=New tag/category diff --git a/htdocs/langs/fr_FR/cron.lang b/htdocs/langs/fr_FR/cron.lang index 7c67426510d..b009c0b54d6 100644 --- a/htdocs/langs/fr_FR/cron.lang +++ b/htdocs/langs/fr_FR/cron.lang @@ -18,7 +18,7 @@ CronExplainHowToRunUnix=Sur un environnement Unix vous pouvez utiliser l'entrée CronExplainHowToRunWin=Sur un environement Microsoft(tm) Windows vous pouvez utiliser le planificateur de tache pour lancer cette commande toute les 5 minutes. # Menu CronJobs=Travaux programmés -CronListActive=Liste des travaux actifs/programmés +CronListActive=Liste des travaux CronListInactive=Liste des travaux inactifs # Page list CronDateLastRun=Dernier lancement diff --git a/htdocs/langs/fr_FR/donations.lang b/htdocs/langs/fr_FR/donations.lang index a2625c9c0fa..3dbb4cc5f76 100644 --- a/htdocs/langs/fr_FR/donations.lang +++ b/htdocs/langs/fr_FR/donations.lang @@ -6,8 +6,8 @@ Donor=Donateur Donors=Donateurs AddDonation=Créer un don NewDonation=Nouveau don -DeleteADonation=Delete a donation -ConfirmDeleteADonation=Are you sure you want to delete this donation ? +DeleteADonation=Effacer le don +ConfirmDeleteADonation=Êtes-vous sûr de vouloir supprimer ce don ? ShowDonation=Montrer don DonationPromise=Promesse de don PromisesNotValid=Promesses non validées @@ -23,8 +23,8 @@ DonationStatusPaid=Don payé DonationStatusPromiseNotValidatedShort=Non validée DonationStatusPromiseValidatedShort=Validée DonationStatusPaidShort=Payé -DonationTitle=Donation receipt -DonationDatePayment=Payment date +DonationTitle=Reçu de dons +DonationDatePayment=Date paiement ValidPromess=Valider promesse DonationReceipt=Reçu de dons BuildDonationReceipt=Créer reçu @@ -40,4 +40,4 @@ FrenchOptions=Options propres à la france DONATION_ART200=Afficher article 200 du CGI si vous êtes concernés DONATION_ART238=Afficher article 238 du CGI si vous êtes concernés DONATION_ART885=Afficher article 885 du CGI si vous êtes concernés -DonationPayment=Donation payment +DonationPayment=Paiement du don diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index d784017964d..dd92729aa4d 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -25,7 +25,7 @@ ErrorFromToAccountsMustDiffers=Les comptes source et destination doivent être d ErrorBadThirdPartyName=Nom de tiers incorrect ErrorProdIdIsMandatory=Le %s est obligatoire ErrorBadCustomerCodeSyntax=La syntaxe du code client est incorrecte -ErrorBadBarCodeSyntax=Bad syntax for bar code. May be you set a bad barcode type or you defined a barcode mask for numbering that does not match value scanned. +ErrorBadBarCodeSyntax=Mauvaise syntaxe pour le code barre. Peut être que vous avez défini un mauvais type de code-barres ou que vous avez défini un masque de code à barres pour la numérotation qui ne correspond pas à la valeur scannée. ErrorCustomerCodeRequired=Code client obligatoire ErrorBarCodeRequired=Code-barre requis ErrorCustomerCodeAlreadyUsed=Code client déjà utilisé @@ -160,13 +160,13 @@ ErrorPriceExpressionInternal=Erreur interne '%s' ErrorPriceExpressionUnknown=Erreur inconnue '%s' ErrorSrcAndTargetWarehouseMustDiffers=Les entrepôts source et destination doivent être différents ErrorTryToMakeMoveOnProductRequiringBatchData=Erreur, vous essayez de faire un mouvement sans lot/numéro de série, sur un produit qui exige un lot/numéro de série. -ErrorCantSetReceptionToTotalDoneWithReceptionToApprove=All recorded receptions must first be verified before being allowed to do this action -ErrorGlobalVariableUpdater0=HTTP request failed with error '%s' -ErrorGlobalVariableUpdater1=Invalid JSON format '%s' -ErrorGlobalVariableUpdater2=Missing parameter '%s' -ErrorGlobalVariableUpdater3=The requested data was not found in result -ErrorGlobalVariableUpdater4=SOAP client failed with error '%s' -ErrorGlobalVariableUpdater5=No global variable selected +ErrorCantSetReceptionToTotalDoneWithReceptionToApprove=Toutes les réceptions enregistrées doivent d'abord être vérifiées avant d'être autorisés à faire cette action +ErrorGlobalVariableUpdater0=La requête HTTP a échoué avec l'erreur '%s' +ErrorGlobalVariableUpdater1=Format JSON invalide '%s' +ErrorGlobalVariableUpdater2=Paramètre manquant '%s' +ErrorGlobalVariableUpdater3=La donnée recherché n'a pas été trouvée +ErrorGlobalVariableUpdater4=Le client SOAP a échoué avec l'erreur '%s' +ErrorGlobalVariableUpdater5=Pas de variable globale # Warnings WarningMandatorySetupNotComplete=Les informations de configuration obligatoire doivent être renseignées diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 97aa65f021e..94676450fbc 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -141,7 +141,7 @@ Cancel=Annuler Modify=Modifier Edit=Éditer Validate=Valider -ValidateAndApprove=Validate and Approve +ValidateAndApprove=Valider et Approuver ToValidate=À valider Save=Enregistrer SaveAs=Enregistrer sous @@ -159,7 +159,7 @@ Search=Rechercher SearchOf=Recherche de Valid=Valider Approve=Approuver -Disapprove=Disapprove +Disapprove=Désapprouver ReOpen=Réouvrir Upload=Envoyer fichier ToLink=Lier @@ -221,7 +221,7 @@ Cards=Fiches Card=Fiche Now=Maintenant Date=Date -DateAndHour=Date and hour +DateAndHour=Date et heure DateStart=Date début DateEnd=Date fin DateCreation=Date création @@ -395,8 +395,8 @@ Available=Disponible NotYetAvailable=Pas encore disponible NotAvailable=Non disponible Popularity=Popularité -Categories=Tags/categories -Category=Tag/category +Categories=Tags/catégories +Category=Tag/catégorie By=Par From=Du to=au From f6c2472d92d8420c90ce10870534b1659daf5ceb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 21:50:17 +0200 Subject: [PATCH 20/24] fix var not declared --- htdocs/core/class/events.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index 4ab3ce8f6fe..f94252d076d 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -31,7 +31,6 @@ /** * Events class - * Initialy built by build_class_from_table on 2008-02-28 17:25 */ class Events // extends CommonObject { @@ -41,6 +40,8 @@ class Events // extends CommonObject var $id; var $db; + var $error; + var $tms; var $type; var $entity; From ed6f2e93869ea618a203fe116d4334176f487a54 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Apr 2015 15:14:50 +0200 Subject: [PATCH 21/24] Fix error management --- .../class/fournisseur.commande.class.php | 12 +++++-- htdocs/fourn/commande/dispatch.php | 33 +++++++++++++++---- 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 22ac415b511..732a381694d 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1392,13 +1392,19 @@ class CommandeFournisseur extends CommonOrder function dispatchProduct($user, $product, $qty, $entrepot, $price=0, $comment='', $eatby='', $sellby='', $batch='', $fk_commandefourndet=0, $notrigger=0) { global $conf; + $error = 0; require_once DOL_DOCUMENT_ROOT .'/product/stock/class/mouvementstock.class.php'; - // Check parameters - if ($entrepot <= 0 || $qty <= 0) + // Check parameters (if test are wrong here, there is bug into caller) + if ($entrepot <= 0) { - $this->error='BadValueForParameterWarehouseOrQty'; + $this->error='ErrorBadValueForParameterWarehouse'; + return -1; + } + if ($qty <= 0) + { + $this->error='ErrorBadValueForParameterQty'; return -1; } diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 84b03f1953a..1da5f5eb29a 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -101,6 +101,23 @@ if ($action == 'uncheckdispatchline' && } } +if ($action == 'denydispatchline' && + ! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) + || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check))) +) +{ + $supplierorderdispatch = new CommandeFournisseurDispatch($db); + $result=$supplierorderdispatch->fetch($lineid); + if (! $result) dol_print_error($db); + $result=$supplierorderdispatch->setStatut(-1); + if ($result < 0) + { + setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors'); + $error++; + $action=''; + } +} + if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) { $commande = new CommandeFournisseur($db); @@ -123,7 +140,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) if (GETPOST($qty) > 0) // We ask to move a qty { - if (! GETPOST($ent,'int') > 0) + if (! (GETPOST($ent,'int') > 0)) { dol_syslog('No dispatch for line '.$key.' as no warehouse choosed'); $text = $langs->transnoentities('Warehouse').', '.$langs->transnoentities('Line').' ' .($numline); @@ -133,7 +150,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) if (! $error) { - $result = $commande->DispatchProduct($user, GETPOST($prod,'int'),GETPOST($qty), GETPOST($ent,'int'), GETPOST($pu), GETPOST("comment"), '', '', '', GETPOST($fk_commandefourndet, 'int'), $notrigger); + $result = $commande->DispatchProduct($user, GETPOST($prod,'int'), GETPOST($qty), GETPOST($ent,'int'), GETPOST($pu), GETPOST("comment"), '', '', '', GETPOST($fk_commandefourndet, 'int'), $notrigger); if ($result < 0) { setEventMessages($commande->error, $commande->errors, 'errors'); @@ -643,11 +660,13 @@ if ($id > 0 || ! empty($ref)) { if (empty($objp->status)) { - print ''.$langs->trans("Check").''; + print ''.$langs->trans("Approve").''; + print ''.$langs->trans("Deny").''; } else { - print ''.$langs->trans("Uncheck").''; + print ''.$langs->trans("Disapprove").''; + print ''.$langs->trans("Deny").''; } } else @@ -656,11 +675,13 @@ if ($id > 0 || ! empty($ref)) if ($commande->statut == 5) $disabled=1; if (empty($objp->status)) { - print 'dispatchlineid.'">'.$langs->trans("Check").''; + print 'dispatchlineid.'">'.$langs->trans("Approve").''; + print 'dispatchlineid.'">'.$langs->trans("Deny").''; } else { - print 'dispatchlineid.'">'.$langs->trans("Uncheck").''; + print 'dispatchlineid.'">'.$langs->trans("Disapprove").''; + print 'dispatchlineid.'">'.$langs->trans("Deny").''; } } print ''; From e01e0faeef86d46ce0801228f1fef45cfefee556 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Apr 2015 16:15:52 +0200 Subject: [PATCH 22/24] Can reopen to edit supplier order once ordered --- .../class/fournisseur.commande.class.php | 39 ++++++++++++++----- .../fournisseur.commande.dispatch.class.php | 3 ++ htdocs/fourn/commande/card.php | 5 ++- htdocs/fourn/commande/dispatch.php | 11 ++++-- htdocs/langs/en_US/errors.lang | 3 +- htdocs/langs/en_US/main.lang | 1 + 6 files changed, 46 insertions(+), 16 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 732a381694d..7f091749660 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1747,18 +1747,37 @@ class CommandeFournisseur extends CommonOrder if ($type == 'nev') $statut = 7; if ($type == 'can') $statut = 7; - if (! $error && ! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS) && ($type == 'tot')) - { - // If option SUPPLIER_ORDER_USE_DISPATCH_STATUS is on, we check all reception are approved to allow status "total/done" - $dispatchedlinearray=$this->getDispachedLines(0); - if (count($dispatchedlinearray) > 0) + // Some checks to accept the record + if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) + { + // If option SUPPLIER_ORDER_USE_DISPATCH_STATUS is on, we check all reception are approved to allow status "total/done" + if (! $error && ($type == 'tot')) + { + $dispatchedlinearray=$this->getDispachedLines(0); + if (count($dispatchedlinearray) > 0) + { + $result=-1; + $error++; + $this->errors[]='ErrorCantSetReceptionToTotalDoneWithReceptionToApprove'; + dol_syslog('ErrorCantSetReceptionToTotalDoneWithReceptionToApprove', LOG_DEBUG); + } + + } + if (! $error && ! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS_NEED_APPROVE) && ($type == 'tot')) // Accept to move to rception done, only if status of all line are ok (refuse denied) { - $result=-1; - $error++; - $this->errors[]='ErrorCantSetReceptionToTotalDoneWithReceptionToApprove'; - dol_syslog('ErrorCantSetReceptionToTotalDoneWithReceptionToApprove', LOG_DEBUG); + $dispatcheddenied=$this->getDispachedLines(2); + if (count($dispatchedlinearray) > 0) + { + $result=-1; + $error++; + $this->errors[]='ErrorCantSetReceptionToTotalDoneWithReceptionDenied'; + dol_syslog('ErrorCantSetReceptionToTotalDoneWithReceptionDenied', LOG_DEBUG); + } } - } + } + + // TODO LDR01 Add option to accept only if ALL predefined products are received (same qty). + if (! $error && ! ($statut == 4 or $statut == 5 or $statut == 7)) { diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index e7aea53945e..4d6f75444b8 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -495,16 +495,19 @@ class CommandeFournisseurDispatch extends CommonObject { if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0'); if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut4'); + if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut8'); } if ($mode == 4) { if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); + if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut8').' '.$langs->trans($this->statuts[$statut]); } if ($mode == 5) { if ($statut==0) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut0'); if ($statut==1) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut4'); + if ($statut==2) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut8'); } } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index e2f7fb0ca03..755dd1249ea 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -192,10 +192,11 @@ if (empty($reshook)) if ($action == 'reopen') // no test on permission here, permission to use will depends on status { - if (in_array($object->statut, array(1, 2, 5, 6, 7, 9))) + if (in_array($object->statut, array(1, 2, 3, 5, 6, 7, 9))) { if ($object->statut == 1) $newstatus=0; // Validated->Draft else if ($object->statut == 2) $newstatus=0; // Approved->Draft + else if ($object->statut == 3) $newstatus=2; // Ordered->Approved else if ($object->statut == 5) $newstatus=4; // Received->Received partially else if ($object->statut == 6) $newstatus=2; // Canceled->Approved else if ($object->statut == 7) $newstatus=3; // Canceled->Process running @@ -2671,7 +2672,7 @@ elseif (! empty($object->id)) print ''.$langs->trans("Disapprove").''; } } - if (in_array($object->statut, array(5, 6, 7, 9))) + if (in_array($object->statut, array(3, 5, 6, 7, 9))) { if ($user->rights->fournisseur->commande->commander) { diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 1da5f5eb29a..bac6ace77e3 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -109,7 +109,7 @@ if ($action == 'denydispatchline' && $supplierorderdispatch = new CommandeFournisseurDispatch($db); $result=$supplierorderdispatch->fetch($lineid); if (! $result) dol_print_error($db); - $result=$supplierorderdispatch->setStatut(-1); + $result=$supplierorderdispatch->setStatut(2); if ($result < 0) { setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors'); @@ -678,11 +678,16 @@ if ($id > 0 || ! empty($ref)) print 'dispatchlineid.'">'.$langs->trans("Approve").''; print 'dispatchlineid.'">'.$langs->trans("Deny").''; } - else + if ($objp->status == 1) { - print 'dispatchlineid.'">'.$langs->trans("Disapprove").''; + print 'dispatchlineid.'">'.$langs->trans("Reinit").''; print 'dispatchlineid.'">'.$langs->trans("Deny").''; } + if ($objp->status == 2) + { + print 'dispatchlineid.'">'.$langs->trans("Reinit").''; + print 'dispatchlineid.'">'.$langs->trans("Approve").''; + } } print ''; } diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 6a7da2d3ece..32a66564b07 100755 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -160,7 +160,8 @@ ErrorPriceExpressionInternal=Internal error '%s' ErrorPriceExpressionUnknown=Unknown error '%s' ErrorSrcAndTargetWarehouseMustDiffers=Source and target warehouses must differs ErrorTryToMakeMoveOnProductRequiringBatchData=Error, trying to make a stock movement without batch/serial information, on a product requiring batch/serial information -ErrorCantSetReceptionToTotalDoneWithReceptionToApprove=All recorded receptions must first be verified before being allowed to do this action +ErrorCantSetReceptionToTotalDoneWithReceptionToApprove=All recorded receptions must first be verified (approved or denied) before being allowed to do this action +ErrorCantSetReceptionToTotalDoneWithReceptionDenied=All recorded receptions must first be verified (approved) before being allowed to do this action ErrorGlobalVariableUpdater0=HTTP request failed with error '%s' ErrorGlobalVariableUpdater1=Invalid JSON format '%s' ErrorGlobalVariableUpdater2=Missing parameter '%s' diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index bd2112cf871..ce4300e67c2 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -700,6 +700,7 @@ SelectElementAndClickRefresh=Select an element and click Refresh PrintFile=Print File %s ShowTransaction=Show transaction GoIntoSetupToChangeLogo=Go into Home - Setup - Company to change logo or go into Home - Setup - Display to hide. +Denied=Denied # Week day Monday=Monday Tuesday=Tuesday From 3ee27907377dca510784b2c1cac10f11aedea6a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Apr 2015 16:26:21 +0200 Subject: [PATCH 23/24] Always sho project info when opening task card --- htdocs/core/lib/project.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 0d4b43c9172..63aca7c7e92 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -371,7 +371,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $taskstatic->id=$lines[$i]->id; $taskstatic->ref=$lines[$i]->ref; $taskstatic->label=($taskrole[$lines[$i]->id]?$langs->trans("YourRole").': '.$taskrole[$lines[$i]->id]:''); - print $taskstatic->getNomUrl(1,($showproject?'':'withproject')); + print $taskstatic->getNomUrl(1,'withproject'); } print ''; From 503a4ff7a05ce892d4614d8cc3aaf259be9dbc3e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Apr 2015 20:40:49 +0200 Subject: [PATCH 24/24] Enhance filtering for bank transaction and timesheet. --- htdocs/compta/bank/account.php | 2 +- htdocs/compta/bank/search.php | 7 +-- htdocs/core/lib/project.lib.php | 56 +++++++++++++++++------- htdocs/langs/en_US/main.lang | 1 + htdocs/langs/en_US/projects.lang | 1 + htdocs/projet/activity/perday.php | 70 +++++++++++++++++++++++++++--- htdocs/projet/activity/perweek.php | 42 ++++++++++++------ 7 files changed, 139 insertions(+), 40 deletions(-) diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 6ba80304188..ce2bbc5381e 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -403,7 +403,7 @@ if ($id > 0 || ! empty($ref)) print ''; if ($nbcategories) { - print '
'.$langs->trans("Category").': '; + print '
'.$langs->trans("Rubrique").': '; } print ''; print '
'; diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php index a1e114430ce..f367149a19c 100644 --- a/htdocs/compta/bank/search.php +++ b/htdocs/compta/bank/search.php @@ -178,9 +178,10 @@ if ($resql) print ''."\n"; print ''."\n"; - $moreforfilter .= $langs->trans('Period') . ' ' . $langs->trans('StartDate') . ': '; - $moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 1, 1); - $moreforfilter .= $langs->trans('EndDate') . ':' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 1, 1); + $moreforfilter .= $langs->trans('Period') . ' ('.$langs->trans('DateOperationShort').') : ' . $langs->trans('StartDate') . ' '; + $moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 1); + $moreforfilter .= ' - '; + $moreforfilter .= $langs->trans('EndDate') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1); if ($moreforfilter) { diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 63aca7c7e92..828c7c359d1 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -504,9 +504,10 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t * @param string $tasksrole Array of roles user has on task * @param string $mine Show only task lines I am assigned to * @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to + * @param int $preselectedday Preselected day * @return $inc */ -function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0) +function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0, $preselectedday='') { global $db, $user, $bc, $langs; global $form, $formother, $projectstatic, $taskstatic; @@ -527,6 +528,12 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t { $var = !$var; $lastprojectid=$lines[$i]->fk_project; + + if ($preselectedday) + { + $projectstatic->id = $lines[$i]->fk_project; + $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent into this->weekWorkLoad and this->weekWorkLoadPerTaks for all day of a week + } } // If we want all or we have a role on task, we show it @@ -549,7 +556,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t // Ref print ''; // Label task @@ -559,7 +566,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t $taskstatic->ref=$lines[$i]->label; $taskstatic->date_start=$lines[$i]->date_start; $taskstatic->date_end=$lines[$i]->date_end; - print $taskstatic->getNomUrl(0); + print $taskstatic->getNomUrl(0,'withproject'); //print "
"; //for ($k = 0 ; $k < $level ; $k++) print "   "; //print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0); @@ -613,14 +620,21 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t // Form to add new time print ''; print ''; print $tableCell; } + + print ''; + print "\n"; } diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index ce4300e67c2..52ab660e21b 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -220,6 +220,7 @@ Next=Next Cards=Cards Card=Card Now=Now +HourStart=Start hour Date=Date DateAndHour=Date and hour DateStart=Date start diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 40b1c2e308d..e56ddf2ec4a 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -14,6 +14,7 @@ MyTasksDesc=This view is limited to projects or tasks you are a contact for (wha OnlyOpenedProject=Only opened projects are visible (projects with draft or closed status are not visible). TasksPublicDesc=This view presents all projects and tasks you are allowed to read. TasksDesc=This view presents all projects and tasks (your user permissions grant you permission to view everything). +AllTaskVisibleButEditIfYouAreAssigned=All tasks for such project are visible, but you can enter time only for task you are assigned on. ProjectsArea=Projects area NewProject=New project AddProject=Create project diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 9c55874a762..1df9359dfa5 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -48,11 +48,33 @@ $socid=0; if ($user->societe_id > 0) $socid=$user->societe_id; $result = restrictedArea($user, 'projet', $projectid); +$now=dol_now(); +$nowtmp=dol_getdate($now); +$nowday=$nowtmp['mday']; +$nowmonth=$nowtmp['mon']; +$nowyear=$nowtmp['year']; + +$year=GETPOST('reyear')?GETPOST('reyear'):(GETPOST("year","int")?GETPOST("year","int"):date("Y")); +$month=GETPOST('remonth')?GETPOST('remonth'):(GETPOST("month","int")?GETPOST("month","int"):date("m")); +$day=GETPOST('reday')?GETPOST('reday'):(GETPOST("day","int")?GETPOST("day","int"):date("d")); +$day = (int) $day; +$week=GETPOST("week","int")?GETPOST("week","int"):date("W"); + +$daytoparse = $now; +if ($year && $month && $day) $daytoparse=dol_mktime(0, 0, 0, $month, $day, $year); + /* * Actions */ +if (GETPOST('submitdateselect')) +{ + $daytoparse = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + + $action = ''; +} + if ($action == 'addtime' && $user->rights->projet->creer) { $task = new Task($db); @@ -133,6 +155,16 @@ $projectstatic=new Project($db); $project = new Project($db); $taskstatic = new Task($db); +$prev = dol_getdate($daytoparse - (24 * 3600)); +$prev_year = $prev['year']; +$prev_month = $prev['mon']; +$prev_day = $prev['mday']; + +$next = dol_getdate($daytoparse + (24 * 3600)); +$next_year = $next['year']; +$next_month = $next['mon']; +$next_day = $next['mday']; + $title=$langs->trans("TimeSpent"); if ($mine) $title=$langs->trans("MyTimeSpent"); @@ -160,7 +192,18 @@ llxHeader("",$title,""); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num); -print ''; +// Show navigation bar +$nav ="".img_previous($langs->trans("Previous"))."\n"; +$nav.=" ".dol_print_date(dol_mktime(0,0,0,$month,$day,$year),"day")." \n"; +$nav.="".img_next($langs->trans("Next"))."\n"; +$nav.="   (".$langs->trans("Today").")"; +$nav.='
'.$form->select_date(-1,'',0,0,2,"addtime",1,0,1).' '; +$nav.=' '; + +$picto='calendarweek'; + + +print 'id > 0 ? '?id='.$project->id : '').'">'; print ''; print ''; print ''; @@ -169,13 +212,15 @@ $head=project_timesheet_prepare_head($mode); dol_fiche_head($head, 'inputperday', '', 0, 'task'); // Show description of content -if ($mine) print $langs->trans("MyTasksDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'

'; +if ($mine) print $langs->trans("MyTasksDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'
'; else { - if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'

'; - else print $langs->trans("ProjectsPublicTaskDesc").($onlyopened?' '.$langs->trans("AlsoOnlyOpenedProject"):'').'

'; + if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'
'; + else print $langs->trans("ProjectsPublicTaskDesc").($onlyopened?' '.$langs->trans("AlsoOnlyOpenedProject"):'').'
'; } - +print $langs->trans("AllTaskVisibleButEditIfYouAreAssigned").'
'; +print '
'; +print "\n"; // Filter on user /* dol_fiche_head(''); @@ -197,6 +242,10 @@ else dol_fiche_end(); */ + +print '
'.$nav.'
'; + + print '
'.$langs->trans("Project").''.$langs->trans("RefTask").''.$langs->trans("LabelTask").'
'; $taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id); - print $taskstatic->getNomUrl(1); + print $taskstatic->getNomUrl(1,'withproject'); print ''; - $s=''; - $s.=$form->select_date('',$lines[$i]->id,1,1,2,"addtime",1,0,1,$disabledtask); - print $s; + $tableCell=$form->select_date($preselectedday,$lines[$i]->id,1,1,2,"addtime",0,0,1,$disabledtask); + print $tableCell; print ''; - //$s.='   '; - $s=$form->select_duration($lines[$i]->id.'duration','',$disabledtask,'text',0,1); - //$s.=' '; - print $s; + + $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]; + $alreadyspent=''; + if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin'); + + $tableCell=''; + $tableCell.=''; + $tableCell.=' + '; + //$tableCell.='   '; + $tableCell.=$form->select_duration($lines[$i]->id.'duration','',$disabledtask,'text',0,1); + //$tableCell.=' '; + print $tableCell; print ''; @@ -633,7 +647,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t $inc++; $level++; - if ($lines[$i]->id) projectLinesPerDay($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask); + if ($lines[$i]->id) projectLinesPerDay($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday); $level--; } else @@ -776,18 +790,30 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ for ($idw = 0; $idw < 7; $idw++) { $tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd'); + $tmparray=dol_getdate($tmpday); $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id]; $alreadyspent=''; if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin'); $tableCell =''; $tableCell.=''; - $tableCell.='+'; - $tableCell.=''; + //$placeholder=' placeholder="00:00"'; + $placeholder=''; + //if (! $disabledtask) + //{ + $tableCell.='+'; + $tableCell.=''; + //} $tableCell.=''; + if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject")); + else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou")); + print '
'; print ''; print ''; @@ -207,7 +256,7 @@ print ''; print ''; if ($usertoprocess->id == $user->id) print ''; else print ''; -print ''; +print ''; print ''; print "\n"; @@ -217,7 +266,7 @@ $restricteditformytask=(empty($conf->global->PROJECT_TIME_ON_ALL_TASKS_MY_PROJEC if (count($tasksarray) > 0) { $j=0; - projectLinesPerDay($j, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask); + projectLinesPerDay($j, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $daytoparse); } else { @@ -234,6 +283,13 @@ print ''; print ''; +print ''; + + llxFooter(); $db->close(); diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index b7ab0a8bd71..77b65a19c6b 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -49,12 +49,15 @@ if ($user->societe_id > 0) $socid=$user->societe_id; $result = restrictedArea($user, 'projet', $projectid); $now=dol_now(); - -$year=GETPOST("year","int")?GETPOST("year","int"):date("Y"); -$month=GETPOST("month","int")?GETPOST("month","int"):date("m"); -$week=GETPOST("week","int")?GETPOST("week","int"):date("W"); -$day=GETPOST("day","int")?GETPOST("day","int"):date("d"); +$nowtmp=dol_getdate($now); +$nowday=$nowtmp['mday']; +$nowmonth=$nowtmp['mon']; +$nowyear=$nowtmp['year']; +$year=GETPOST('reyear')?GETPOST('reyear'):(GETPOST("year","int")?GETPOST("year","int"):date("Y")); +$month=GETPOST('remonth')?GETPOST('remonth'):(GETPOST("month","int")?GETPOST("month","int"):date("m")); +$day=GETPOST('reday')?GETPOST('reday'):(GETPOST("day","int")?GETPOST("day","int"):date("d")); $day = (int) $day; +$week=GETPOST("week","int")?GETPOST("week","int"):date("W"); $startdayarray=dol_get_first_day_week($day, $month, $year); @@ -83,6 +86,13 @@ $usertoprocess=$user; * Actions */ +if (GETPOST('submitdateselect')) +{ + $daytoparse = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + + $action = ''; +} + if ($action == 'addtime' && $user->rights->projet->creer) { $task = new Task($db); @@ -176,16 +186,15 @@ llxHeader("",$title,"",'','','',array('/core/js/timesheet.js')); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num); -$tmpday = $first_day; - // Show navigation bar $nav ="".img_previous($langs->trans("Previous"))."\n"; -$nav.=" ".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("Week")." ".$week; -$nav.=" \n"; +$nav.=" ".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("Week")." ".$week." \n"; $nav.="".img_next($langs->trans("Next"))."\n"; $nav.="   (".$langs->trans("Today").")"; -$picto='calendarweek'; +$nav.='
'.$form->select_date(-1,'',0,0,2,"addtime",1,0,1).' '; +$nav.=' '; +$picto='calendarweek'; print ''; print ''; @@ -199,12 +208,14 @@ $head=project_timesheet_prepare_head($mode); dol_fiche_head($head, 'inputperweek', '', 0, 'task'); // Show description of content -if ($mine) print $langs->trans("MyTasksDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'

'; +if ($mine) print $langs->trans("MyTasksDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'
'; else { - if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'

'; - else print $langs->trans("ProjectsPublicTaskDesc").($onlyopened?' '.$langs->trans("AlsoOnlyOpenedProject"):'').'

'; + if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'
'; + else print $langs->trans("ProjectsPublicTaskDesc").($onlyopened?' '.$langs->trans("AlsoOnlyOpenedProject"):'').'
'; } +print $langs->trans("AllTaskVisibleButEditIfYouAreAssigned").'
'; +print '
'; print "\n"; // Filter on user @@ -248,6 +259,7 @@ for($i=0;$i<7;$i++) { print ''; } +print ''; print "\n"; @@ -268,11 +280,12 @@ if (count($tasksarray) > 0) + '; } else { - print ''; + print ''; } print "
'.$langs->trans("Project").''.$langs->trans("ProgressDeclared").''.$langs->trans("TimeSpent").''.$langs->trans("TimeSpentByYou").''.$langs->trans("TimeSpentByUser").''.$langs->trans("DateAndHour").''.$langs->trans("HourStart").''.$langs->trans("Duration").'
'.dol_print_date($startday + ($i * 3600 * 24), '%a').'
'.dol_print_date($startday + ($i * 3600 * 24), 'day').'
 
 
 
'.$langs->trans("NoTasks").'
'.$langs->trans("NoTasks").'
"; @@ -287,6 +300,7 @@ print ''; print ''."\n\n"; + $modeinput='hours'; print '