From f52ae35dc6eeb9b5cd56271d4a3443ec6d10de8d Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 6 Nov 2015 16:14:00 +0100 Subject: [PATCH 01/21] NEW FEATURE PROPOSAL: on propale, order or invoice creation from scratch, reload page after customer selection so its informations can be loaded --- htdocs/comm/propal.php | 13 ++++++++++++- htdocs/commande/card.php | 15 +++++++++++++-- htdocs/compta/facture.php | 11 +++++++++++ 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 08d4e31ec6b..5b60e0ec273 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1276,7 +1276,7 @@ if ($action == 'create') // Ref customer print '' . $langs->trans('RefCustomer') . ''; - print ''; + print ''; print ''; // Third party @@ -1290,6 +1290,17 @@ if ($action == 'create') } else { print ''; print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 1); + // reload page to retrieve customer informations + print ''; print ''; } print '' . "\n"; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 4d7456af1fd..bbc255e0227 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1338,10 +1338,10 @@ if ($action == 'create' && $user->rights->commande->creer) // Reference client print '' . $langs->trans('RefCustomer') . ''; - if (!empty($conf->global->MAIN_USE_PROPAL_REFCLIENT_FOR_ORDER)) + if (!empty($conf->global->MAIN_USE_PROPAL_REFCLIENT_FOR_ORDER) && ! empty($origin) && ! empty($originid)) print ''; else - print ''; + print ''; print ''; // Client @@ -1355,6 +1355,17 @@ if ($action == 'create' && $user->rights->commande->creer) } else { print ''; print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 1); + // reload page to retrieve customer informations + print ''; print ''; } print '' . "\n"; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 983331bd412..fd9f730fe09 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1959,6 +1959,17 @@ if ($action == 'create') { print ''; print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 1); + // reload page to retrieve customer informations + print ''; print ''; } print '' . "\n"; From 7f0d81d255a58bdc0c7316b2eea21696c3c3cec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 8 Nov 2015 15:12:31 +0100 Subject: [PATCH 02/21] Missing changes of PR #3927 --- htdocs/product/price.php | 159 +++++++++++++++++++++++---------------- 1 file changed, 95 insertions(+), 64 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 497f676ae8c..114f6a8df53 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -431,13 +431,34 @@ $titre = $langs->trans("CardProduct" . $object->type); $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); dol_fiche_head($head, 'price', $titre, 0, $picto); -dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); +print ''; +// Ref +print ''; +print ''; +print ''; -print '
'; +// Label +print '
'; -print '
'; -print '
' . $langs->trans("Ref") . ''; +print $form->showrefnav($object, 'ref', '', 1, 'ref'); +print '
' . $langs->trans("Label") . '' . $object->label . '
'; +$isphoto = $object->is_photo_available($conf->product->multidir_output [$object->entity]); + +$nblignes = 5; +if ($isphoto) { + // Photo + print ''; +} + +print ''; + +// Status (to sell) +print ''; // MultiPrix if (! empty($conf->global->PRODUIT_MULTIPRICES)) @@ -450,7 +471,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) $soc->fetch($socid); // Selling price - print ''; + print '' . $langs->trans("SellingPrice") . ''; print ''; + print ''; } else { // TVA - print ''; + print ''; } print ''; @@ -613,7 +634,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) else { // TVA - print ''; + print ''; // Price print '
'; + print $object->show_photos($conf->product->multidir_output [$object->entity], 1, 1, 0, 0, 0, 80); + print '
' . $langs->trans("Status") . ' (' . $langs->trans("Sell") . ')'; +print $object->getLibStatut(2, 0); +print '
' . $langs->trans("SellingPrice") . '
'; if ($object->multiprices_base_type[$soc->price_level] == 'TTC') { print price($object->multiprices_ttc[$soc->price_level]); @@ -491,12 +512,12 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility { // We show only vat for level 1 - print '
' . $langs->trans("VATRate") . '' . vatrate($object->multiprices_tva_tx [1], true) . '
' . $langs->trans("VATRate") . '' . vatrate($object->multiprices_tva_tx [1], true) . '
' . $langs->trans("VATRate") . '' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . '
' . $langs->trans("VATRate") . '' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . '
'.$langs->trans("PriceLevel").''.$langs->trans("SellingPrice").''.$langs->trans("MinPrice").'
' . $langs->trans("VATRate") . '' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . '
' . $langs->trans("VATRate") . '' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . '
' . $langs->trans("SellingPrice") . ''; @@ -711,10 +732,6 @@ else print "
\n"; -print ''; -print '
'; - - dol_fiche_end(); @@ -793,7 +810,7 @@ if ($action == 'edit_vat' && ($user->rights->produit->creer || $user->rights->se print '

'; } -if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->service->creer)) +if ($action == 'edit_price' && $object->getRights()->creer) { print load_fiche_titre($langs->trans("NewPrice"), ''); @@ -809,7 +826,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> print ''; // VAT - print ''; @@ -817,7 +834,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> print ''; - print ''; print ''; @@ -825,7 +842,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> // Only show price mode and expression selector if module is enabled if (! empty($conf->dynamicprices->enabled)) { // Price mode selector - print ''; + // This code hides the numeric price input if is not selected, loads the editor page if editor button is pressed - print ''; + + rights->produit->creer || $user->rights-> print 'global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) { + print ' colspan="2"'; + } + print '>'; if ($object->price_base_type == 'TTC') { - print ''; + print ''; } - print ''; + print ''; print '
' . $langs->trans("VATRate") . ''; + print '
' . $langs->trans("VATRate") . ''; print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr); print '
'; print $langs->trans('PriceBase'); print ''; + print ''; print $form->selectPriceBaseType($object->price_base_type, "price_base_type"); print '
'.$langs->trans("PriceMode").''; + print '
'.$langs->trans("PriceMode").''; $price_expression = new PriceExpression($db); $price_expression_list = array(0 => $langs->trans("PriceNumeric")); //Put the numeric mode as first option foreach ($price_expression->list_price_expression() as $entry) { @@ -835,17 +852,18 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> print $form->selectarray('eid', $price_expression_list, $price_expression_preselection); print ' 
'.$langs->trans("PriceExpressionEditor").'
'; print '
'; $text = $langs->trans('SellingPrice'); print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1); - print ''; + print ''; if ($object->price_base_type == 'TTC') { print ''; } else { @@ -874,16 +893,21 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> print '
'; $text = $langs->trans('MinPrice'); print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1); + print ''; + print ''; } else { - print ''; + print ''; } if ( !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) { - print ''.$langs->trans("MinimumRecommendedPrice", price($maxpricesupplier,0,'',1,-1,-1,'auto')).' '.img_warning().''.$langs->trans("MinimumRecommendedPrice", price($maxpricesupplier,0,'',1,-1,-1,'auto')).' '.img_warning().'
'; @@ -927,65 +951,72 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> id . '" method="POST">'; + print ''; + print ''; + print ''; - for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) - { + if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($conf->global->PRODUIT_MULTIPRICES_ALLOW_AUTOCALC_PRICELEVEL)) { + print $langs->trans('UseMultipriceRules'). ' price_autogen ? 'checked' : '').'>

'; + } - if ($i > 1) print '
'; - elseif (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($conf->global->PRODUIT_MULTIPRICES_ALLOW_AUTOCALC_PRICELEVEL)) { - print $langs->trans('UseMultipriceRules'). ' price_autogen ? 'checked' : '').'>

