From ccc415204ef07c8b51aa1ae7ce2b8c60974dc127 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 10 Sep 2018 16:46:16 +0200 Subject: [PATCH 01/15] V8 style --- htdocs/stripe/payment.php | 41 ++++++++++++++------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index 1113d1428f5..3ff02641c0b 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -8,6 +8,7 @@ * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2018 ThibaultFOUCART * * 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 @@ -640,36 +641,24 @@ print 'id!=$source) or ($src->object=='source' && $src->card->three_d_secure=='required')) { print'class="opacitymedium"';} print' >'; -if ($src->object=='card'){ -if ($src->brand == 'Visa') {$brand='cc-visa';} -elseif ($src->brand == 'MasterCard') {$brand='cc-mastercard';} -elseif ($src->brand == 'American Express') {$brand='cc-amex';} -elseif ($src->brand == 'Discover') {$brand='cc-discover';} -elseif ($src->brand == 'JCB') {$brand='cc-jcb';} -elseif ($src->brand == 'Diners Club') {$brand='cc-diners-club';} -else {$brand='credit-card-alt';} -print ''; -} -elseif ($src->object=='source' && $src->type=='card'){ -if ($src->card->brand == 'Visa') {$brand='cc-visa';} -elseif ($src->card->brand == 'MasterCard') {$brand='cc-mastercard';} -elseif ($src->card->brand == 'American Express') {$brand='cc-amex';} -elseif ($src->card->brand == 'Discover') {$brand='cc-discover';} -elseif ($src->card->brand == 'JCB') {$brand='cc-jcb';} -elseif ($src->card->brand == 'Diners Club') {$brand='cc-diners-club';} -else {$brand='credit-card-alt';} - -print ''; -} -elseif ($src->object=='source' && $src->type=='sepa_debit'){ -print ''; -} + if ($src->object=='card') + { + print img_credit_card($src->brand); + } + elseif ($src->object=='source' && $src->type=='card') + { + print img_credit_card($src->card->brand); + } + elseif ($src->object=='source' && $src->type=='sepa_debit') + { + print ''; + } print ''; print 'id!=$source) or ($src->object=='source' && $src->card->three_d_secure=='required')) { print'class="opacitymedium"';} print' >'; if ($src->object=='card'){ -print '**** '.$src->last4.'
Exp. '.$src->exp_month.'/'.$src->exp_year.''; + print '....'.$src->last4.' - '.$src->exp_month.'/'.$src->exp_year.''; print ''; if ($src->country) { @@ -680,7 +669,7 @@ print ''; else print img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).''; } elseif ($src->object=='source' && $src->type=='card'){ - print $src->owner->name.'
**** '.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; + print $src->owner->name.'
....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; print ''; if ($src->card->country) { From 849b7154a716e51f14bb52e1acfe6ff5ba1db47c Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 11 Sep 2018 10:59:25 +0200 Subject: [PATCH 02/15] add capture option in payment function --- htdocs/stripe/class/stripe.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index b8472d0b821..1b99bb22e14 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -326,7 +326,7 @@ class Stripe extends CommonObject * @param int $usethirdpartyemailforreceiptemail Use thirdparty email as receipt email * @return Stripe */ - public function createPaymentStripe($amount, $currency, $origin, $item, $source, $customer, $account, $status=0, $usethirdpartyemailforreceiptemail=0) + public function createPaymentStripe($amount, $currency, $origin, $item, $source, $customer, $account, $status=0, $usethirdpartyemailforreceiptemail=0, $capture=true) { global $conf; @@ -406,6 +406,7 @@ class Stripe extends CommonObject "currency" => "$currency", // "statement_descriptor" => " ", "description" => "$description", + "capture" => $capture, "metadata" => $metadata, "source" => "$source", "customer" => "$customer" @@ -430,6 +431,7 @@ class Stripe extends CommonObject "currency" => "$currency", // "statement_descriptor" => " ", "description" => "$description", + "capture" => $capture, "metadata" => $metadata, "source" => "$source", "customer" => "$customer", From 7f3f0f3643ed9ec2941697a0f078d8ea6e2ac172 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 11 Sep 2018 12:10:48 +0200 Subject: [PATCH 03/15] Fix status display in transaction.php --- htdocs/stripe/transaction.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index fc7ffa828e0..1cdabffdac4 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -194,7 +194,12 @@ if (! $rowid) { print "" . price(($txn->fee) / 100) . ""; // Status print ""; - print $txn->status; +if ($txn->status=='available') + {print img_picto($langs->trans("".$txn->status.""),'statut4');} +elseif ($txn->status=='pending') + {print img_picto($langs->trans("".$txn->status.""),'statut7');} +elseif ($txn->status=='failed') + {print img_picto($langs->trans("".$txn->status.""),'statut8');} print ''; print "\n"; } From 2f2dff815532593c36f5c34c8e1d48d3b7b3bf6d Mon Sep 17 00:00:00 2001 From: Jean-Marie Arsac Date: Tue, 11 Sep 2018 14:57:31 +0200 Subject: [PATCH 04/15] Convert localized numeric extrafields value before inserting - add 'double' case in insertExtraFields and updateExtraFields to to convert localized value using price2num() --- htdocs/core/class/commonobject.class.php | 36 ++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index dae9827e0e4..3a9f5e96c9b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4851,6 +4851,9 @@ abstract class CommonObject } } + //dol_syslog("attributeLabel=".$attributeLabel, LOG_DEBUG); + //dol_syslog("attributeType=".$attributeType, LOG_DEBUG); + switch ($attributeType) { case 'int': @@ -4864,6 +4867,21 @@ abstract class CommonObject $new_array_options[$key] = null; } break; + case 'double': + $value = price2num($value); + if (!is_numeric($value) && $value!='') + { + dol_syslog($langs->trans("ExtraFieldHasWrongValue")." sur ".$attributeLabel."(".$value."is not '".$attributeType."')", LOG_DEBUG); + $this->errors[]=$langs->trans("ExtraFieldHasWrongValue", $attributeLabel); + return -1; + } + elseif ($value=='') + { + $new_array_options[$key] = null; + } + //dol_syslog("double value"." sur ".$attributeLabel."(".$value." is '".$attributeType."')", LOG_DEBUG); + $new_array_options[$key] = $value; + break; /*case 'select': // Not required, we chosed value='0' for undefined values if ($value=='-1') { @@ -5058,6 +5076,9 @@ abstract class CommonObject $attributeParam = $extrafields->attributes[$this->table_element]['param'][$key]; $attributeRequired = $extrafields->attributes[$this->table_element]['required'][$key]; + //dol_syslog("attributeLabel=".$attributeLabel, LOG_DEBUG); + //dol_syslog("attributeType=".$attributeType, LOG_DEBUG); + switch ($attributeType) { case 'int': @@ -5071,6 +5092,21 @@ abstract class CommonObject $this->array_options["options_".$key] = null; } break; + case 'double': + $value = price2num($value); + if (!is_numeric($value) && $value!='') + { + dol_syslog($langs->trans("ExtraFieldHasWrongValue")." sur ".$attributeLabel."(".$value."is not '".$attributeType."')", LOG_DEBUG); + $this->errors[]=$langs->trans("ExtraFieldHasWrongValue", $attributeLabel); + return -1; + } + elseif ($value=='') + { + $new_array_options[$key] = null; + } + //dol_syslog("double value"." sur ".$attributeLabel."(".$value." is '".$attributeType."')", LOG_DEBUG); + $this->array_options["options_".$key] = $value; + break; /*case 'select': // Not required, we chosed value='0' for undefined values if ($value=='-1') { From 345c24990ef76749b9dca6aeb657133f40dc9ff7 Mon Sep 17 00:00:00 2001 From: Jean-Marie Arsac Date: Tue, 11 Sep 2018 20:51:54 +0200 Subject: [PATCH 05/15] Correction of variable name --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 3a9f5e96c9b..22eba559d10 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5102,7 +5102,7 @@ abstract class CommonObject } elseif ($value=='') { - $new_array_options[$key] = null; + $this->array_options["options_".$key] = null; } //dol_syslog("double value"." sur ".$attributeLabel."(".$value." is '".$attributeType."')", LOG_DEBUG); $this->array_options["options_".$key] = $value; From 88e76b6127a0e8b804bc66082f360ea95dedac0a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Sep 2018 18:19:12 +0200 Subject: [PATCH 06/15] Revert "V8 style" --- htdocs/stripe/payment.php | 41 +++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index 3ff02641c0b..1113d1428f5 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -8,7 +8,6 @@ * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * Copyright (C) 2015 Juanjo Menent - * Copyright (C) 2018 ThibaultFOUCART * * 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 @@ -641,24 +640,36 @@ print 'id!=$source) or ($src->object=='source' && $src->card->three_d_secure=='required')) { print'class="opacitymedium"';} print' >'; - if ($src->object=='card') - { - print img_credit_card($src->brand); - } - elseif ($src->object=='source' && $src->type=='card') - { - print img_credit_card($src->card->brand); - } - elseif ($src->object=='source' && $src->type=='sepa_debit') - { - print ''; - } +if ($src->object=='card'){ +if ($src->brand == 'Visa') {$brand='cc-visa';} +elseif ($src->brand == 'MasterCard') {$brand='cc-mastercard';} +elseif ($src->brand == 'American Express') {$brand='cc-amex';} +elseif ($src->brand == 'Discover') {$brand='cc-discover';} +elseif ($src->brand == 'JCB') {$brand='cc-jcb';} +elseif ($src->brand == 'Diners Club') {$brand='cc-diners-club';} +else {$brand='credit-card-alt';} +print ''; +} +elseif ($src->object=='source' && $src->type=='card'){ +if ($src->card->brand == 'Visa') {$brand='cc-visa';} +elseif ($src->card->brand == 'MasterCard') {$brand='cc-mastercard';} +elseif ($src->card->brand == 'American Express') {$brand='cc-amex';} +elseif ($src->card->brand == 'Discover') {$brand='cc-discover';} +elseif ($src->card->brand == 'JCB') {$brand='cc-jcb';} +elseif ($src->card->brand == 'Diners Club') {$brand='cc-diners-club';} +else {$brand='credit-card-alt';} + +print ''; +} +elseif ($src->object=='source' && $src->type=='sepa_debit'){ +print ''; +} print ''; print 'id!=$source) or ($src->object=='source' && $src->card->three_d_secure=='required')) { print'class="opacitymedium"';} print' >'; if ($src->object=='card'){ - print '....'.$src->last4.' - '.$src->exp_month.'/'.$src->exp_year.''; +print '**** '.$src->last4.'
Exp. '.$src->exp_month.'/'.$src->exp_year.''; print ''; if ($src->country) { @@ -669,7 +680,7 @@ print ''; else print img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).''; } elseif ($src->object=='source' && $src->type=='card'){ - print $src->owner->name.'
....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; + print $src->owner->name.'
**** '.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; print ''; if ($src->card->country) { From 72f359fdc73beeb2e8046f902384b4d48a2d3dac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Sep 2018 19:40:43 +0200 Subject: [PATCH 07/15] Revert "add capture option in payment function" This reverts commit 849b7154a716e51f14bb52e1acfe6ff5ba1db47c. --- htdocs/stripe/class/stripe.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 1b99bb22e14..b8472d0b821 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -326,7 +326,7 @@ class Stripe extends CommonObject * @param int $usethirdpartyemailforreceiptemail Use thirdparty email as receipt email * @return Stripe */ - public function createPaymentStripe($amount, $currency, $origin, $item, $source, $customer, $account, $status=0, $usethirdpartyemailforreceiptemail=0, $capture=true) + public function createPaymentStripe($amount, $currency, $origin, $item, $source, $customer, $account, $status=0, $usethirdpartyemailforreceiptemail=0) { global $conf; @@ -406,7 +406,6 @@ class Stripe extends CommonObject "currency" => "$currency", // "statement_descriptor" => " ", "description" => "$description", - "capture" => $capture, "metadata" => $metadata, "source" => "$source", "customer" => "$customer" @@ -431,7 +430,6 @@ class Stripe extends CommonObject "currency" => "$currency", // "statement_descriptor" => " ", "description" => "$description", - "capture" => $capture, "metadata" => $metadata, "source" => "$source", "customer" => "$customer", From 3dca02d25b3968a81bbd60b710526b4bc4fbe206 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Sep 2018 21:07:34 +0200 Subject: [PATCH 08/15] Fix translation --- htdocs/langs/en_US/companies.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 62b4e666f30..19cc993876c 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -287,7 +287,7 @@ CustomerAbsoluteDiscountMy=Absolute customer discounts (granted by yourself) SupplierAbsoluteDiscountAllUsers=Absolute vendor discounts (entered by all users) SupplierAbsoluteDiscountMy=Absolute vendor discounts (entered by yourself) DiscountNone=None -Supplier=Supplier +Supplier=Vendor AddContact=Create contact AddContactAddress=Create contact/address EditContact=Edit contact From c5e30b61c01725522589f5eed2910224b1713011 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Sep 2018 21:25:14 +0200 Subject: [PATCH 09/15] Fix translation --- htdocs/core/lib/admin.lib.php | 2 +- htdocs/langs/en_US/admin.lang | 1 - htdocs/langs/en_US/main.lang | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index eb3ef3698a4..e7b131df1f1 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1706,7 +1706,7 @@ function email_admin_prepare_head() } $head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php"; - $head[$h][1] = $langs->trans("DictionaryEMailTemplates"); + $head[$h][1] = $langs->trans("EMailTemplates"); $head[$h][2] = 'templates'; $h++; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 137b28ee523..10aed915864 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -908,7 +908,6 @@ DictionarySource=Origin of proposals/orders DictionaryAccountancyCategory=Personalized groups for reports DictionaryAccountancysystem=Models for chart of accounts DictionaryAccountancyJournal=Accounting journals -DictionaryEMailTemplates=Emails templates DictionaryUnits=Units DictionaryProspectStatus=Prospection status DictionaryHolidayTypes=Types of leaves diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 92f32a80069..dcc47afa3ee 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -865,7 +865,7 @@ TitleSetToDraft=Go back to draft ConfirmSetToDraft=Are you sure you want to go back to Draft status ? ImportId=Import id Events=Events -EMailTemplates=Emails templates +EMailTemplates=Email templates FileNotShared=File not shared to exernal public Project=Project Projects=Projects From 08453a53373ba1f2fe725391c0df71c376161320 Mon Sep 17 00:00:00 2001 From: tarrsalah Date: Thu, 13 Sep 2018 10:55:34 +0100 Subject: [PATCH 10/15] FIX #9497 Extract $defaultcode and $defaulttxt from the value returned by get_default_tva function . --- htdocs/core/class/html.form.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 23c48d93adb..54b378ad281 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4711,6 +4711,10 @@ class Form $tmpthirdparty=new Societe($this->db); $defaulttx=get_default_tva($societe_vendeuse, (is_object($societe_acheteuse)?$societe_acheteuse:$tmpthirdparty), $idprod); $defaultnpr=get_default_npr($societe_vendeuse, (is_object($societe_acheteuse)?$societe_acheteuse:$tmpthirdparty), $idprod); + if (preg_match('/\((.*)\)/', $defaulttx, $reg)) { + $defaultcode=$reg[1]; + $defaulttx=preg_replace('/\s*\(.*\)/','',$defaulttx); + } if (empty($defaulttx)) $defaultnpr=0; } From 16ed582124854e8d15dcb97b25e7454e0046d622 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Sep 2018 01:45:03 +0200 Subject: [PATCH 11/15] Add comment --- htdocs/core/modules/modSyslog.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modSyslog.class.php b/htdocs/core/modules/modSyslog.class.php index 24f3a8d959f..ba08d54c888 100644 --- a/htdocs/core/modules/modSyslog.class.php +++ b/htdocs/core/modules/modSyslog.class.php @@ -82,7 +82,7 @@ class modSyslog extends DolibarrModules // Cronjobs $this->cronjobs = array( - 0=>array('label'=>'CompressSyslogs', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'compressSyslogs', 'parameters'=>'', 'comment'=>'Compress and archive log files. Warning, batch must be run with same account than your web server to avoid to get lof files with different owner than required by web server !', 'frequency'=>1, 'unitfrequency'=> 3600 * 24, 'priority'=>50, 'status'=>0, 'test'=>true), + 0=>array('label'=>'CompressSyslogs', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'compressSyslogs', 'parameters'=>'', 'comment'=>'Compress and archive log files. Warning: batch must be run with same account than your web server to avoid to get log files with different owner than required by web server. Another solution is to set web server Operating System group as the group of directory documents and set GROUP permission "rws" on this directory so log files will always have the group and permissions of the web server Operating System group', 'frequency'=>1, 'unitfrequency'=> 3600 * 24, 'priority'=>50, 'status'=>0, 'test'=>true), ); } } From 56b0a5f1ed8d447e9d009c414eabf3a41dcd3e27 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Sep 2018 13:07:27 +0200 Subject: [PATCH 12/15] FIX Mixing tickets of different thirdparties --- htdocs/ticket/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index c99ac7e7e3a..76edc111b14 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -219,8 +219,8 @@ foreach($search as $key => $val) if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'fk_statut')?2:$mode_search)); } if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); -if ($search_fk_soc) $sql.= natural_search('fk_soc', $search_fk_soc); -if ($search_fk_project) $sql.= natural_search('fk_project', $search_fk_project); +if ($search_fk_soc) $sql.= natural_search('fk_soc', $search_fk_soc, 2); +if ($search_fk_project) $sql.= natural_search('fk_project', $search_fk_project, 2); if (!$user->societe_id && ($mode == "my_assign" || (!$user->admin && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY))) { $sql.= " AND t.fk_user_assign=".$user->id; } From 34b75828d393df7187a76e048e4054086465cac6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Sep 2018 09:27:36 +0200 Subject: [PATCH 13/15] Work on fix for #9043 --- htdocs/core/modules/modAgenda.class.php | 2 +- htdocs/core/modules/modFacture.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 5078f81ad05..8ff98acc8c8 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -113,7 +113,7 @@ class modAgenda extends DolibarrModules // Cronjobs //------------ $this->cronjobs = array( - 0=>array('label'=>'SendEmailsReminders', 'jobtype'=>'method', 'class'=>'comm/action/class/actioncomm.class.php', 'objectname'=>'ActionComm', 'method'=>'sendEmailsReminder', 'parameters'=>'', 'comment'=>'SendEMailsReminder', 'frequency'=>10, 'unitfrequency'=>60, 'priority'=>10, 'status'=>1, 'test'=>'1'), + 0=>array('label'=>'SendEmailsReminders', 'jobtype'=>'method', 'class'=>'comm/action/class/actioncomm.class.php', 'objectname'=>'ActionComm', 'method'=>'sendEmailsReminder', 'parameters'=>'', 'comment'=>'SendEMailsReminder', 'frequency'=>10, 'unitfrequency'=>60, 'priority'=>10, 'status'=>1, 'test'=>'$conf->agenda->enabled'), // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24) ); diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 41ef5e26051..0326625b943 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -116,7 +116,7 @@ class modFacture extends DolibarrModules // Cronjobs $this->cronjobs = array( - 0=>array('label'=>'RecurringInvoices', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture-rec.class.php', 'objectname'=>'FactureRec', 'method'=>'createRecurringInvoices', 'parameters'=>'', 'comment'=>'Generate recurring invoices', 'frequency'=>1, 'unitfrequency'=>3600 * 24, 'priority'=>50, 'status'=>1, 'test'=>true), + 0=>array('label'=>'RecurringInvoices', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture-rec.class.php', 'objectname'=>'FactureRec', 'method'=>'createRecurringInvoices', 'parameters'=>'', 'comment'=>'Generate recurring invoices', 'frequency'=>1, 'unitfrequency'=>3600 * 24, 'priority'=>50, 'status'=>1, 'test'=>'$conf->facture->enabled'), // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>3600, 'unitfrequency'=>3600) ); From 2c8064967b1191fee893fdb9f76184ba859a6dec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Sep 2018 09:31:06 +0200 Subject: [PATCH 14/15] Code comment --- htdocs/core/modules/DolibarrModules.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index bcd3c995c46..47a5761f7c6 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1323,7 +1323,7 @@ class DolibarrModules // Can not be abstract, because we need to insta $unitfrequency = isset($this->cronjobs[$key]['unitfrequency'])?$this->cronjobs[$key]['unitfrequency']:''; $status = isset($this->cronjobs[$key]['status'])?$this->cronjobs[$key]['status']:''; $priority = isset($this->cronjobs[$key]['priority'])?$this->cronjobs[$key]['priority']:''; - $test = isset($this->cronjobs[$key]['test'])?$this->cronjobs[$key]['test']:''; // Line must be visible + $test = isset($this->cronjobs[$key]['test'])?$this->cronjobs[$key]['test']:''; // Line must be enabled or not (so visible or not) // Search if boxes def already present $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob"; From 55e7989552c07a328e82c5ee214d2964225dfe75 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Sep 2018 09:42:30 +0200 Subject: [PATCH 15/15] FIX #9043 --- htdocs/core/modules/DolibarrModules.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 47a5761f7c6..0809649a9da 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1417,6 +1417,8 @@ class DolibarrModules // Can not be abstract, because we need to insta $sql = "DELETE FROM ".MAIN_DB_PREFIX."cronjob"; $sql.= " WHERE module_name = '".$this->db->escape(empty($this->rights_class)?strtolower($this->name):$this->rights_class)."'"; $sql.= " AND entity = ".$conf->entity; + $sql.= " AND test = 1"; // We delete on lines that are not set with a complete test that is '$conf->module->enabled' so when module is disabled, the cron is also removed. + // For crons declared with a '$conf->module->enabled', there is no need to delete the line, so we don't loose setup if we reenable module. dol_syslog(get_class($this)."::delete_cronjobs", LOG_DEBUG); $resql=$this->db->query($sql);