From 7f1adc6a6ab53fce7e3a5d7f910cd90109ffc27e Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Tue, 7 Nov 2017 09:46:39 +0100 Subject: [PATCH 01/19] FIX: Saving wrong localtax on order addline --- htdocs/commande/class/commande.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index c326efa7e49..0ea9302b221 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1360,8 +1360,8 @@ class Commande extends CommonOrder $this->line->vat_src_code=$vat_src_code; $this->line->tva_tx=$txtva; - $this->line->localtax1_tx=$localtaxes_type[1]; - $this->line->localtax2_tx=$localtaxes_type[3]; + $this->line->localtax1_tx=$txlocaltax1; + $this->line->localtax2_tx=$txlocaltax2; $this->line->localtax1_type=$localtaxes_type[0]; $this->line->localtax2_type=$localtaxes_type[2]; $this->line->fk_product=$fk_product; From 4874d08062ed78dc66ea3bb6e24e5431b5644f05 Mon Sep 17 00:00:00 2001 From: De Coninck Laurent Date: Fri, 19 Jan 2018 08:59:04 +0100 Subject: [PATCH 02/19] fix the bill replacement with discounts #8028 --- htdocs/compta/facture/class/facture.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 3c35a03f218..748f83f5a53 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -539,6 +539,15 @@ class Facture extends CommonInvoice } $newinvoiceline->fk_parent_line=$fk_parent_line; + + if($newinvoiceline->fk_remise_except){ + $discount = new DiscountAbsolute($this->db); + $discount->fetch($newinvoiceline->fk_remise_except); + + $discountId = $soc->set_remise_except($discount->amount_ht, $user, $discount->description, $discount->tva_tx); + $newinvoiceline->fk_remise_except = $discountId; + } + $result=$newinvoiceline->insert(); // Defined the new fk_parent_line From 53ac13c792dddc0cbd073ea25657900a323d6dc6 Mon Sep 17 00:00:00 2001 From: De Coninck Laurent Date: Tue, 23 Jan 2018 18:03:29 +0100 Subject: [PATCH 03/19] check on type replacement #8028 --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 748f83f5a53..72285e87808 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -540,7 +540,7 @@ class Facture extends CommonInvoice $newinvoiceline->fk_parent_line=$fk_parent_line; - if($newinvoiceline->fk_remise_except){ + if($this->type === Facture::TYPE_REPLACEMENT && $newinvoiceline->fk_remise_except){ $discount = new DiscountAbsolute($this->db); $discount->fetch($newinvoiceline->fk_remise_except); From 6fe69d4a606788e27939e21b74c856a3829f4666 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 15 Feb 2018 15:17:59 +0100 Subject: [PATCH 04/19] Wrong field in thirdparty getnomurl --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index afc33f110cf..9a43c5b3cfa 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1919,7 +1919,7 @@ class Societe extends CommonObject if (! empty($this->code_fournisseur) && $this->fournisseur) $label.= '
' . $langs->trans('SupplierCode') . ': '. $this->code_fournisseur; if (! empty($conf->accounting->enabled) && $this->client) - $label.= '
' . $langs->trans('CustomerAccountancyCode') . ': '. $this->code_compta_client; + $label.= '
' . $langs->trans('CustomerAccountancyCode') . ': '. $this->code_compta; if (! empty($conf->accounting->enabled) && $this->fournisseur) $label.= '
' . $langs->trans('SupplierAccountancyCode') . ': '. $this->code_compta_fournisseur; From bfd46f62ea8ccfee4420f4e63176a58b510eb9a5 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 15 Feb 2018 15:18:25 +0100 Subject: [PATCH 05/19] Fix : contact and user getnomurl needs all info to display tooltip correctly --- htdocs/core/tpl/contacts.tpl.php | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 27d57d3e48a..aa392489987 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -201,18 +201,12 @@ if ($permission) { if ($tab[$i]['source']=='internal') { - $userstatic->id=$tab[$i]['id']; - $userstatic->lastname=$tab[$i]['lastname']; - $userstatic->firstname=$tab[$i]['firstname']; - $userstatic->photo=$tab[$i]['photo']; - $userstatic->login=$tab[$i]['login']; + $userstatic->fetch($tab[$i]['id']); echo $userstatic->getNomUrl(-1); } if ($tab[$i]['source']=='external') { - $contactstatic->id=$tab[$i]['id']; - $contactstatic->lastname=$tab[$i]['lastname']; - $contactstatic->firstname=$tab[$i]['firstname']; + $contactstatic->fetch($tab[$i]['id']); echo $contactstatic->getNomUrl(1); } ?> @@ -223,16 +217,10 @@ if ($permission) { id=$tab[$i]['id']; - $userstatic->lastname=$tab[$i]['lastname']; - $userstatic->firstname=$tab[$i]['firstname']; echo $userstatic->LibStatut($tab[$i]['statuscontact'],3); } if ($tab[$i]['source']=='external') { - $contactstatic->id=$tab[$i]['id']; - $contactstatic->lastname=$tab[$i]['lastname']; - $contactstatic->firstname=$tab[$i]['firstname']; echo $contactstatic->LibStatut($tab[$i]['statuscontact'],3); } ?> From 63987fa32e1682704dd269f065c1024e882afde5 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 15 Feb 2018 16:39:47 +0100 Subject: [PATCH 06/19] fix invoice extrafield transmition to credit --- htdocs/compta/facture/card.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 8cf8f64ed09..86e21e1518b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -852,6 +852,12 @@ if (empty($reshook)) foreach($facture_source->lines as $line) { + // Extrafields + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { + // load extrafields + $line->fetch_optionals(); + } + // Reset fk_parent_line for no child products and special product if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) { $fk_parent_line = 0; From 49bad95d3128e7a3180f5d10ab232a2ae1a8fbe8 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 15 Feb 2018 17:04:27 +0100 Subject: [PATCH 07/19] fix method exist test --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 86e21e1518b..f31b0be6a38 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -853,7 +853,7 @@ if (empty($reshook)) foreach($facture_source->lines as $line) { // Extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($line, 'fetch_optionals')) { // load extrafields $line->fetch_optionals(); } From 7c583227fb0fcdd8b2c70126b6997ba68c58279a Mon Sep 17 00:00:00 2001 From: sschwebel Date: Mon, 19 Feb 2018 10:58:05 +0100 Subject: [PATCH 08/19] FIX: #8139 --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 2806f2d06a0..3328bf49e67 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1625,7 +1625,7 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra if (! empty($conf->user->enabled) && $user->rights->user->user->lire) { $langs->load("users"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/user/list.php', DOL_URL_ROOT.'/user/list.php', $langs->trans("Users"), 'maxwidth100', 'sall', 'M', 'searchleftuser', img_object('','user')); + $searchform.=printSearchForm(DOL_URL_ROOT.'/user/index.php', DOL_URL_ROOT.'/user/index.php', $langs->trans("Users"), 'maxwidth100', 'sall', 'M', 'searchleftuser', img_object('','user')); } } From 2e1727e323a7552f61e910bedb34302ff8020797 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Mon, 19 Feb 2018 17:45:19 +0100 Subject: [PATCH 09/19] Fix: Barcode type --- htdocs/barcode/codeinit.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index ebe121301b7..537f9d30a3f 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -1,5 +1,6 @@ + * Copyright (C) 2018 Ferran Marcet * * 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 @@ -143,7 +144,7 @@ if ($action == 'initbarcodeproducts') $nextvalue=$modBarCodeProduct->getNextValue($productstatic,''); //print 'Set value '.$nextvalue.' to product '.$productstatic->id." ".$productstatic->ref." ".$productstatic->type."
\n"; - $result=$productstatic->setValueFrom('barcode', $nextvalue, '', '', 'date', '', $user, 'PRODUCT_MODIFY'); + $result=$productstatic->setValueFrom('barcode', $nextvalue, '', '', 'text', '', $user, 'PRODUCT_MODIFY'); $nbtry++; if ($result > 0) $nbok++; From 671b4a399dbdd2dc47cb20a18ae324b489a86309 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Mon, 19 Feb 2018 17:47:24 +0100 Subject: [PATCH 10/19] Fix: Barcode type --- htdocs/commande/class/commande.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 0ea9302b221..c326efa7e49 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1360,8 +1360,8 @@ class Commande extends CommonOrder $this->line->vat_src_code=$vat_src_code; $this->line->tva_tx=$txtva; - $this->line->localtax1_tx=$txlocaltax1; - $this->line->localtax2_tx=$txlocaltax2; + $this->line->localtax1_tx=$localtaxes_type[1]; + $this->line->localtax2_tx=$localtaxes_type[3]; $this->line->localtax1_type=$localtaxes_type[0]; $this->line->localtax2_type=$localtaxes_type[2]; $this->line->fk_product=$fk_product; From ea071b768057993855dcdcccfbd5bdef7a81d6d4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Feb 2018 12:31:26 +0100 Subject: [PATCH 11/19] Fix can't delete holiday refused --- htdocs/holiday/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 39edb577aec..b2dca7ca41b 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -1246,7 +1246,7 @@ else { print ''.$langs->trans("Validate").''; } - if ($user->rights->holiday->delete && $object->statut == 1) // If draft + if ($user->rights->holiday->delete && ($object->statut == 1 || $object->statut == 4 || $object->statut == 5) // If draft or canceled or refused { print ''.$langs->trans("DeleteCP").''; } From 4056b87a74cd8b9cf387b7d9c4622a0e51c909fc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Feb 2018 12:36:03 +0100 Subject: [PATCH 12/19] Fix syntax error --- htdocs/holiday/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 069b5657aa1..be61223d704 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -1246,7 +1246,7 @@ else { print ''.$langs->trans("Validate").''; } - if ($user->rights->holiday->delete && ($object->statut == 1 || $object->statut == 4 || $object->statut == 5) // If draft or canceled or refused + if ($user->rights->holiday->delete && ($object->statut == 1 || $object->statut == 4 || $object->statut == 5)) // If draft or canceled or refused { print ''.$langs->trans("DeleteCP").''; } From 67ee443b34403ed101056922680136d782ae429a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Feb 2018 14:53:19 +0100 Subject: [PATCH 13/19] Fix can set holiday remaining to 0 --- htdocs/holiday/define_holiday.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 66e490ae420..87cb1920394 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -116,7 +116,7 @@ if (empty($reshook)) $userValue = $_POST['nb_holiday_'.$val['rowid']]; $userValue = $userValue[$userID]; - if (!empty($userValue)) + if (!empty($userValue) || (string) $userValue == '0') { $userValue = price2num($userValue,5); } else { @@ -172,11 +172,14 @@ $userstatic=new User($db); llxHeader('', $langs->trans('CPTitreMenu')); +$typeleaves=$holiday->getTypes(1,1); + + print '
'; if ($optioncss != '') print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; @@ -210,10 +213,8 @@ if (is_numeric($listUsers) && $listUsers < 0) setEventMessages($holiday->error, $holiday->errors, 'errors'); } -$var=true; $i = 0; -$typeleaves=$holiday->getTypes(1,1); if (count($typeleaves) == 0) { @@ -234,8 +235,6 @@ else $userchilds=$user->getAllChildIds(); } - print ''; - $moreforfilter=''; print '
'; From 276f2dce77f87252cfbf0da47db34fd011c96f00 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Feb 2018 14:55:23 +0100 Subject: [PATCH 14/19] FIX #8200 --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index afc33f110cf..9a43c5b3cfa 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1919,7 +1919,7 @@ class Societe extends CommonObject if (! empty($this->code_fournisseur) && $this->fournisseur) $label.= '
' . $langs->trans('SupplierCode') . ': '. $this->code_fournisseur; if (! empty($conf->accounting->enabled) && $this->client) - $label.= '
' . $langs->trans('CustomerAccountancyCode') . ': '. $this->code_compta_client; + $label.= '
' . $langs->trans('CustomerAccountancyCode') . ': '. $this->code_compta; if (! empty($conf->accounting->enabled) && $this->fournisseur) $label.= '
' . $langs->trans('SupplierAccountancyCode') . ': '. $this->code_compta_fournisseur; From 48d250b201fa67df894ef7e0e269b759bf9db588 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Feb 2018 15:55:58 +0100 Subject: [PATCH 15/19] Help to understand --- htdocs/accountancy/admin/categories_list.php | 2 +- htdocs/langs/en_US/admin.lang | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 9833a1c01b1..0dcefdcc0ee 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -113,7 +113,7 @@ $tabcond[32]= ! empty($conf->accounting->enabled); // List of help for fields $tabhelp=array(); -$tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode")); +$tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode"), 'category_type'=>$langs->trans("SetToYesIfGroupIsComputationOfOtherGroups"), 'formula'=>$langs->trans("EnterCalculationRuleIfPreviousFieldIsYes")); // List of check for fields (NOT USED YET) $tabfieldcheck=array(); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index efb9839ade2..29673edf51c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1764,6 +1764,8 @@ MAIN_PDF_MARGIN_LEFT=Left margin on PDF MAIN_PDF_MARGIN_RIGHT=Right margin on PDF MAIN_PDF_MARGIN_TOP=Top margin on PDF MAIN_PDF_MARGIN_BOTTOM=Bottom margin on PDF +SetToYesIfGroupIsComputationOfOtherGroups=Set this to yes if this group is a computation of other groups +EnterCalculationRuleIfPreviousFieldIsYes=Enter calculcation rule if previous field was set to Yes (For example 'CODEGRP1+CODEGRP2') ##### Resource #### ResourceSetup=Configuration du module Resource UseSearchToSelectResource=Use a search form to choose a resource (rather than a drop-down list). From 34135e0a133f3770d042b133e86d5b481c29b342 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Feb 2018 19:19:27 +0100 Subject: [PATCH 16/19] Fix extrafield date or datetime with bad timezone --- htdocs/core/class/commonobject.class.php | 18 ++++++++++++++++-- htdocs/core/class/extrafields.class.php | 4 ++-- htdocs/core/tpl/extrafields_view.tpl.php | 12 ++++++++++-- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 60e491162f2..d89c110c2c9 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4411,7 +4411,7 @@ abstract class CommonObject if (! is_array($optionsArray)) { // If $extrafields is not a known object, we initialize it. Best practice is to have $extrafields defined into card.php or list.php page. - // TODO Use of existing extrafield is not yet ready (must mutualize code that use extrafields in form first) + // TODO Use of existing $extrafield is not yet ready (must mutualize code that use extrafields in form first) // global $extrafields; //if (! is_object($extrafields)) //{ @@ -4426,6 +4426,10 @@ abstract class CommonObject } $optionsArray = $extrafields->attributes[$this->table_element]['label']; } + else + { + dol_syslog("Warning: fetch_optionals was called with param $optionsArray defined when you should pass null now", LOG_WARNING); + } $table_element = $this->table_element; if ($table_element == 'categorie') $table_element = 'categories'; // For compatibility @@ -4459,7 +4463,17 @@ abstract class CommonObject if ($key != 'rowid' && $key != 'tms' && $key != 'fk_member' && ! is_int($key)) { // we can add this attribute to object - $this->array_options["options_".$key]=$value; + if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('date','datetime'))) + { + //var_dump($extrafields->attributes[$this->table_element]['type'][$key]); + $this->array_options["options_".$key]=$this->db->jdate($value); + } + else + { + $this->array_options["options_".$key]=$value; + } + + //var_dump('key '.$key.' '.$value.' type='.$extrafields->attributes[$this->table_element]['type'][$key].' '.$this->array_options["options_".$key]); } } } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 22b65d688fd..3d934baaf75 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1404,12 +1404,12 @@ class ExtraFields if ($type == 'date') { $showsize=10; - $value=dol_print_date($value, 'day', 'tzuser'); + $value=dol_print_date($value, 'day'); } elseif ($type == 'datetime') { $showsize=19; - $value=dol_print_date($value, 'dayhour', 'tzuser'); + $value=dol_print_date($value, 'dayhour'); } elseif ($type == 'int') { diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 9d638426bc3..3559df44c9c 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -107,8 +107,16 @@ if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element][ print ''; // Convert date into timestamp format - if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('date','datetime'))) { - $value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $db->jdate($object->array_options['options_' . $key]); + if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('date','datetime'))) + { + $datenotinstring = $object->array_options['options_' . $key]; + // print 'X'.$object->array_options['options_' . $key].'-'.$datenotinstring.'x'; + if (! is_numeric($object->array_options['options_' . $key])) // For backward compatibility + { + $datenotinstring = $db->jdate($datenotinstring); + } + //print 'x'.$object->array_options['options_' . $key].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour'); + $value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $datenotinstring; } //TODO Improve element and rights detection From 9114a28e88203c42e69fcf7171ccbb49fd137bef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Feb 2018 22:41:02 +0100 Subject: [PATCH 17/19] Fix: missing the reposition --- htdocs/contrat/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 08c43551509..7eedec6f824 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1868,7 +1868,7 @@ else } if (($tmpaction=='activateline' && $user->rights->contrat->activer) || ($tmpaction=='unactivateline' && $user->rights->contrat->desactiver)) { - print ''; + print ''; print img_picto($tmpactiontext, $tmpactionpicto); print ''; } From 51cfb9795ed8c4290ed83b8dbeb8f7791f513658 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Feb 2018 11:26:41 +0100 Subject: [PATCH 18/19] Fix bad picto --- htdocs/core/class/commoninvoice.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 9d7ae9d0998..e0517ac864c 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -457,7 +457,7 @@ abstract class CommonInvoice extends CommonObject { if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('Bill'.$prefix.'StatusDraft'); if (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('StatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled'); - if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut7').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); + if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); if ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('Bill'.$prefix.'StatusNotPaid'); return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('Bill'.$prefix.'StatusStarted'); } @@ -475,7 +475,7 @@ abstract class CommonInvoice extends CommonObject { if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0'); if (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5'); - if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut7'); + if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9'); if ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1'); return img_picto($langs->trans('BillStatusStarted'),'statut3'); } @@ -493,7 +493,7 @@ abstract class CommonInvoice extends CommonObject { if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('BillStatusDraft'); if (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled'); - if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut7').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); + if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); if ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('BillStatusNotPaid'); return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('BillStatusStarted'); } @@ -512,7 +512,7 @@ abstract class CommonInvoice extends CommonObject { if ($status == 0) return ''.$langs->trans('Bill'.$prefix.'StatusDraft').' '.img_picto($langs->trans('BillStatusDraft'),'statut0'); if (($status == 3 || $status == 2) && $alreadypaid <= 0) return ''.$langs->trans('Bill'.$prefix.'StatusCanceled').' '.img_picto($langs->trans('BillStatusCanceled'),'statut5'); - if (($status == 3 || $status == 2) && $alreadypaid > 0) return ''.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' '.img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut7'); + if (($status == 3 || $status == 2) && $alreadypaid > 0) return ''.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' '.img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9'); if ($alreadypaid <= 0) { if ($type == self::TYPE_CREDIT_NOTE) return ''.$langs->trans('Bill'.$prefix.'StatusNotRefunded').' '.img_picto($langs->trans('StatusNotRefunded'),'statut1'); From 479c4b4d7795c877ea97a8d807df9da33cd7ba35 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Feb 2018 12:15:11 +0100 Subject: [PATCH 19/19] Fix look and feel v7 --- htdocs/cron/card.php | 2 +- htdocs/cron/class/cronjob.class.php | 63 +++++++++++++++++++++++++++++ htdocs/cron/info.php | 2 +- htdocs/cron/list.php | 23 ++++++----- 4 files changed, 79 insertions(+), 11 deletions(-) diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 8e540c799fe..8c97bc4e2c8 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -557,7 +557,7 @@ else dol_fiche_head($head, 'card', $langs->trans("CronTask"), -1, 'cron'); - $linkback = '' . $langs->trans("BackToList") . ''; + $linkback = '' . $langs->trans("BackToList") . ''; $morehtmlref='
'; $morehtmlref.='
'; diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index a63982c5b12..46ad08f849b 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -805,6 +805,69 @@ class Cronjob extends CommonObject $this->libname = ''; } + + /** + * Return a link to the object card (with optionaly the picto) + * + * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param string $option On what the link point to ('nolink', ...) + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL + */ + function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1) + { + global $db, $conf, $langs; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; + + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + + $result = ''; + $companylink = ''; + + $label = '' . $langs->trans("CronJob") . ''; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; + + $url = DOL_URL_ROOT.'/cron/card.php?id='.$this->id; + + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + } + + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowCronJob"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + } + else $linkclose = ($morecss?' class="'.$morecss.'"':''); + + $linkstart = ''; + $linkend=''; + + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; + //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); + + return $result; + } + + /** * Load object information * diff --git a/htdocs/cron/info.php b/htdocs/cron/info.php index d3365abb90b..18bfde73bde 100644 --- a/htdocs/cron/info.php +++ b/htdocs/cron/info.php @@ -50,7 +50,7 @@ $head = cron_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("CronTask"), -1, 'cron'); -$linkback = '' . $langs->trans("BackToList") . ''; +$linkback = '' . $langs->trans("BackToList") . ''; $morehtmlref='
'; $morehtmlref.='
'; diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 3933a30a54b..ca21a40635a 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -38,6 +38,7 @@ if (!$user->rights->cron->read) accessforbidden(); $action=GETPOST('action','alpha'); $confirm=GETPOST('confirm','alpha'); $id=GETPOST('id','int'); +$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'cronjoblist'; // To manage different context of search $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); @@ -50,9 +51,6 @@ $pagenext = $page + 1; if (! $sortfield) $sortfield='t.status'; if (! $sortorder) $sortorder='ASC'; -// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$contextpage='cronjoblist'; - $status=GETPOST('status','int'); if ($status == '') $status=-2; @@ -151,6 +149,7 @@ if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->ex */ $form = new Form($db); +$cronjob = new Cronjob($db); $pagetitle=$langs->trans("CronList"); @@ -280,6 +279,9 @@ if (! empty($conf->global->CRON_WARNING_DELAY_HOURS)) $text.=$langs->trans("Warn print info_admin($text); print '
'; +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +//$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +//$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; print ''; @@ -340,19 +342,22 @@ if ($num > 0) if (empty($obj)) break; if (! verifCond($obj->test)) continue; // Discard line with test = false + $object->id = $obj->rowid; + $object->ref = $obj->rowid; + $object->label = $obj->label; + print ''; print ''; print '
'; - print ''; - print img_picto('', 'object_cron').' '; - print $obj->rowid; - print ''; + print $object->getNomUrl(1); print ''; if (! empty($obj->label)) { - print ''.$langs->trans($obj->label).''; + $object->ref = $obj->label; + print $object->getNomUrl(0, '', 1); + $object->ref = $obj->rowid; } else { @@ -430,7 +435,7 @@ if ($num > 0) print ''; if ($user->rights->cron->create) { - print "rowid."&action=edit".($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."&backtourl=".urlencode($_SERVER["PHP_SELF"])."\" title=\"".dol_escape_htmltag($langs->trans('Edit'))."\">".img_picto($langs->trans('Edit'),'edit')."  "; + print "rowid."&action=edit".($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."&backtourl=".urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:''))."\" title=\"".dol_escape_htmltag($langs->trans('Edit'))."\">".img_picto($langs->trans('Edit'),'edit')."  "; } if ($user->rights->cron->delete) {