'; - } - print ''; - print ''; - print ''; - if (empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) - { - print ''; - } - - print ''; + print '
'; + print ' + '; + if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) { + print ''; + } + print ' + '; + if (!empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) { + print ''; + } + print ''; + + for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) { + $var = !$var; + + print ''; + print ''; // VAT - if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // This option is kept for backward compatibility but has no sense - { - print ''; + print ''; } - + // Selling price - print ''; + print ''; // Min price - print ''; } - print ''; - - print '
'.$langs->trans("PriceLevel").''.$langs->trans("VATRate").''.$langs->trans("SellingPrice").''.$langs->trans("MinPrice").'
'; + print $form->textwithpicto($langs->trans('SellingPrice') . ' ' . $i, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1); + print '
' . $langs->trans("VATRate") . ''; + if (empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) { + print ''; + } else { + // This option is kept for backward compatibility but has no sense + print ''; print $form->load_tva("tva_tx[" . $i.']', $object->multiprices_tva_tx[$i], $mysoc, '', $object->id); - print '
'; - $text = $langs->trans('SellingPrice') . ' ' . $i; - print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1); - print ''; + print ''; if ($object->multiprices_base_type [$i] == 'TTC') { print ''; } else { print ''; } print ' '.$form->selectPriceBaseType($object->multiprices_base_type [$i], "multiprices_base_type[" . $i."]"); - print '
'; - $text = $langs->trans('MinPrice') . ' ' . $i; - print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1); + print ''; if ($object->multiprices_base_type [$i] == 'TTC') { - print ''; + print ''; } else { - print ''; + print ''; } if ( !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) { print ''.$langs->trans("MinimumRecommendedPrice", price($maxpricesupplier,0,'',1,-1,-1,'auto')).' '.img_warning().'
'; + print ''; + print ''; } - print '
'; + print '
'; print ''; print '   '; print '
'; From 9bc4b9f0bc45867fa8346396ec25987038319a00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 8 Nov 2015 16:45:42 +0100 Subject: [PATCH 03/21] Moved update function after updatePrice --- htdocs/product/price.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 114f6a8df53..3c37530ea3e 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -179,12 +179,6 @@ if (empty($reshook)) ); } - if (!$error && $object->update($object->id, $user) < 1) { - $error++; - setEventMessage($object->error, 'errors'); - $action = 'edit_price'; - } - if (!$error) { $db->begin(); @@ -215,6 +209,11 @@ if (empty($reshook)) } } + if (!$error && $object->update($object->id, $user) < 0) { + $error++; + setEventMessage($object->error, 'errors'); + } + if (empty($error)) { $action = ''; setEventMessage($langs->trans("RecordSaved")); From 9cdf45e0a6e6a65fd7eb275ee879643c6af5b518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 8 Nov 2015 16:54:54 +0100 Subject: [PATCH 04/21] Fixed JS compatibility with multiprices price generator --- htdocs/product/price.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 3c37530ea3e..b7c714c9887 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -929,8 +929,8 @@ if ($action == 'edit_price' && $object->getRights()->creer) '; + '; + } print ''; } print '' . "\n"; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index bbc255e0227..508c26f24ed 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1356,16 +1356,18 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 1); // reload page to retrieve customer informations - print ''; + '; + } print ''; } print '' . "\n"; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index fd9f730fe09..ea309b83a26 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1960,16 +1960,18 @@ if ($action == 'create') print ''; print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 1); // reload page to retrieve customer informations - print ''; + '; + } print ''; } print '' . "\n"; From a3e82f5a63549a9ba8dd2ec8ca79eced38b159d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Nov 2015 20:17:43 +0100 Subject: [PATCH 08/21] Typo --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8640c5e9b2f..a39f6b84a59 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -97,7 +97,7 @@ When submitting a pull request, use same rule as [Commits](#commits) for the mes If your pull request only contains one commit, GitHub will be smart enough to fill it for you. Otherwise, please be a bit verbose about what you're providing. -You Pull Request must pass the Continuous Integration checks. +Your Pull Request must pass the Continuous Integration checks. Also, if you want to include a new external library (into htdocs/includes directory), please ask before to the project leader to see if such a library can be accepted. From d997ac83e7b2993bd9796c9402296e189d31bc57 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Thu, 12 Nov 2015 09:08:08 +0100 Subject: [PATCH 09/21] Add function param description --- htdocs/core/class/html.formactions.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index c98eae0badf..a5404135982 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -246,7 +246,8 @@ class FormActions * @param string $htmlname Nom champ formulaire * @param string $excludetype Type to exclude * @param string $onlyautoornot Group list by auto events or not: We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO) - * @param int $hideinfohelp 1=Do not show info help + * @param int $hideinfohelp 1=Do not show info help + * @param int $multiselect 1=Allow multiselect of action type for filter or search * @return void */ function select_type_actions($selected='',$htmlname='actioncode',$excludetype='',$onlyautoornot=0, $hideinfohelp=0, $multiselect=0) From 0cb9cc22136de2480351ff752ceed7922316f343 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Morfin Date: Thu, 12 Nov 2015 09:24:04 +0100 Subject: [PATCH 10/21] Correct pattern to match all odt var tags some vars like {object_total_vat_local_x.y} or {object_total_vat_local_x,y} could not be tested to know if they were existing with [!-- IF {xxx} --] syntax --- htdocs/includes/odtphp/odf.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php index 0bc54416fd1..52750352afa 100644 --- a/htdocs/includes/odtphp/odf.php +++ b/htdocs/includes/odtphp/odf.php @@ -284,7 +284,7 @@ IMG; private function _parse($type='content') { // Search all tags fou into condition to complete $this->vars, so we will proceed all tests even if not defined - $reg='@\[!--\sIF\s([{}a-zA-Z_]+)\s--\]@smU'; + $reg='@\[!--\sIF\s([{}a-zA-Z0-9\.\,_]+)\s--\]@smU'; preg_match_all($reg, $this->contentXml, $matches, PREG_SET_ORDER); //var_dump($this->vars);exit; foreach($matches as $match) // For each match, if there is no entry into this->vars, we add it From 3c42df935da9d47c184d6b0f2635cb2da8dce417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Thu, 12 Nov 2015 10:26:05 +0100 Subject: [PATCH 11/21] Corrected HTML closing tag --- htdocs/product/price.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index d8951dd79bc..3f16a20d98b 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -885,9 +885,10 @@ if ($action == 'edit_price' && $object->getRights()->creer) } else { print ''; } + print ''; if ( !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) { - print ''.$langs->trans("MinimumRecommendedPrice", price($maxpricesupplier,0,'',1,-1,-1,'auto')).' '.img_warning().''; + print ''.$langs->trans("MinimumRecommendedPrice", price($maxpricesupplier,0,'',1,-1,-1,'auto')).' '.img_warning().''; } print ''; From c712532bf6686c547873e377cbdc09c750c16df8 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Thu, 12 Nov 2015 11:59:15 +0100 Subject: [PATCH 12/21] [Qual] Uniformize code --- dev/skeletons/skeleton_card.php | 8 ++++---- htdocs/compta/deplacement/card.php | 14 ++++++------- htdocs/compta/facture/contact.php | 16 +++++++-------- htdocs/compta/facture/fiche-rec.php | 6 +++--- htdocs/compta/facture/mergepdftool.php | 18 ++++++++--------- htdocs/compta/facture/prelevement.php | 4 ++-- htdocs/compta/paiement/card.php | 18 ++++++++--------- htdocs/compta/paiement/cheque/card.php | 28 +++++++++++++------------- 8 files changed, 56 insertions(+), 56 deletions(-) diff --git a/dev/skeletons/skeleton_card.php b/dev/skeletons/skeleton_card.php index a85969c53ad..7f0ff1fc7d4 100644 --- a/dev/skeletons/skeleton_card.php +++ b/dev/skeletons/skeleton_card.php @@ -112,7 +112,7 @@ if (empty($reshook)) if (empty($object->ref)) { $error++; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),'errors'); + setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), null, 'errors'); } if (! $error) @@ -152,7 +152,7 @@ if (empty($reshook)) if (empty($object->ref)) { $error++; - setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),null,'errors'); + setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), null, 'errors'); } if (! $error) @@ -189,8 +189,8 @@ if (empty($reshook)) } else { - if (! empty($object->errors)) setEventMessages(null,$object->errors,'errors'); - else setEventMessages($object->error,null,'errors'); + if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); + else setEventMessages($object->error, null, 'errors'); } } } diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index bc18d379a87..f2fcd490277 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -71,7 +71,7 @@ if ($action == 'validate' && $user->rights->deplacement->creer) } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } } @@ -89,7 +89,7 @@ else if ($action == 'classifyrefunded' && $user->rights->deplacement->creer) } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } } @@ -104,7 +104,7 @@ else if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->depl } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -150,7 +150,7 @@ else if ($action == 'add' && $user->rights->deplacement->creer) } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $action='create'; } } @@ -190,7 +190,7 @@ else if ($action == 'update' && $user->rights->deplacement->creer) } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } else @@ -411,8 +411,8 @@ else if ($id) } else { - /* - * Confirmation de la suppression du deplacement + /* + * Confirm delete trip */ if ($action == 'delete') { diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 8fe20cd66f6..b07a8f8c2d4 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -2,7 +2,7 @@ /* Copyright (C) 2005 Patrick Rouillon * Copyright (C) 2005-2009 Destailleur Laurent * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011-2012 Philippe Grand + * Copyright (C) 2011-2015 Philippe Grand * * 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 @@ -48,7 +48,7 @@ $object = new Facture($db); /* - * Ajout d'un nouveau contact + * Add a new contact */ if ($action == 'addcontact' && $user->rights->facture->creer) @@ -71,16 +71,16 @@ if ($action == 'addcontact' && $user->rights->facture->creer) if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); - setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); + setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } } -// Bascule du statut d'un contact +// Toggle the status of a contact else if ($action == 'swapstatut' && $user->rights->facture->creer) { if ($object->fetch($id)) @@ -93,7 +93,7 @@ else if ($action == 'swapstatut' && $user->rights->facture->creer) } } -// Efface un contact +// Deletes a contact else if ($action == 'deletecontact' && $user->rights->facture->creer) { $object->fetch($id); @@ -124,7 +124,7 @@ $userstatic=new User($db); /* *************************************************************************** */ /* */ -/* Mode vue et edition */ +/* View and edit mode */ /* */ /* *************************************************************************** */ @@ -139,7 +139,7 @@ if ($id > 0 || ! empty($ref)) dol_fiche_head($head, 'contact', $langs->trans('InvoiceCustomer'), 0, 'bill'); /* - * Facture synthese pour rappel + * Summary invoice for reminder */ print ''; diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index f01c288e29e..3f7aec9809f 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -70,7 +70,7 @@ if ($action == 'add') { if (! GETPOST('titre')) { - setEventMessage($langs->transnoentities("ErrorFieldRequired",$langs->trans("Title")), 'errors'); + setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->trans("Title")), null, 'errors'); $action = "create"; $error++; } @@ -88,13 +88,13 @@ if ($action == 'add') } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $action = "create"; } } } -// Suppression +// Delete if ($action == 'delete' && $user->rights->facture->supprimer) { $object->fetch($id); diff --git a/htdocs/compta/facture/mergepdftool.php b/htdocs/compta/facture/mergepdftool.php index e0b821683ce..cb3f9239caf 100644 --- a/htdocs/compta/facture/mergepdftool.php +++ b/htdocs/compta/facture/mergepdftool.php @@ -107,14 +107,14 @@ if ($action == 'presend' && GETPOST('sendmail')) if (!isset($user->email)) { $error++; - setEventMessage("NoSenderEmailDefined"); + setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings'); } $countToSend = count($_POST['toSend']); if (empty($countToSend)) { $error++; - setEventMessage("InvoiceNotChecked","warnings"); + setEventMessages($langs->trans("InvoiceNotChecked"), null, 'warnings'); } if (! $error) @@ -260,11 +260,11 @@ if ($action == 'presend' && GETPOST('sendmail')) if ($nbsent) { $action=''; // Do not show form post if there was at least one successfull sent - setEventMessage($nbsent. '/'.$countToSend.' '.$langs->trans("RemindSent")); + setEventMessages($nbsent. '/'.$countToSend.' '.$langs->trans("RemindSent"), null, 'mesgs'); } else { - setEventMessage($langs->trans("NoRemindSent"), 'warnings'); // May be object has no generated PDF file + setEventMessages($langs->trans("NoRemindSent"), null, 'warnings'); // May be object has no generated PDF file } } } @@ -349,16 +349,16 @@ if ($action == "builddoc" && $user->rights->facture->lire && ! GETPOST('button_s @chmod($file, octdec($conf->global->MAIN_UMASK)); $langs->load("exports"); - setEventMessage($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog'))); + setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs'); } else { - setEventMessage($langs->trans('NoPDFAvailableForChecked'),'errors'); + setEventMessages($langs->trans('NoPDFAvailableForChecked'), null, 'errors'); } } else { - setEventMessage($langs->trans('InvoiceNotChecked'), 'warnings'); + setEventMessages($langs->trans('InvoiceNotChecked'), null, 'warnings'); } } @@ -371,8 +371,8 @@ if ($action == 'remove_file') $upload_dir = $diroutputpdf; $file = $upload_dir . '/' . GETPOST('file'); $ret=dol_delete_file($file); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); - else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); + if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); + else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); $action=''; } diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 78a93d7da0d..47abb50fb8b 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -75,12 +75,12 @@ if ($action == "new") { $db->commit(); - setEventMessage($langs->trans("RecordSaved")); + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessage($object->error, $object->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } $action=''; diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 51a899c0748..ba65669aca4 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -3,8 +3,8 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2013 Marcos García - * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2013 Marcos García + * 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 @@ -66,7 +66,7 @@ if ($action == 'setnote' && $user->rights->facture->paiement) } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } } @@ -86,7 +86,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture-> else { $langs->load("errors"); - setEventMessage($langs->trans($object->error), 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } } @@ -124,7 +124,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->facture-> else { $langs->load("errors"); - setEventMessage($langs->trans($object->error), 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } } @@ -135,11 +135,11 @@ if ($action == 'setnum_paiement' && ! empty($_POST['num_paiement'])) $res = $object->update_num($_POST['num_paiement']); if ($res === 0) { - setEventMessage($langs->trans('PaymentNumberUpdateSucceeded')); + setEventMessages($langs->trans('PaymentNumberUpdateSucceeded'), null, 'mesgs'); } else { - setEventMessage($langs->trans('PaymentNumberUpdateFailed'), 'errors'); + setEventMessages($langs->trans('PaymentNumberUpdateFailed'), null, 'errors'); } } @@ -150,11 +150,11 @@ if ($action == 'setdatep' && ! empty($_POST['datepday'])) $res = $object->update_date($datepaye); if ($res === 0) { - setEventMessage($langs->trans('PaymentDateUpdateSucceeded')); + setEventMessages($langs->trans('PaymentDateUpdateSucceeded'), null, 'mesgs'); } else { - setEventMessage($langs->trans('PaymentDateUpdateFailed'), 'errors'); + setEventMessages($langs->trans('PaymentDateUpdateFailed'), null, 'errors'); } } diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 803787589fe..163f242b76d 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -79,12 +79,12 @@ if ($action == 'setdate' && $user->rights->banque->cheque) $result=$object->set_date($user,$date); if ($result < 0) { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -98,12 +98,12 @@ if ($action == 'setrefext' && $user->rights->banque->cheque) $result=$object->setValueFrom('ref_ext', $ref_ext); if ($result < 0) { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -117,12 +117,12 @@ if ($action == 'setref' && $user->rights->banque->cheque) $result=$object->set_number($user,$number); if ($result < 0) { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -154,12 +154,12 @@ if ($action == 'create' && $_POST["accountid"] > 0 && $user->rights->banque->che } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } else { - setEventMessage($langs->trans("ErrorSelectAtLeastOne")); + setEventMessages($langs->trans("ErrorSelectAtLeastOne"), null, 'mesgs'); $action='new'; } } @@ -175,7 +175,7 @@ if ($action == 'remove' && $id > 0 && $_GET["lineid"] > 0 && $user->rights->banq } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -190,7 +190,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->c } else { - setEventMessage($paiement->error, 'errors'); + setEventMessages($paiement->error, $paiement->errors, 'errors'); } } @@ -217,7 +217,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->banque->c } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -230,7 +230,7 @@ if ($action == 'confirm_reject_check' && $confirm == 'yes' && $user->rights->ban $paiement_id = $object->rejectCheck($rejected_check, $reject_date); if ($paiement_id > 0) { - setEventMessage($langs->trans("CheckRejectedAndInvoicesReopened")); + setEventMessages($langs->trans("CheckRejectedAndInvoicesReopened"), null, 'mesgs'); //header("Location: ".DOL_URL_ROOT.'/compta/paiement/card.php?id='.$paiement_id); //exit; $action=''; @@ -282,8 +282,8 @@ else if ($action == 'remove_file' && $user->rights->banque->cheque) $file=$dir.get_exdir($object->number,0,1,0,$object,'cheque') . GETPOST('file'); $ret=dol_delete_file($file,0,0,0,$object); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('file'))); - else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors'); + if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs'); + else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors'); } } From f49a33b60009415d529c295671c4729680afb6bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Nov 2015 12:22:21 +0100 Subject: [PATCH 13/21] Try a change for better compatibility with old search form --- htdocs/main.inc.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 354ecb7b611..eb2aa212e7c 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1605,17 +1605,17 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra $langs->load("users"); $searchform.=printSearchForm(DOL_URL_ROOT.'/user/list.php', DOL_URL_ROOT.'/user/list.php', $langs->trans("Users"), 'user', 'sall', 'M', 'searchleftuser', img_object('','user')); } - - // Execute hook printSearchForm - $parameters=array(); - $reshook=$hookmanager->executeHooks('printSearchForm',$parameters); // Note that $action and $object may have been modified by some hooks - if (empty($reshook)) - { - $searchform.=$hookmanager->resPrint; - } - else $searchform=$hookmanager->resPrint; } + // Execute hook printSearchForm + $parameters=array('searchform'=>$searchform); + $reshook=$hookmanager->executeHooks('printSearchForm',$parameters); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) + { + $searchform.=$hookmanager->resPrint; + } + else $searchform=$hookmanager->resPrint; + // Define $bookmarks if (! empty($conf->bookmark->enabled) && $user->rights->bookmark->lire) { From bd7687b6ab766a62df1bb697905108db0ca91dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 12 Nov 2015 17:47:08 +0100 Subject: [PATCH 14/21] Update llx_accounting_account.key.sql --- htdocs/install/mysql/tables/llx_accounting_account.key.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/tables/llx_accounting_account.key.sql b/htdocs/install/mysql/tables/llx_accounting_account.key.sql index 7a38b7dd013..db08831570d 100644 --- a/htdocs/install/mysql/tables/llx_accounting_account.key.sql +++ b/htdocs/install/mysql/tables/llx_accounting_account.key.sql @@ -19,6 +19,7 @@ ALTER TABLE llx_accounting_account ADD INDEX idx_accounting_account_fk_pcg_version (fk_pcg_version); +ALTER TABLE llx_accounting_account ADD INDEX idx_accounting_account_account_number (account_number); ALTER TABLE llx_accounting_account ADD CONSTRAINT fk_accounting_account_fk_pcg_version FOREIGN KEY (fk_pcg_version) REFERENCES llx_accounting_system (pcg_version); From bab41e40e714c96d7398864a2023f1be3017cb6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 12 Nov 2015 17:50:52 +0100 Subject: [PATCH 15/21] Update 3.8.0-3.9.0.sql --- htdocs/install/mysql/migration/3.8.0-3.9.0.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index 13451e55c50..20ec018ad28 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -32,6 +32,8 @@ INSERT INTO llx_const (name, value, type, note, visible) values ('MAIN_SIZE_SHOR ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32); ALTER TABLE llx_accountingaccount MODIFY COLUMN fk_pcg_version varchar(32); +ALTER TABLE llx_accountingaccount RENAME TO llx_accounting_account; +ALTER TABLE llx_accounting_account ADD INDEX idx_accounting_account_account_number (account_number); UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_PREFIX_SPEC')__ WHERE __DECRYPT('name')__ = 'EXPORT_PREFIX_SPEC'; @@ -40,8 +42,6 @@ UPDATE llx_const set value = __ENCRYPT('eldy')__ WHERE __DECRYPT('value')__ = 'b UPDATE llx_const set value = __ENCRYPT('eldy')__ WHERE __DECRYPT('value')__ = 'amarok'; UPDATE llx_const set value = __ENCRYPT('eldy')__ WHERE __DECRYPT('value')__ = 'cameleo'; -ALTER TABLE llx_accountingaccount RENAME TO llx_accounting_account; - ALTER TABLE llx_societe ADD COLUMN model_pdf varchar(255); ALTER TABLE llx_societe_commerciaux ADD COLUMN import_key varchar(14) AFTER fk_user; From b307431348781592f2821ce0f320095a6e89d763 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Nov 2015 19:01:57 +0100 Subject: [PATCH 16/21] Add example of email header to use when sending email from thirdparty card --- dev/mail/source_email_from_thirdparty.txt | 48 +++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 dev/mail/source_email_from_thirdparty.txt diff --git a/dev/mail/source_email_from_thirdparty.txt b/dev/mail/source_email_from_thirdparty.txt new file mode 100644 index 00000000000..e17afa19414 --- /dev/null +++ b/dev/mail/source_email_from_thirdparty.txt @@ -0,0 +1,48 @@ +Content-Type: multipart/mixed; boundary="===============4543832834454763172==" +Date: Thu, 12 Nov 2015 17:58:00 -0000 +From: Administrator +MIME-Version: 1.0 +Message-ID: 5nLkUQEIn50FnlwxWDkh59NfLof1ode0uC5cZEgm9Y4=@mailhog.example +Message-Id: <1447351080.369951963424683.576889035053436-dolibarr-7-thirdparty@PCHOME-LD> +Received: from pchome-ld by mailhog.example (Go-MailHog) + id 5nLkUQEIn50FnlwxWDkh59NfLof1ode0uC5cZEgm9Y4=@mailhog.example; Thu, 12 Nov 2015 18:58:00 +0100 +Reply-To: Administrator +Return-Path: +Subject: A test email from thirdparty card +To: Thirdparty company + +--===============4543832834454763172== +Content-Type: multipart/alternative; + boundary="===============8764907306434163361==" +MIME-Version: 1.0 + +--===============8764907306434163361== +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: base64 + +dGVzdDIKCi0tCkFkbWluaXN0cmF0b3IKClNlbnQgYnkgWW91ckNvbXBhbnkgWzFdIHVzaW5nIE9k +b28gWzJdCgosICBhY2Nlc3MgZGlyZWN0bHkgdG8gUGFydG5lciBBZ3JvbGFpdCBbM10KCgpbMV0g +aHR0cDovL3d3dy5leGFtcGxlLmNvbQpbMl0gaHR0cHM6Ly93d3cub2Rvby5jb20vClszXSBodHRw +Oi8vbG9jYWxob3N0OjgxNjkvd2ViL3NpZ251cD9yZWRpcmVjdD0lMkZ3ZWIlMjNhY3Rpb24lM0Rt +YWlsLmFjdGlvbl9tYWlsX3JlZGlyZWN0JTI2bW9kZWwlM0RyZXMucGFydG5lciUyNmlkJTNENyZ0 +b2tlbj1nM0s0QWU1T0Q5a3UxaEVubVZUQiZkYj1vZG9vX3Y4Cg== + +--===============8764907306434163361== +Content-Type: text/html; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: base64 + +PHA+dGVzdDI8L3A+Cgo8c3Bhbj4tLTxicj4KQWRtaW5pc3RyYXRvcjwvc3Bhbj4KCjxiciAvPjxz +bWFsbD5TZW50IGJ5IDxhIHN0eWxlPSdjb2xvcjppbmhlcml0JyBocmVmPSdodHRwOi8vd3d3LmV4 +YW1wbGUuY29tJz5Zb3VyQ29tcGFueTwvYT4gdXNpbmcgPGEgc3R5bGU9J2NvbG9yOmluaGVyaXQn +IGhyZWY9J2h0dHBzOi8vd3d3Lm9kb28uY29tLyc+T2RvbzwvYT48L3NtYWxsPgoKCiwgPHNwYW4g +Y2xhc3M9J29lX21haWxfZm9vdGVyX2FjY2Vzcyc+PHNtYWxsPmFjY2VzcyBkaXJlY3RseSB0byA8 +YSBzdHlsZT0nY29sb3I6aW5oZXJpdCcgaHJlZj0naHR0cDovL2xvY2FsaG9zdDo4MTY5L3dlYi9z +aWdudXA/cmVkaXJlY3Q9JTJGd2ViJTIzYWN0aW9uJTNEbWFpbC5hY3Rpb25fbWFpbF9yZWRpcmVj +dCUyNm1vZGVsJTNEcmVzLnBhcnRuZXIlMjZpZCUzRDcmdG9rZW49ZzNLNEFlNU9EOWt1MWhFbm1W +VEImZGI9b2Rvb192OCc+UGFydG5lciBBZ3JvbGFpdDwvYT48L3NtYWxsPjwvc3Bhbj4K + +--===============8764907306434163361==-- + +--===============4543832834454763172==-- \ No newline at end of file From b2285ca5e0f7dd2b7a625a8607e5f3706fc5b40b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Nov 2015 21:25:01 +0100 Subject: [PATCH 17/21] Option MAIN_EMAIL_ADD_TRACK_ID is now set to 1 by default. All emails sent from Dolibarr have a dedicated tracking id. --- htdocs/comm/askpricesupplier/card.php | 10 ++++++++++ htdocs/comm/propal.php | 9 +++++++++ htdocs/commande/card.php | 9 +++++++++ htdocs/compta/facture.php | 9 +++++++++ htdocs/compta/facture/mergepdftool.php | 9 +++++++++ htdocs/core/class/conf.class.php | 3 ++- htdocs/expedition/card.php | 9 +++++++++ htdocs/fichinter/card.php | 9 +++++++++ htdocs/fourn/commande/card.php | 9 +++++++++ htdocs/fourn/facture/card.php | 9 +++++++++ 10 files changed, 84 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/askpricesupplier/card.php b/htdocs/comm/askpricesupplier/card.php index 389905c3d94..900ef57d56a 100644 --- a/htdocs/comm/askpricesupplier/card.php +++ b/htdocs/comm/askpricesupplier/card.php @@ -1786,6 +1786,16 @@ if ($action == 'create') $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set + { + $formmail->trackid='spr'.$object->id; + } + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set + { + include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'spr'.$object->id); + } + $formmail->withfrom = 1; $liste = array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 1107e3b9b4d..a52b9cbff1c 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -2304,6 +2304,15 @@ if ($action == 'create') $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set + { + $formmail->trackid='pro'.$object->id; + } + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set + { + include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'pro'.$object->id); + } $formmail->withfrom = 1; $liste = array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 65540732674..651b9faf6f6 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2402,6 +2402,15 @@ if ($action == 'create' && $user->rights->commande->creer) $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set + { + $formmail->trackid='ord'.$object->id; + } + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set + { + include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'ord'.$object->id); + } $formmail->withfrom = 1; $liste = array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 29788e14408..1f1024124be 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3839,6 +3839,15 @@ else if ($id > 0 || ! empty($ref)) $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set + { + $formmail->trackid='inv'.$object->id; + } + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set + { + include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'inv'.$object->id); + } $formmail->withfrom = 1; $liste = array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) { diff --git a/htdocs/compta/facture/mergepdftool.php b/htdocs/compta/facture/mergepdftool.php index e0b821683ce..1b14a019170 100644 --- a/htdocs/compta/facture/mergepdftool.php +++ b/htdocs/compta/facture/mergepdftool.php @@ -574,6 +574,15 @@ if ($resql) $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set + { + $formmail->trackid='inv'.$object->id; + } + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set + { + include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'inv'.$object->id); + } $formmail->withfrom=1; $liste=array(); $formmail->withto=$langs->trans("AllRecipientSelectedForRemind"); diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 53be6607f38..9aa2d868369 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -418,7 +418,8 @@ class Conf // conf->mailing->email_from = email pour envoi par Dolibarr des mailings $this->mailing->email_from=$this->email_from; if (! empty($this->global->MAILING_EMAIL_FROM)) $this->mailing->email_from=$this->global->MAILING_EMAIL_FROM; - + if (! isset($conf->global->MAIN_EMAIL_ADD_TRACK_ID)) $conf->global->MAIN_EMAIL_ADD_TRACK_ID=1; + // Format for date (used by default when not found or not searched in lang) $this->format_date_short="%d/%m/%Y"; // Format of day with PHP/C tags (strftime functions) $this->format_date_short_java="dd/MM/yyyy"; // Format of day with Java tags diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 3ca2c18bf6c..6a236ab534e 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1620,6 +1620,15 @@ else if ($id || $ref) $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set + { + $formmail->trackid='shi'.$object->id; + } + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set + { + include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'shi'.$object->id); + } $formmail->withfrom=1; $liste=array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index a247341cdec..e9b4d94bee6 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1816,6 +1816,15 @@ else if ($id > 0 || ! empty($ref)) $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set + { + $formmail->trackid='int'.$object->id; + } + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set + { + include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'int'.$object->id); + } $formmail->withfrom=1; $liste=array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 904cd5b3133..e80f1e6a9f1 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2321,6 +2321,15 @@ elseif (! empty($object->id)) $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set + { + $formmail->trackid='sor'.$object->id; + } + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set + { + include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'sor'.$object->id); + } $formmail->withfrom=1; $liste=array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index f3f9dc6afa3..1084bbe3821 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2322,6 +2322,15 @@ else $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set + { + $formmail->trackid='sin'.$object->id; + } + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set + { + include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'sin'.$object->id); + } $formmail->withfrom=1; $liste=array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value; From 4065b3f1dfc0514f22ff9231a029f679c941fad0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Nov 2015 00:19:11 +0100 Subject: [PATCH 18/21] Better management of the Dolibarr tracking id into email. This will allow an imap scanner to link email --- htdocs/admin/mails.php | 8 ++++++-- htdocs/core/actions_sendmails.inc.php | 18 +++++++++--------- htdocs/core/class/CMailFile.class.php | 6 ++++-- htdocs/core/class/smtps.class.php | 6 ++++-- htdocs/core/lib/functions.lib.php | 4 ++++ htdocs/theme/eldy/style.css.php | 2 +- 6 files changed, 28 insertions(+), 16 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 271605830bc..b084f21164c 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -152,7 +152,8 @@ if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GE $subject = $_POST['subject']; $body = $_POST['message']; $deliveryreceipt= $_POST["deliveryreceipt"]; - + $trackid = GETPOST('trackid'); + //Check if we have to decode HTML if (!empty($conf->global->FCKEDITOR_ENABLE_MAILING) && dol_textishtml(dol_html_entity_decode($body, ENT_COMPAT | ENT_HTML401))) { $body=dol_html_entity_decode($body, ENT_COMPAT | ENT_HTML401); @@ -202,7 +203,9 @@ if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GE $sendtoccc, $deliveryreceipt, $msgishtml, - $errors_to + $errors_to, + '', + $trackid ); $result=$mailfile->sendfile(); @@ -693,6 +696,7 @@ else $formmail = new FormMail($db); $formmail->fromname = (isset($_POST['fromname'])?$_POST['fromname']:$conf->global->MAIN_MAIL_EMAIL_FROM); $formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM); + $formmail->trackid='test'; $formmail->withfromreadonly=0; $formmail->withsubstit=0; $formmail->withfrom=1; diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index a4e83a0fd59..1f96d085bb8 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -221,11 +221,12 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $filename = $attachedfiles['names']; $mimetype = $attachedfiles['mimes']; - $trackid = GETPOST('trackid','aZ'); + $trackid = GETPOST('trackid','aZ09'); - if($conf->dolimail->enabled) + // Feature to push mail sent into Sent folder + if (! empty($conf->dolimail->enabled)) { - $mailfromid = explode ("#", $_POST['frommail'],3); + $mailfromid = explode("#", $_POST['frommail'],3); // $_POST['frommail'] = 'aaa#Sent# ' // TODO Use a better way to define Sent dir. if (count($mailfromid)==0) $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; else { @@ -243,7 +244,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO { $folder=str_replace($ref, '', $mailboxconfig->folder_cache_key); - if (!$folder) $folder = "Sent"; + if (!$folder) $folder = "Sent"; // Default Sent folder $mailboxconfig->mbox = imap_open($mailboxconfig->get_connector_url().$folder, $mailboxconfig->mailbox_imap_login, $mailboxconfig->mailbox_imap_password); if (FALSE === $mailboxconfig->mbox) @@ -276,17 +277,16 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO if ($result) { $error=0; - if($conf->dolimail->enabled) + if (! empty($conf->dolimail->enabled)) { - $mid = (GETPOST('mid','int') ? GETPOST('mid','int') : 0); + $mid = (GETPOST('mid','int') ? GETPOST('mid','int') : 0); // Original mail id is set ? if ($mid) { - // set imap flag answered if it is a answered mail - + // set imap flag answered if it is an answered mail $dolimail=new DoliMail($db); $dolimail->id = $mid; $res=$dolimail->set_prop($user, 'answered',1); - } + } if ($imap==1) { // write mail to IMAP Server diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index b3da46ff366..82d1444ff73 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -708,8 +708,10 @@ class CMailFile $trackid = $this->trackid; if ($trackid) { - $out.= 'Message-ID: <' . time() . '.phpmail-'.$trackid.'@' . $host . ">" . $this->eol2; - $out.= 'references: <' . time() . '.phpmail-'.$trackid.'@' . $host . ">" . $this->eol2; + // References is kept in response and Message-ID is returned into In-Reply-To: + $out.= 'Message-ID: <' . time() . '.phpmail-dolibarr-'.$trackid.'@' . $host . ">" . $this->eol2; // Uppercase seems replaced by phpmail + $out.= 'References: <' . time() . '.phpmail-dolibarr-'.$trackid.'@' . $host . ">" . $this->eol2; + $out.= 'X-Dolibarr-TRACKID: '.$trackid. $this->eol2; } else { diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 51d9dd621dc..dd2726d2306 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1133,8 +1133,10 @@ class SMTPs $trackid = $this->getTrackId(); if ($trackid) { - $_header .= 'Message-ID: <' . time() . '.SMTPs-'.$trackid.'@' . $host . ">\r\n"; - $_header .= 'references: <' . time() . '.SMTPs-'.$trackid.'@' . $host . ">\r\n"; + // References is kept in response and Message-ID is returned into In-Reply-To: + $_header .= 'Message-ID: <' . time() . '.SMTPs-dolibarr-'.$trackid.'@' . $host . ">\r\n"; + $_header .= 'References: <' . time() . '.SMTPs-dolibarr-'.$trackid.'@' . $host . ">\r\n"; + $_header .= 'X-Dolibarr-TRACKID: ' . $trackid . "\r\n"; } else { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 013217a9f57..2eae6360ffa 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -263,6 +263,10 @@ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL) $out=trim($out); if (preg_match('/[^a-z]+/i',$out)) $out=''; break; + case 'aZ09': + $out=trim($out); + if (preg_match('/[^a-z0-9]+/i',$out)) $out=''; + break; case 'array': if (! is_array($out) || empty($out)) $out=array(); break; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index b57fa159b17..7f97637cf55 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -232,7 +232,7 @@ body { background: rgb(); - color: #101010; + color: rgb(); font-size: px; font-family: ; margin-top: 0; From e2e804e37a6ad44dfbc1a7f7740afd176c40342f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Nov 2015 00:30:10 +0100 Subject: [PATCH 19/21] Minor fix --- htdocs/margin/tabs/thirdpartyMargins.php | 7 ++++--- htdocs/societe/soc.php | 16 ++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 9f2f745ad0c..147afc124fc 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -124,12 +124,13 @@ if ($socid > 0) print "
"; - dol_fiche_end(); - print '
'; print '
'; - + dol_fiche_end(); + + print '
'; + $sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client,"; $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht,"; $sql.= " f.datef, f.paye, f.fk_statut as statut, f.type,"; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 8b640040b80..b7465abe85b 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -2138,6 +2138,14 @@ else print ''.$langs->trans("ThirdPartyType").''.$object->typent.''; print ''.$langs->trans("Staff").''.$object->effectif.''; + print ''; + + print ''; + print '
'; + + print '
'; + print ''; + // Legal print ''; @@ -2147,14 +2155,6 @@ else else print ' '; print ''; - print '
'.$langs->trans('JuridicalStatus').''.$object->forme_juridique.'
'; - - print '
'; - print '
'; - - print '
'; - print ''; - // Default language if (! empty($conf->global->MAIN_MULTILANGS)) { From 471bcdd29f273527e98e5801e01d5941c7707b0e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Nov 2015 02:11:47 +0100 Subject: [PATCH 20/21] Remove hard coded list of permissions. --- htdocs/admin/oauth.php | 9 +++--- ...hcallback.php => google_oauthcallback.php} | 24 ++++++++++++---- .../modules/printing/printgcp.modules.php | 14 ++++++---- htdocs/langs/en_US/oauth.lang | 7 +++-- htdocs/langs/en_US/printing.lang | 4 +-- htdocs/printing/admin/printing.php | 28 ++++++++----------- htdocs/printing/lib/printing.lib.php | 4 +-- 7 files changed, 50 insertions(+), 40 deletions(-) rename htdocs/core/modules/oauth/{getgoogleoauthcallback.php => google_oauthcallback.php} (85%) diff --git a/htdocs/admin/oauth.php b/htdocs/admin/oauth.php index 66878753b46..2adf79a6174 100644 --- a/htdocs/admin/oauth.php +++ b/htdocs/admin/oauth.php @@ -43,8 +43,9 @@ if (!$user->admin) $action = GETPOST('action', 'alpha'); -// Supported OAUTH -$supportedoauth2array=array('OAUTH_GOOGLE_NAME'); +// Supported OAUTH (a provider is supported when a file xxx_oauth2callback.php is available into htdocs/core/modules/oauth) +$supportedoauth2array=array('OAUTH_GOOGLE_NAME'=>'google'); + // API access parameters OAUTH $list = array ( array( @@ -315,7 +316,7 @@ $var = true; foreach ($list as $key) { $supported=0; - if (in_array($key[0], $supportedoauth2array)) $supported=1; + if (in_array($key[0], array_keys($supportedoauth2array))) $supported=1; if (! $supported) continue; // show only supported print ''; @@ -325,7 +326,7 @@ foreach ($list as $key) if ($supported) { - $redirect_uri=$urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php'; + $redirect_uri=$urlwithroot.'/core/modules/oauth/'.$supportedoauth2array[$key[0]].'_oauthcallback.php'; $var = !$var; print ''; print ''; diff --git a/htdocs/core/modules/oauth/getgoogleoauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php similarity index 85% rename from htdocs/core/modules/oauth/getgoogleoauthcallback.php rename to htdocs/core/modules/oauth/google_oauthcallback.php index e159198314c..43232ed92f2 100644 --- a/htdocs/core/modules/oauth/getgoogleoauthcallback.php +++ b/htdocs/core/modules/oauth/google_oauthcallback.php @@ -24,10 +24,8 @@ require '../../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; -use OAuth\Common\Storage\Session; use OAuth\Common\Storage\DoliStorage; use OAuth\Common\Consumer\Credentials; -use OAuth\Common\Token\TokenInterface; use OAuth\OAuth2\Service\Google; // Define $urlwithroot @@ -72,11 +70,18 @@ $credentials = new Credentials( $currentUri->getAbsoluteUri() ); +$requestedpermissionsarray=array(); +if (GETPOST('state')) $requestedpermissionsarray=explode(',', GETPOST('state')); // Example: 'userinfo_email,userinfo_profile,cloud_print'. 'state' parameter is standard to retrieve some parameters back +if ($action != 'delete' && empty($requestedpermissionsarray)) +{ + print 'Error, parameter state is not defined'; + exit; +} +//var_dump($requestedpermissionsarray);exit; // Instantiate the Api service using the credentials, http client and storage mechanism for the token /** @var $apiService Service */ -// TODO remove hardcoded array -$apiService = $serviceFactory->createService('Google', $credentials, $storage, array('userinfo_email', 'userinfo_profile', 'cloud_print')); +$apiService = $serviceFactory->createService('Google', $credentials, $storage, $requestedpermissionsarray); // access type needed for google refresh token $apiService->setAccessType('offline'); @@ -129,11 +134,18 @@ if (! empty($_GET['code'])) // We are coming from Google oauth page header('Location: ' . $backtourl); exit(); } -else +else // If entry on page with no parameter, we arrive here { $_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl; - $url = $apiService->getAuthorizationUri(); + if (GETPOST('state')) + { + $url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state'))); + } + else + { + $url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated + } // we go on google authorization page header('Location: ' . $url); exit(); diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index aab1ae13bb6..7c6e965f778 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -113,18 +113,20 @@ class printing_printgcp extends PrintingDriver if ($this->google_id != '' && $this->google_secret != '') { $this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthConfigured', 'type'=>'info'); - $this->conf[] = array('varname'=>'PRINTGCP_TOKEN_ACCESS', 'info'=>$access, 'type'=>'info'); + $this->conf[] = array('varname'=>'PRINTGCP_TOKEN_ACCESS', 'info'=>$access, 'type'=>'info', 'renew'=>$urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php?state=userinfo_email,userinfo_profile,cloud_print&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'delete'=>($storage->hasAccessToken('Google')?$urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'):'')); if ($token_ok) { $refreshtoken = $token->getRefreshToken(); - $this->conf[] = array('varname'=>'PRINTGCP_TOKEN_REFRESH', 'info'=>((! empty($refreshtoken))?'Yes':'No'), 'type'=>'info'); - $this->conf[] = array('varname'=>'PRINTGCP_TOKEN_EXPIRED', 'info'=>($expire?'Yes':'No'), 'type'=>'info'); + $this->conf[] = array('varname'=>'PRINTGCP_TOKEN_REFRESH', 'info'=>((! empty($refreshtoken))?'Yes':'No'), 'type'=>'info'); + $this->conf[] = array('varname'=>'PRINTGCP_TOKEN_EXPIRED', 'info'=>($expire?'Yes':'No'), 'type'=>'info'); $this->conf[] = array('varname'=>'PRINTGCP_TOKEN_EXPIRE_AT', 'info'=>(dol_print_date($token->getEndOfLife(), "dayhour")), 'type'=>'info'); } - if (!$storage->hasAccessToken('Google')) { + /* + if ($storage->hasAccessToken('Google')) { $this->conf[] = array('varname'=>'PRINTGCP_AUTHLINK', 'link'=>$urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'type'=>'authlink'); - } else { $this->conf[] = array('varname'=>'PRINTGCP_DELETE_TOKEN', 'link'=>$urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'type'=>'delete'); - } + } else { + $this->conf[] = array('varname'=>'PRINTGCP_AUTHLINK', 'link'=>$urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'type'=>'authlink'); + }*/ } else { $this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthNotConfigured', 'type'=>'info'); } diff --git a/htdocs/langs/en_US/oauth.lang b/htdocs/langs/en_US/oauth.lang index 4567af2a0b6..b902ff27098 100644 --- a/htdocs/langs/en_US/oauth.lang +++ b/htdocs/langs/en_US/oauth.lang @@ -1,9 +1,12 @@ # Dolibarr language file - Source file is en_US - oauth ConfigOAuth=Oauth Configuration -NoAccessToken=No token access saved. -HasAccessToken=A token was generated and saved into database +NoAccessToken=No access token saved into local database +HasAccessToken=A token was generated and saved into local database NewTokenStored=Token received ans saved +ToCheckDeleteTokenOnProvider=To check/delete authorization saved by %s OAuth provider TokenDeleted=Token deleted +RequestAccess=Click here to request/renew access and receive a new token to save +DeleteAccess=Click here to delete token UseTheFollowingUrlAsRedirectURI=Use the following URL as the Redirect URI when creating your credential on your OAuth provider: ListOfSupportedOauthProviders=Enter here credential provided by your OAuth2 provider. Only supported OAuth2 providers are visible here. This setup may be used by other modules than need OAuth2 authentication. OAUTH_AMAZON_NAME=Api Amazon diff --git a/htdocs/langs/en_US/printing.lang b/htdocs/langs/en_US/printing.lang index ab70ca671d7..427b4973e80 100644 --- a/htdocs/langs/en_US/printing.lang +++ b/htdocs/langs/en_US/printing.lang @@ -18,15 +18,13 @@ TestDriver=Test TargetedPrinter=Targeted printer UserConf=Setup per user PRINTGCP=Google Cloud Print -PRINTGCP_INFO=Google Api State +PRINTGCP_INFO=Google OAuth API setup PRINTGCP_AUTHLINK=Authentication PRINTGCP_TOKEN_ACCESS=Google Cloud Print OAuth Token PRINTGCP_TOKEN_REFRESH=Token Refresh Present PRINTGCP_TOKEN_EXPIRED=Token Expired PRINTGCP_TOKEN_EXPIRE_AT=Token expire at PRINTGCP_DELETE_TOKEN=Delete saved token -RequestAccess=Click here to request access and receive a token to save -DeleteAccess=Click here to delete token PrintGCPDesc=This driver allow to send documents directly to a printer with Google Cloud Print. PrintingDriverDescprintgcp=Configuration variables for printing driver Google Cloud Print. PrintTestDescprintgcp=List of Printers for Google Cloud Print. diff --git a/htdocs/printing/admin/printing.php b/htdocs/printing/admin/printing.php index ce87a5c7178..ea051113faa 100644 --- a/htdocs/printing/admin/printing.php +++ b/htdocs/printing/admin/printing.php @@ -45,6 +45,7 @@ if (! empty($driver)) $langs->load($driver); if (!$mode) $mode='config'; + /* * Action */ @@ -155,25 +156,18 @@ if ($mode == 'setup' && $user->admin) print ''; print ''."\n"; break; - case "authlink": - print ''; - print ''; - print ''; - print ''; - print ''."\n"; - break; - case "delete": - print ''; - print ''; - print ''; - print ''; - print ''."\n"; - break; - case "info": + case "info": // Google Api setup or Google OAuth Token print ''; print ''.$langs->trans($key['varname']).''; print ''; - print ''; + print ''; print ''."\n"; break; case "submit": @@ -225,7 +219,7 @@ if ($mode == 'config' && $user->admin) //print '
'.print_r($printer, true).'
'; $var=!$var; print ''; - print ''; + print ''; print ''; print ''; print ''; print ''."\n"; @@ -360,7 +360,7 @@ if ($result) { if ($caneditperms) { - print ''; + print ''; } print ''; + print ''; } print ''; } @@ -396,7 +396,7 @@ if ($result) // Do not own permission if ($caneditperms) { - print ''; + print ''; } print ''; }
'.$langs->trans("UseTheFollowingUrlAsRedirectURI").' '.($key['example']!=''?$langs->trans("Example").' : '.$key['example']:'').'
'.$langs->trans($key['varname']).''.$langs->trans('RequestAccess').' 
'.$langs->trans($key['varname']).''.$langs->trans('DeleteAccess').' 
'.$langs->trans($key['info']).' '; + if ($key['varname'] == 'PRINTGCP_TOKEN_ACCESS') + { + if (! empty($key['delete'])) print ''.$langs->trans('DeleteAccess').'

'; + print ''.$langs->trans('RequestAccess').'

'; + print $langs->trans("ToCheckDeleteTokenOnProvider", 'Google').': https://security.google.com/settings/security/permissions'; + } + print '
'.img_picto('', $printer->picto).$langs->trans($printer->desc).''.img_picto('', $printer->picto).' '.$langs->trans($printer->desc).''; if (! empty($conf->use_javascript_ajax)) { diff --git a/htdocs/printing/lib/printing.lib.php b/htdocs/printing/lib/printing.lib.php index 59e2e1e0048..697e986cd56 100644 --- a/htdocs/printing/lib/printing.lib.php +++ b/htdocs/printing/lib/printing.lib.php @@ -43,7 +43,7 @@ function printingadmin_prepare_head($mode) if ($mode == 'setup') { - $head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=setup"; + $head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=setup&driver=".GETPOST('driver','alpha'); $head[$h][1] = $langs->trans("SetupDriver"); $head[$h][2] = 'setup'; $h++; @@ -51,7 +51,7 @@ function printingadmin_prepare_head($mode) if ($mode == 'test') { - $head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=test"; + $head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=test&driver=".GETPOST('driver','alpha'); $head[$h][1] = $langs->trans("TargetedPrinter"); $head[$h][2] = 'test'; $h++; From 64c783623b74ae9dca066311548d9befc612b8f1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Nov 2015 03:35:55 +0100 Subject: [PATCH 21/21] NEW Framework feature. To have a page being loaded at same scrollbar level wafter a click on a href link, just add the class "reposition" on this link. --- htdocs/admin/modules.php | 9 ++++--- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/js/lib_head.js | 37 ++++++++++----------------- htdocs/core/lib/functions.lib.php | 16 ++++++++++++ htdocs/theme/eldy/style.css.php | 3 +++ htdocs/user/perms.php | 10 ++++---- 6 files changed, 43 insertions(+), 34 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 14c95aa0d2e..25868b7b2c2 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -37,6 +37,7 @@ $langs->load("admin"); $mode=GETPOST('mode', 'alpha')?GETPOST('mode', 'alpha'):(isset($_SESSION['mode'])?$_SESSION['mode']:0); $action=GETPOST('action','alpha'); $value=GETPOST('value', 'alpha'); +$page_y=GETPOST('page_y','int'); if (! $user->admin) accessforbidden(); @@ -67,7 +68,7 @@ if ($action == 'set' && $user->admin) { $result=activateModule($value); if ($result) setEventMessages($result, null, 'errors'); - header("Location: modules.php?mode=".$mode); + header("Location: modules.php?mode=".$mode.($page_y?'&page_y='.$page_y:'')); exit; } @@ -75,7 +76,7 @@ if ($action == 'reset' && $user->admin) { $result=unActivateModule($value); if ($result) setEventMessages($result, null, 'errors'); - header("Location: modules.php?mode=".$mode); + header("Location: modules.php?mode=".$mode.($page_y?'&page_y='.$page_y:'')); exit; } @@ -425,7 +426,7 @@ if ($mode != 'marketplace') } else { - print ''; + print ''; print img_picto($langs->trans("Activated"),'switch_on'); print ''; } @@ -488,7 +489,7 @@ if ($mode != 'marketplace') else { // Module non actif - print ''; + print ''; print img_picto($langs->trans("Disabled"),'switch_off'); print "\n"; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2198cd9df13..a1b6cb45db8 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4828,7 +4828,7 @@ class Form $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text foreach($ways as $way) { - $toprint[] = '
  • color?' style="background: #'.$c->color.'"':'').'>'.img_object('','category').' '.$way.'
  • '; + $toprint[] = '
  • color?' style="background: #'.$c->color.';"':'').'>'.img_object('','category').' '.$way.'
  • '; } } return '
      '.implode(' ', $toprint).'
    '; diff --git a/htdocs/core/js/lib_head.js b/htdocs/core/js/lib_head.js index 6ddfa529bee..eab995d062b 100644 --- a/htdocs/core/js/lib_head.js +++ b/htdocs/core/js/lib_head.js @@ -924,28 +924,17 @@ function copyToClipboard(text,text2) } -/* - * Timer for delayed keyup function - * - * TODO Who use this ? - */ /* -(function($){ - $.widget("ui.onDelayedKeyup", { - _init : function() { - var self = this; - $(this.element).bind('keyup input', function() { - if(typeof(window['inputTimeout']) != "undefined"){ - window.clearTimeout(inputTimeout); - } - var handler = self.options.handler; - window['inputTimeout'] = window.setTimeout(function() { handler.call(self.element) }, self.options.delay); - }); - }, - options: { - handler: $.noop(), - delay: 500 - } - }); -})(jQuery); -*/ + * Provide a function to get an URL GET parameter in javascript + * + * @param string name Name of parameter + * @param mixed valueifnotfound Value if not found + * @return string Value + */ +function getParameterByName(name, valueifnotfound) +{ + name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); + var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), + results = regex.exec(location.search); + return results === null ? valueifnotfound : decodeURIComponent(results[1].replace(/\+/g, " ")); +} diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2eae6360ffa..daa96d76775 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5047,6 +5047,22 @@ function printCommonFooter($zone='private') if (! empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER."\n"; + print "\n"; + print ''."\n"; + // Google Analytics (need Google module) if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID)) { diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 7f97637cf55..59461c1db87 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -3595,6 +3595,9 @@ a span.select2-chosen overflow: hidden; } +.noborderoncategories { + border: none !important; +} /* ============================================================================== */ /* Multiselect with checkbox */ diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index ae32a624175..fa54a128cac 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -331,9 +331,9 @@ if ($result) print '
    '.img_object('',$picto).' '.$objMod->getName(); print ' '; - print ''.$langs->trans("All").""; + print ''.$langs->trans("All").""; print '/'; - print ''.$langs->trans("None").""; + print ''.$langs->trans("None").""; print ' 
    '.img_edit_remove($langs->trans("Remove")).''.img_edit_remove($langs->trans("Remove")).''; print img_picto($langs->trans("Active"),'tick'); @@ -386,7 +386,7 @@ if ($result) // Do not own permission if ($caneditperms) { - print ''.img_edit_add($langs->trans("Add")).''.img_edit_add($langs->trans("Add")).' '.img_edit_add($langs->trans("Add")).''.img_edit_add($langs->trans("Add")).'