From 4c10efb7d3773151e1993cb3651752a9e0f788f4 Mon Sep 17 00:00:00 2001 From: All3kcis Date: Wed, 27 Jun 2018 15:32:22 +0200 Subject: [PATCH 01/53] Enable auto update PDF on update note Generate order/invoice PDF on update public note --- htdocs/core/class/commonobject.class.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a165704c058..0b1d2749842 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2511,6 +2511,27 @@ abstract class CommonObject $this->note = $note; // deprecated $this->note_private = $note; } + if($suffix != '_private' && in_array($this->table_element, array('commande_fournisseur', 'commande', 'propal', 'facture_fourn', 'facture' ))){ + global $conf; + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $this->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$this->modelpdf; + $hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); + $hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); + $hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); + $result=$this->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result < 0) dol_print_error($db,$result); + } + } return 1; } else From 8d23aa305fb40c5732df9e249857f636edf0e556 Mon Sep 17 00:00:00 2001 From: All-3kcis Date: Fri, 27 Jul 2018 14:47:22 +0200 Subject: [PATCH 02/53] Move code into "htdocs/core/actions_setnotes.inc.php" --- htdocs/core/actions_setnotes.inc.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_setnotes.inc.php b/htdocs/core/actions_setnotes.inc.php index 50b35392644..cee1c3dacb5 100644 --- a/htdocs/core/actions_setnotes.inc.php +++ b/htdocs/core/actions_setnotes.inc.php @@ -32,8 +32,28 @@ if ($action == 'setnote_public' && ! empty($permissionnote) && ! GETPOST('cancel { if (empty($action) || ! is_object($object) || empty($id)) dol_print_error('','Include of actions_setnotes.inc.php was done but required variable was not set before'); if (empty($object->id)) $object->fetch($id); // Fetch may not be already done - $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public', 'none'), ENT_QUOTES),'_public'); - if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); + $result_update=$object->update_note(dol_html_entity_decode(GETPOST('note_public', 'none'), ENT_QUOTES),'_public'); + if(in_array($object->table_element, array('commande_fournisseur', 'commande', 'propal', 'facture_fourn', 'facture' ))){ + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); + $hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); + $hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); + $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result < 0) dol_print_error($db,$result); + } + } + if ($result_update < 0) setEventMessages($object->error, $object->errors, 'errors'); } // Set public note else if ($action == 'setnote_private' && ! empty($permissionnote) && ! GETPOST('cancel','alpha')) From a00150a3fbead55b59cf8cbe5bdbd8582d1313a9 Mon Sep 17 00:00:00 2001 From: All-3kcis Date: Fri, 27 Jul 2018 14:48:31 +0200 Subject: [PATCH 03/53] Revert "Enable auto update PDF on update note" This reverts commit 4c10efb7d3773151e1993cb3651752a9e0f788f4. --- htdocs/core/class/commonobject.class.php | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0b1d2749842..a165704c058 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2511,27 +2511,6 @@ abstract class CommonObject $this->note = $note; // deprecated $this->note_private = $note; } - if($suffix != '_private' && in_array($this->table_element, array('commande_fournisseur', 'commande', 'propal', 'facture_fourn', 'facture' ))){ - global $conf; - // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $this->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $model=$this->modelpdf; - $hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); - $hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); - $hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); - $result=$this->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result < 0) dol_print_error($db,$result); - } - } return 1; } else From e9267c54ce73d9a3e088ab4ceb0421307b3f7ddc Mon Sep 17 00:00:00 2001 From: All-3kcis Date: Fri, 27 Jul 2018 15:04:16 +0200 Subject: [PATCH 04/53] add include productfournisseur --- htdocs/core/actions_setnotes.inc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/actions_setnotes.inc.php b/htdocs/core/actions_setnotes.inc.php index cee1c3dacb5..5d6e80f7b3d 100644 --- a/htdocs/core/actions_setnotes.inc.php +++ b/htdocs/core/actions_setnotes.inc.php @@ -49,6 +49,7 @@ if ($action == 'setnote_public' && ! empty($permissionnote) && ! GETPOST('cancel $hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); $hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); $hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result < 0) dol_print_error($db,$result); } From 3c15da9dde802c1c87c7dd9156c47595717f34ca Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 4 Aug 2018 14:30:52 +0200 Subject: [PATCH 05/53] Fix payment in connect mode I know that it's not an optimal fix but it's functionnal for dolibarr 8.0.0 release --- htdocs/stripe/class/stripe.class.php | 32 +++++++++++++++++----------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index b8472d0b821..bab3fc5f18c 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -425,19 +425,25 @@ class Stripe extends CommonObject $fee = round($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100); } - $charge = \Stripe\Charge::create(array( - "amount" => "$stripeamount", - "currency" => "$currency", - // "statement_descriptor" => " ", - "description" => "$description", - "metadata" => $metadata, - "source" => "$source", - "customer" => "$customer", - "application_fee" => "$fee" - ), array( - "idempotency_key" => "$ref", - "stripe_account" => "$account" - )); + $paymentarray = array( + "amount" => "$stripeamount", + "currency" => "$currency", + // "statement_descriptor" => " ", + "description" => "$description", + "metadata" => $metadata, + "source" => "$source", + "customer" => "$customer" + ); + if ($conf->entity>1 && $fee>0) + { + $paymentarray["application_fee"] = $fee; + } + if ($societe->email && $usethirdpartyemailforreceiptemail) + { + $paymentarray["receipt_email"] = $societe->email; + } + + $charge = \Stripe\Charge::create($paymentarray, array("idempotency_key" => "$ref","stripe_account" => "$account")); } if (isset($charge->id)) {} From f6e5b71f215032c547655ae5e77621a9c39e0beb Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 6 Aug 2018 12:29:38 +0200 Subject: [PATCH 06/53] Fix and compatibility for V8 and connect fix for V8 release and optimal functionnality with connect mode --- htdocs/stripe/class/stripe.class.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index bab3fc5f18c..7055d4442eb 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -367,18 +367,20 @@ class Stripe extends CommonObject $order = new Commande($this->db); $order->fetch($item); $ref = $order->ref; - $description = "ORD=" . $ref . ".CUS=" . $societe->id; + $description = "ORD=" . $ref . ".CUS=" . $societe->id.".PM=stripe"; } elseif ($origin == invoice) { $invoice = new Facture($this->db); $invoice->fetch($item); $ref = $invoice->ref; - $description = "INV=" . $ref . ".CUS=" . $societe->id; + $description = "INV=" . $ref . ".CUS=" . $societe->id.".PM=stripe"; } $metadata = array( "dol_id" => "" . $item . "", "dol_type" => "" . $origin . "", "dol_thirdparty_id" => "" . $societe->id . "", + "FULLTAG" => $description, + 'Recipient' => $societe->name, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR']) @@ -396,7 +398,9 @@ class Stripe extends CommonObject $charge = \Stripe\Charge::create(array( "amount" => "$stripeamount", "currency" => "$currency", + "capture" => true, // "statement_descriptor" => " ", + "description" => "Stripe payment: ".$description, "metadata" => $metadata, "source" => "$source" )); @@ -404,8 +408,9 @@ class Stripe extends CommonObject $paymentarray = array( "amount" => "$stripeamount", "currency" => "$currency", + "capture" => true, // "statement_descriptor" => " ", - "description" => "$description", + "description" => "Stripe payment: ".$description, "metadata" => $metadata, "source" => "$source", "customer" => "$customer" @@ -428,8 +433,9 @@ class Stripe extends CommonObject $paymentarray = array( "amount" => "$stripeamount", "currency" => "$currency", + "capture" => true, // "statement_descriptor" => " ", - "description" => "$description", + "description" => "Stripe payment: ".$description, "metadata" => $metadata, "source" => "$source", "customer" => "$customer" From 78edd035f8bf72d4d460f0c54dcc425cbd83b592 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 8 Aug 2018 10:12:25 +0200 Subject: [PATCH 07/53] add statement descriptor as newpayment.php --- htdocs/stripe/class/stripe.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 7055d4442eb..d596dd4b29b 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -399,7 +399,7 @@ class Stripe extends CommonObject "amount" => "$stripeamount", "currency" => "$currency", "capture" => true, - // "statement_descriptor" => " ", + "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($customer->name), 6, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt "description" => "Stripe payment: ".$description, "metadata" => $metadata, "source" => "$source" @@ -409,7 +409,7 @@ class Stripe extends CommonObject "amount" => "$stripeamount", "currency" => "$currency", "capture" => true, - // "statement_descriptor" => " ", + "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($customer->name), 6, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt "description" => "Stripe payment: ".$description, "metadata" => $metadata, "source" => "$source", @@ -434,7 +434,7 @@ class Stripe extends CommonObject "amount" => "$stripeamount", "currency" => "$currency", "capture" => true, - // "statement_descriptor" => " ", + "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($customer->name), 6, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt "description" => "Stripe payment: ".$description, "metadata" => $metadata, "source" => "$source", From ba943bcbaab90f50704507a777278b250d55ba1b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 8 Aug 2018 10:13:28 +0200 Subject: [PATCH 08/53] fix spaces --- htdocs/stripe/class/stripe.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index d596dd4b29b..57a0846f755 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -398,9 +398,9 @@ class Stripe extends CommonObject $charge = \Stripe\Charge::create(array( "amount" => "$stripeamount", "currency" => "$currency", - "capture" => true, + "capture" => true, "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($customer->name), 6, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt - "description" => "Stripe payment: ".$description, + "description" => "Stripe payment: ".$description, "metadata" => $metadata, "source" => "$source" )); @@ -408,9 +408,9 @@ class Stripe extends CommonObject $paymentarray = array( "amount" => "$stripeamount", "currency" => "$currency", - "capture" => true, - "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($customer->name), 6, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt - "description" => "Stripe payment: ".$description, + "capture" => true, + "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($customer->name), 6, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt + "description" => "Stripe payment: ".$description, "metadata" => $metadata, "source" => "$source", "customer" => "$customer" @@ -433,9 +433,9 @@ class Stripe extends CommonObject $paymentarray = array( "amount" => "$stripeamount", "currency" => "$currency", - "capture" => true, + "capture" => true, "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($customer->name), 6, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt - "description" => "Stripe payment: ".$description, + "description" => "Stripe payment: ".$description, "metadata" => $metadata, "source" => "$source", "customer" => "$customer" From 719c5c8e2fe113092b97c81673698dd695c93bbd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Aug 2018 18:34:28 +0200 Subject: [PATCH 09/53] Update stripe.class.php --- htdocs/stripe/class/stripe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 57a0846f755..3f330349caa 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -380,7 +380,7 @@ class Stripe extends CommonObject "dol_type" => "" . $origin . "", "dol_thirdparty_id" => "" . $societe->id . "", "FULLTAG" => $description, - 'Recipient' => $societe->name, + 'dol_thirdparty_name' => $societe->name, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR']) From dd9751c9cf900a4ff40ea39cc1b326fc7fb8fe93 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 12 Aug 2018 19:36:41 +0200 Subject: [PATCH 10/53] Fix statement descriptor $soc->name --- htdocs/stripe/class/stripe.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 3f330349caa..b38f487d8ff 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -399,7 +399,7 @@ class Stripe extends CommonObject "amount" => "$stripeamount", "currency" => "$currency", "capture" => true, - "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($customer->name), 6, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt + "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt "description" => "Stripe payment: ".$description, "metadata" => $metadata, "source" => "$source" @@ -409,7 +409,7 @@ class Stripe extends CommonObject "amount" => "$stripeamount", "currency" => "$currency", "capture" => true, - "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($customer->name), 6, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt + "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt "description" => "Stripe payment: ".$description, "metadata" => $metadata, "source" => "$source", @@ -434,7 +434,7 @@ class Stripe extends CommonObject "amount" => "$stripeamount", "currency" => "$currency", "capture" => true, - "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($customer->name), 6, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt + "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt "description" => "Stripe payment: ".$description, "metadata" => $metadata, "source" => "$source", From 4d34725b233a46c3849b4afd75ef66dee976ebdc Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 12 Aug 2018 19:42:07 +0200 Subject: [PATCH 11/53] Define introduce principal entity define which entity must be use as principal with no fee and everything else (cf stripe API) --- htdocs/stripe/class/stripe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index b38f487d8ff..d6c6268dc4e 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -440,7 +440,7 @@ class Stripe extends CommonObject "source" => "$source", "customer" => "$customer" ); - if ($conf->entity>1 && $fee>0) + if ($conf->entity!=$conf->global->STRIPECONNECT_PRINCIPAL && $fee>0) { $paymentarray["application_fee"] = $fee; } From f382d8f0bbc909446f5648d052877720b99eda39 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Aug 2018 23:52:33 +0200 Subject: [PATCH 12/53] Update actions_setnotes.inc.php --- htdocs/core/actions_setnotes.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_setnotes.inc.php b/htdocs/core/actions_setnotes.inc.php index 5d6e80f7b3d..169b511b61b 100644 --- a/htdocs/core/actions_setnotes.inc.php +++ b/htdocs/core/actions_setnotes.inc.php @@ -32,8 +32,11 @@ if ($action == 'setnote_public' && ! empty($permissionnote) && ! GETPOST('cancel { if (empty($action) || ! is_object($object) || empty($id)) dol_print_error('','Include of actions_setnotes.inc.php was done but required variable was not set before'); if (empty($object->id)) $object->fetch($id); // Fetch may not be already done + $result_update=$object->update_note(dol_html_entity_decode(GETPOST('note_public', 'none'), ENT_QUOTES),'_public'); - if(in_array($object->table_element, array('commande_fournisseur', 'commande', 'propal', 'facture_fourn', 'facture' ))){ + + if (in_array($object->table_element, array('supplier_proposal', 'propal', 'commande_fournisseur', 'commande', 'facture_fourn', 'facture'))) + { // Define output language if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { From 848fcc4b176d4b0a8e5887175871cf0c44192e90 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Aug 2018 23:53:48 +0200 Subject: [PATCH 13/53] Update actions_setnotes.inc.php --- htdocs/core/actions_setnotes.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_setnotes.inc.php b/htdocs/core/actions_setnotes.inc.php index 169b511b61b..899a9a260fb 100644 --- a/htdocs/core/actions_setnotes.inc.php +++ b/htdocs/core/actions_setnotes.inc.php @@ -35,7 +35,8 @@ if ($action == 'setnote_public' && ! empty($permissionnote) && ! GETPOST('cancel $result_update=$object->update_note(dol_html_entity_decode(GETPOST('note_public', 'none'), ENT_QUOTES),'_public'); - if (in_array($object->table_element, array('supplier_proposal', 'propal', 'commande_fournisseur', 'commande', 'facture_fourn', 'facture'))) + if ($result_update < 0) setEventMessages($object->error, $object->errors, 'errors'); + elseif (in_array($object->table_element, array('supplier_proposal', 'propal', 'commande_fournisseur', 'commande', 'facture_fourn', 'facture'))) { // Define output language if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) @@ -57,7 +58,6 @@ if ($action == 'setnote_public' && ! empty($permissionnote) && ! GETPOST('cancel if ($result < 0) dol_print_error($db,$result); } } - if ($result_update < 0) setEventMessages($object->error, $object->errors, 'errors'); } // Set public note else if ($action == 'setnote_private' && ! empty($permissionnote) && ! GETPOST('cancel','alpha')) From bb09bcece4b5b877cca6f2d82af4541e74eeb059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 16 Aug 2018 16:03:56 +0200 Subject: [PATCH 14/53] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3eb0941568a..b93de1c4de2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # DOLIBARR ERP & CRM -![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg) ![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg) +![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg?branch=4.0) ![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg) Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda, ...). From 2aa0956f15ffde4ca09f4ae0c693dc23379c8d93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 16 Aug 2018 16:08:04 +0200 Subject: [PATCH 15/53] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b93de1c4de2..e89f2d46daa 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # DOLIBARR ERP & CRM -![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg?branch=4.0) ![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg) +![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/4.0.svg) ![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg) Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda, ...). From 102b698c76c49bf7222fd69d9378671346389d52 Mon Sep 17 00:00:00 2001 From: atm-ph Date: Fri, 31 Aug 2018 11:38:45 +0200 Subject: [PATCH 16/53] Fix search company by code --- htdocs/core/class/html.form.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index bd7feb9414d..50f8d1f9679 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1103,7 +1103,8 @@ class Form if (! empty($conf->barcode->enabled)) { $sql .= " OR s.barcode LIKE '".$this->db->escape($filterkey)."%'"; - } + } + $sql.= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'"; $sql.=")"; } $sql.=$this->db->order("nom","ASC"); From 6798d4e55c4bffb6114bbd4d53451db4b326d742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 1 Sep 2018 14:33:37 +0200 Subject: [PATCH 17/53] remove superfluous space --- htdocs/expedition/class/expedition.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 77cfd3e2db1..7eb1caa0d25 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -476,7 +476,7 @@ class Expedition extends CommonObject $sql.= ", e.note_private, e.note_public"; $sql.= ', e.fk_incoterms, e.location_incoterms'; $sql.= ', i.libelle as libelle_incoterms'; - $sql.= ', s.libelle as shipping_method'; + $sql.= ', s.libelle as shipping_method'; $sql.= ", el.fk_source as origin_id, el.sourcetype as origin"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->db->escape($this->element)."'"; From b3b0816e249b4f809527109001072e26cf21c282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 1 Sep 2018 14:34:53 +0200 Subject: [PATCH 18/53] remove superfluous space --- htdocs/product/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 672ad334422..52815c1303d 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1068,7 +1068,7 @@ else print ''; } if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) - { + { // Volume print ''.$langs->trans("Volume").''; print ''; From 945e92539929f5129d9f38b74b54056d2d5ea956 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Sep 2018 14:41:44 +0200 Subject: [PATCH 19/53] Update html.form.class.php --- htdocs/core/class/html.form.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 50f8d1f9679..3eb96cf7e6f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1102,9 +1102,9 @@ class Form if (count($scrit) > 1) $sql.=")"; if (! empty($conf->barcode->enabled)) { - $sql .= " OR s.barcode LIKE '".$this->db->escape($filterkey)."%'"; - } - $sql.= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'"; + $sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; + } + $sql.= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'"; $sql.=")"; } $sql.=$this->db->order("nom","ASC"); From beeaf9cf8adcdb38928c3a5a5edb230c190acc08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 1 Sep 2018 15:27:51 +0200 Subject: [PATCH 20/53] Update dav.class.php --- htdocs/dav/dav.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/dav/dav.class.php b/htdocs/dav/dav.class.php index 7c457208455..b8c38773538 100644 --- a/htdocs/dav/dav.class.php +++ b/htdocs/dav/dav.class.php @@ -39,7 +39,7 @@ class CdavLib * * @param User $user user * @param DoliDB $db Database handler - * @param Translation $langs translation + * @param Translate $langs translation */ function __construct($user, $db, $langs) { From ae52b737b35c34f01b429b548a5da0c770460db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 1 Sep 2018 15:29:41 +0200 Subject: [PATCH 21/53] Update doc_generic_user_odt.modules.php --- htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index a880640f2d5..0fc44d9ddae 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -426,7 +426,7 @@ class doc_generic_user_odt extends ModelePDFUser * get substitution array for object * * @param User $object user - * @param Translation $outputlangs translation object + * @param Translate $outputlangs translation object * @param string $array_key key for array * @return array array of substitutions */ From d8fb18e6a92cec9792ba0486a3b784cac6a0a20e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Sep 2018 15:34:25 +0200 Subject: [PATCH 22/53] Reduce travis test to min and max php only --- .travis.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index e30acd0068b..082ab548275 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,7 +37,6 @@ php: - '7.0' - '7.1' - '7.2' -#- hhvm only with dist: trusty - nightly env: @@ -63,6 +62,14 @@ matrix: - php: nightly # We exclude some combinations not usefull to save Travis CPU exclude: + - php: '5.5' + env: DB=mysql + - php: '5.6' + env: DB=mysql + - php: '7.0' + env: DB=mysql + - php: '7.1' + env: DB=mysql - php: '5.5' env: DB=postgresql - php: '5.6' @@ -71,8 +78,6 @@ matrix: env: DB=postgresql - php: '7.1' env: DB=postgresql - - php: hhvm - env: DB=postgresql - php: nightly env: DB=postgresql From 83a647ce0d224baef798d064e8be15a37afe3ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 1 Sep 2018 15:56:14 +0200 Subject: [PATCH 23/53] comment missing and not camecaps are incompatible --- dev/setup/codesniffer/ruleset.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 79b16bdbf55..b8ddcebf18c 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -238,9 +238,9 @@ - + From 49a1e33fc9b5df2c5297b3e10de6e977ef697ba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 1 Sep 2018 16:23:30 +0200 Subject: [PATCH 24/53] Update html_cerfafr.modules.php --- htdocs/core/modules/dons/html_cerfafr.modules.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index c7f741e3022..8a22babea18 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -287,8 +287,11 @@ class html_cerfafr extends ModeleDon * @param mixed $devise2 devise 2 ex: centimes * @return string amount in letters */ -function amountToLetters($montant, $devise1='', $devise2='') +private function amountToLetters($montant, $devise1='', $devise2='') { + $unite = array(); + $dix = array(); + $cent = array(); if(empty($devise1)) $dev1='euros'; else $dev1=$devise1; if(empty($devise2)) $dev2='centimes'; From c17233a409e10595f344a4bef31f11a9c420131e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Sep 2018 16:51:40 +0200 Subject: [PATCH 25/53] More logs --- htdocs/adherents/class/adherent.class.php | 8 +++---- htdocs/public/payment/paymentok.php | 29 ++++++++++++++++------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index cc48748695d..a517ea8a18b 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -534,10 +534,10 @@ class Adherent extends CommonObject $luser->birth=$this->birth; $luser->address=$this->address; $luser->zip=$this->zip; - $luser->town=$this->town; - $luser->country_id=$this->country_id; + $luser->town=$this->town; + $luser->country_id=$this->country_id; $luser->state_id=$this->state_id; - + $luser->email=$this->email; $luser->skype=$this->skype; $luser->office_phone=$this->phone; @@ -1347,7 +1347,7 @@ class Adherent extends CommonObject * @param string $num_chq Numero cheque (if Id bank account provided) * @param string $emetteur_nom Name of cheque writer * @param string $emetteur_banque Name of bank of cheque - * @param string $autocreatethirdparty Auto create new thirdparty if member not linked to a thirdparty and we request an option that generate invoice. + * @param string $autocreatethirdparty Auto create new thirdparty if member not yet linked to a thirdparty and we request an option that generate invoice. * @return int <0 if KO, >0 if OK */ function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom='', $emetteur_banque='', $autocreatethirdparty=0) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 78cf69d8337..7ad8b278de6 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -87,10 +87,8 @@ if (empty($paymentmethod)) dol_print_error(null, 'The back url does not contains a parameter fulltag that should help us to find the payment method used'); exit; } -else -{ - dol_syslog("paymentmethod=".$paymentmethod); -} + +dol_syslog("***** paymentok.php is called paymentmethod=".$paymentmethod." FULLTAG=".$FULLTAG." REQUEST_URI=".$_SERVER["REQUEST_URI"], LOG_DEBUG, 0, '_payment'); $validpaymentmethod=array(); @@ -194,7 +192,7 @@ if (! empty($conf->paypal->enabled)) // From env $ipaddress = $_SESSION['ipaddress']; - dol_syslog("Call paymentok with token=".$onlinetoken." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_paypal'); + dol_syslog("Call paymentok with token=".$onlinetoken." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_payment'); // Validate record if (! empty($paymentType)) @@ -266,6 +264,9 @@ $fulltag = $FULLTAG; $tmptag=dolExplodeIntoArray($fulltag,'.','='); +dol_syslog("ispaymentok=".$ispaymentok, LOG_DEBUG, 0, '_payment'); + + // Make complementary actions $ispostactionok = 0; $postactionmessages = array(); @@ -372,6 +373,8 @@ if ($ispaymentok) // Create subscription if (! $error) { + dol_syslog("Call ->subscription to create subscription", LOG_DEBUG, 0, '_payment'); + $crowid=$object->subscription($datesubscription, $amount, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend); if ($crowid <= 0) { @@ -389,7 +392,9 @@ if ($ispaymentok) if (! $error) { - $autocreatethirdparty = 1; + dol_syslog("Call ->subscriptionComplementaryActions", LOG_DEBUG, 0, '_payment'); + + $autocreatethirdparty = 1; // will create thirdparty if member not yet linked to a thirdparty $result = $object->subscriptionComplementaryActions($crowid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom, $emetteur_banque, $autocreatethirdparty); if ($result < 0) @@ -416,7 +421,7 @@ if ($ispaymentok) { $thirdparty_id = $object->fk_soc; - dol_syslog("Search existing Stripe customer profile for thirdparty_id=".$thirdparty_id, LOG_DEBUG, 0, '_stripe'); + dol_syslog("Search existing Stripe customer profile for thirdparty_id=".$thirdparty_id, LOG_DEBUG, 0, '_payment'); $service = 'StripeTest'; $servicestatus = 0; @@ -436,6 +441,8 @@ if ($ispaymentok) if (! $customer && $TRANSACTIONID) // Not linked to a stripe customer, we make the link { + dol_syslog("No stripe profile found, so we add it", LOG_DEBUG, 0, '_payment'); + $ch = \Stripe\Charge::retrieve($TRANSACTIONID); // contains the charge id $stripecu = $ch->customer; // value 'cus_....' @@ -462,9 +469,11 @@ if ($ispaymentok) $db->rollback(); } - // Send email + // Send email to member if (! $error) { + dol_syslog("Send email to customer to ".$object->email." if we have to (sendalsoemail = ".$sendalsoemail.")", LOG_DEBUG, 0, '_payment'); + // Send confirmation Email if ($object->email && $sendalsoemail) { @@ -691,7 +700,9 @@ if ($ispaymentok) $tmptag=dolExplodeIntoArray($fulltag,'.','='); - // Send an email + dol_syslog("Send email to customer to admins if we have to (sendemail = ".$sendemail.")", LOG_DEBUG, 0, '_payment'); + + // Send an email to admin if ($sendemail) { $companylangs = new Translate('', $conf); From 32baec1c9a7d78b3983d55b2a5f70180094b78b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Sep 2018 17:10:47 +0200 Subject: [PATCH 26/53] Fix logs --- htdocs/public/payment/paymentok.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 7ad8b278de6..fb2242c9ea5 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -638,7 +638,7 @@ if ($ispaymentok) } else { - $postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. Not way to record the payment.'; + $postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. No way to record the payment.'; $ispostactionok = -1; $error++; } @@ -700,9 +700,9 @@ if ($ispaymentok) $tmptag=dolExplodeIntoArray($fulltag,'.','='); - dol_syslog("Send email to customer to admins if we have to (sendemail = ".$sendemail.")", LOG_DEBUG, 0, '_payment'); + dol_syslog("Send email to admins if we have to (sendemail = ".$sendemail.")", LOG_DEBUG, 0, '_payment'); - // Send an email to admin + // Send an email to admins if ($sendemail) { $companylangs = new Translate('', $conf); From ada6d2c9639bb6e48e8184d1e8e5b11239832d85 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Sep 2018 17:27:14 +0200 Subject: [PATCH 27/53] More logs --- htdocs/public/payment/paymentok.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index fb2242c9ea5..47e22e12c8b 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -392,13 +392,15 @@ if ($ispaymentok) if (! $error) { - dol_syslog("Call ->subscriptionComplementaryActions", LOG_DEBUG, 0, '_payment'); + dol_syslog("Call ->subscriptionComplementaryActions option=".$option, LOG_DEBUG, 0, '_payment'); $autocreatethirdparty = 1; // will create thirdparty if member not yet linked to a thirdparty $result = $object->subscriptionComplementaryActions($crowid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom, $emetteur_banque, $autocreatethirdparty); if ($result < 0) { + dol_syslog("Error ".$object->error." ".join(',', $object->errors), LOG_DEBUG, 0, '_payment'); + $error++; $postactionmessages[] = $object->error; $postactionmessages = array_merge($postactionmessages, $object->errors); @@ -406,9 +408,21 @@ if ($ispaymentok) } else { - if ($option == 'bankviainvoice') $postactionmessages[] = 'Invoice, payment and bank record created'; - if ($option == 'bankdirect') $postactionmessages[] = 'Bank record created'; - if ($option == 'invoiceonly') $postactionmessages[] = 'Invoice recorded'; + if ($option == 'bankviainvoice') + { + $postactionmessages[] = 'Invoice, payment and bank record created'; + dol_syslog("Invoice, payment and bank record created", LOG_DEBUG, 0, '_payment'); + } + if ($option == 'bankdirect') + { + $postactionmessages[] = 'Bank record created'; + dol_syslog("Bank record created", LOG_DEBUG, 0, '_payment'); + } + if ($option == 'invoiceonly') + { + $postactionmessages[] = 'Invoice recorded'; + dol_syslog("Invoice recorded", LOG_DEBUG, 0, '_payment'); + } $ispostactionok = 1; // If an invoice was created, it is into $object->invoice From dfda029da4d55f17423e4ba676381ee0f6b2c19b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Sep 2018 17:44:07 +0200 Subject: [PATCH 28/53] FIX a removed option was still in setup --- htdocs/adherents/admin/website.php | 11 +---------- htdocs/langs/en_US/members.lang | 1 - 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index b35df5f0083..3f8c62eb153 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -55,14 +55,12 @@ if ($action == 'update') $amount=GETPOST('MEMBER_NEWFORM_AMOUNT'); $editamount=GETPOST('MEMBER_NEWFORM_EDITAMOUNT'); $payonline=GETPOST('MEMBER_NEWFORM_PAYONLINE'); - $email=GETPOST('MEMBER_PAYONLINE_SENDEMAIL'); - $forcetype=GETPOST('MEMBER_NEWFORM_FORCETYPE'); + $forcetype=GETPOST('MEMBER_NEWFORM_FORCETYPE'); $res=dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC",$public,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT",$amount,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT",$editamount,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE",$payonline,'chaine',0,'',$conf->entity); - $res=dolibarr_set_const($db, "MEMBER_PAYONLINE_SENDEMAIL",$email,'chaine',0,'',$conf->entity); if ($forcetype < 0) $res=dolibarr_del_const($db, "MEMBER_NEWFORM_FORCETYPE",$conf->entity); else $res=dolibarr_set_const($db, "MEMBER_NEWFORM_FORCETYPE",$forcetype,'chaine',0,'',$conf->entity); @@ -211,13 +209,6 @@ if (! empty($conf->global->MEMBER_ENABLE_PUBLIC)) print $form->selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,(! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''),0); print "\n"; - // Jump to an online payment page - print ''; - print $langs->trans("MEMBER_PAYONLINE_SENDEMAIL"); - print ''; - print ''; - print "\n"; - print ''; print '
'; diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 98e42b45e96..20695a1856e 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -188,7 +188,6 @@ MembersByNature=This screen show you statistics on members by nature. MembersByRegion=This screen show you statistics on members by region. VATToUseForSubscriptions=VAT rate to use for subscriptions NoVatOnSubscription=No TVA for subscriptions -MEMBER_PAYONLINE_SENDEMAIL=Email to use for email warning when Dolibarr receive a confirmation of a validated payment for a subscription (Example: paymentdone@example.com) ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS=Product used for subscription line into invoice: %s NameOrCompany=Name or company SubscriptionRecorded=Subscription recorded From 5f2eeb552a45f84dff39ad684b139eae7ba819c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Sep 2018 17:48:35 +0200 Subject: [PATCH 29/53] Fix setup of email --- htdocs/paybox/admin/paybox.php | 4 ++-- htdocs/paypal/admin/paypal.php | 4 ++-- htdocs/stripe/admin/stripe.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php index 4c68abab520..37e62c1ed01 100644 --- a/htdocs/paybox/admin/paybox.php +++ b/htdocs/paybox/admin/paybox.php @@ -221,8 +221,8 @@ print ''; print ''; print $langs->trans("ONLINE_PAYMENT_SENDEMAIL").''; -print ''; -print '   '.$langs->trans("Example").': myemail@myserver.com'; +print ''; +print '   '.$langs->trans("Example").': myemail@myserver.com, Payment service '; print ''; // Payment token for URL diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index 381151cac93..2787e8ab470 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -254,8 +254,8 @@ print ''; print ''; print $langs->trans("ONLINE_PAYMENT_SENDEMAIL").''; -print ''; -print '   '.$langs->trans("Example").': myemail@myserver.com'; +print ''; +print '   '.$langs->trans("Example").': myemail@myserver.com, Payment service '; print ''; print ''; diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 964280055c2..5e6dab4432f 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -307,8 +307,8 @@ print ''; print ''; print $langs->trans("ONLINE_PAYMENT_SENDEMAIL").''; -print ''; -print '   '.$langs->trans("Example").': myemail@myserver.com'; +print ''; +print '   '.$langs->trans("Example").': myemail@myserver.com, Payment service '; print ''; // Payment token for URL From 0bf967ab108d56e95f8ea7a3be42db46f2bbae8f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Sep 2018 17:50:13 +0200 Subject: [PATCH 30/53] Fix setup --- htdocs/paybox/admin/paybox.php | 2 +- htdocs/paypal/admin/paypal.php | 2 +- htdocs/stripe/admin/stripe.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php index 37e62c1ed01..bee538bf9d5 100644 --- a/htdocs/paybox/admin/paybox.php +++ b/htdocs/paybox/admin/paybox.php @@ -222,7 +222,7 @@ print ''; print ''; print $langs->trans("ONLINE_PAYMENT_SENDEMAIL").''; print ''; -print '   '.$langs->trans("Example").': myemail@myserver.com, Payment service '; +print '   '.$langs->trans("Example").': myemail@myserver.com, Payment service <myemail2@myserver2.com>'; print ''; // Payment token for URL diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index 2787e8ab470..f15667ced51 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -255,7 +255,7 @@ print ''; print ''; print $langs->trans("ONLINE_PAYMENT_SENDEMAIL").''; print ''; -print '   '.$langs->trans("Example").': myemail@myserver.com, Payment service '; +print '   '.$langs->trans("Example").': myemail@myserver.com, Payment service <myemail2@myserver2.com>'; print ''; print ''; diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 5e6dab4432f..bd95baecd08 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -308,7 +308,7 @@ print ''; print ''; print $langs->trans("ONLINE_PAYMENT_SENDEMAIL").''; print ''; -print '   '.$langs->trans("Example").': myemail@myserver.com, Payment service '; +print '   '.$langs->trans("Example").': myemail@myserver.com, Payment service <myemail2@myserver2.com>'; print ''; // Payment token for URL From df26ae764ee6dfd6571b573d6d6153483ff0045a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Sep 2018 17:56:52 +0200 Subject: [PATCH 31/53] Fix typo --- htdocs/langs/en_US/commercial.lang | 2 +- htdocs/langs/en_US/paybox.lang | 2 +- htdocs/langs/en_US/stripe.lang | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/commercial.lang b/htdocs/langs/en_US/commercial.lang index 9f2e16857de..47c5d8646ba 100644 --- a/htdocs/langs/en_US/commercial.lang +++ b/htdocs/langs/en_US/commercial.lang @@ -72,7 +72,7 @@ StatusProsp=Prospect status DraftPropals=Draft commercial proposals NoLimit=No limit ToOfferALinkForOnlineSignature=Link for online signature -WelcomeOnOnlineSignaturePage=Welcome on the page to accept commerical proposals from %s +WelcomeOnOnlineSignaturePage=Welcome to the page to accept commerical proposals from %s ThisScreenAllowsYouToSignDocFrom=This screen allow you to accept and sign, or refuse, a quote/commercial proposal ThisIsInformationOnDocumentToSign=This is information on document to accept or refuse SignatureProposalRef=Signature of quote/commerical proposal %s diff --git a/htdocs/langs/en_US/paybox.lang b/htdocs/langs/en_US/paybox.lang index 522243ab899..e87c7058121 100644 --- a/htdocs/langs/en_US/paybox.lang +++ b/htdocs/langs/en_US/paybox.lang @@ -3,7 +3,7 @@ PayBoxSetup=PayBox module setup PayBoxDesc=This module offer pages to allow payment on Paybox by customers. This can be used for a free payment or for a payment on a particular Dolibarr object (invoice, order, ...) FollowingUrlAreAvailableToMakePayments=Following URLs are available to offer a page to a customer to make a payment on Dolibarr objects PaymentForm=Payment form -WelcomeOnPaymentPage=Welcome on our online payment service +WelcomeOnPaymentPage=Welcome to our online payment service ThisScreenAllowsYouToPay=This screen allow you to make an online payment to %s. ThisIsInformationOnPayment=This is information on payment to do ToComplete=To complete diff --git a/htdocs/langs/en_US/stripe.lang b/htdocs/langs/en_US/stripe.lang index 1cb88cd15e8..ecd176a0ae7 100644 --- a/htdocs/langs/en_US/stripe.lang +++ b/htdocs/langs/en_US/stripe.lang @@ -4,7 +4,7 @@ StripeDesc=Module to offer an online payment page accepting payments with Credit StripeOrCBDoPayment=Pay with credit card or Stripe FollowingUrlAreAvailableToMakePayments=Following URLs are available to offer a page to a customer to make a payment on Dolibarr objects PaymentForm=Payment form -WelcomeOnPaymentPage=Welcome on our online payment service +WelcomeOnPaymentPage=Welcome to our online payment service ThisScreenAllowsYouToPay=This screen allow you to make an online payment to %s. ThisIsInformationOnPayment=This is information on payment to do ToComplete=To complete From 71977514d784a440ef0e83262b30092530324572 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 2 Sep 2018 09:06:51 +0200 Subject: [PATCH 32/53] Update actioncommreminder.class.php --- .../action/class/actioncommreminder.class.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index ca1a97c5406..f797269a2e4 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -180,38 +180,32 @@ class ActionCommReminder extends CommonObject { global $langs; - if ($mode == 0) - { - $prefix=''; - if ($status == 1) return $langs->trans('Done'); - if ($status == 0) return $langs->trans('ToDo'); - } - if ($mode == 1) + if ($mode == 0 || $mode == 1) { if ($status == 1) return $langs->trans('Done'); if ($status == 0) return $langs->trans('ToDo'); } - if ($mode == 2) + elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Done'),'statut4').' '.$langs->trans('Done'); if ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo'); } - if ($mode == 3) + elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Done'),'statut4'); if ($status == 0) return img_picto($langs->trans('ToDo'),'statut5'); } - if ($mode == 4) + elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Done'),'statut4').' '.$langs->trans('Done'); if ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo'); } - if ($mode == 5) + elseif ($mode == 5) { if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'),'statut4'); if ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5'); } - if ($mode == 6) + elseif ($mode == 6) { if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'),'statut4'); if ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5'); From 0c16761f483ab16552d4e03fdf4e3bb255ffb47b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 2 Sep 2018 10:23:00 +0200 Subject: [PATCH 33/53] Update myobject.class.php --- .../template/class/myobject.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 78834332613..21e8df59efc 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -390,31 +390,31 @@ class MyObject extends CommonObject { return $this->labelstatus[$status]; } - if ($mode == 1) + elseif ($mode == 1) { return $this->labelstatus[$status]; } - if ($mode == 2) + elseif ($mode == 2) { if ($status == 1) return img_picto($this->labelstatus[$status],'statut4').' '.$this->labelstatus[$status]; if ($status == 0) return img_picto($this->labelstatus[$status],'statut5').' '.$this->labelstatus[$status]; } - if ($mode == 3) + elseif ($mode == 3) { if ($status == 1) return img_picto($this->labelstatus[$status],'statut4'); if ($status == 0) return img_picto($this->labelstatus[$status],'statut5'); } - if ($mode == 4) + elseif ($mode == 4) { if ($status == 1) return img_picto($this->labelstatus[$status],'statut4').' '.$this->labelstatus[$status]; if ($status == 0) return img_picto($this->labelstatus[$status],'statut5').' '.$this->labelstatus[$status]; } - if ($mode == 5) + elseif ($mode == 5) { if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut4'); if ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut5'); } - if ($mode == 6) + elseif ($mode == 6) { if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut4'); if ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut5'); @@ -531,4 +531,4 @@ class MyObjectLine // @var mixed Sample line property 2 public $prop2; } -*/ \ No newline at end of file +*/ From 53caac13a962a7b2b32615e9b0eda6b8e0afec9c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2018 13:57:51 +0200 Subject: [PATCH 34/53] Test phpunit --- test/phpunit/AdherentTest.php | 4 +++- test/phpunit/AdminLibTest.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/phpunit/AdherentTest.php b/test/phpunit/AdherentTest.php index 34ec0a80917..864f9b757fb 100644 --- a/test/phpunit/AdherentTest.php +++ b/test/phpunit/AdherentTest.php @@ -61,7 +61,9 @@ class AdherentTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; diff --git a/test/phpunit/AdminLibTest.php b/test/phpunit/AdminLibTest.php index 5cf34e969b1..cc83eefe84e 100644 --- a/test/phpunit/AdminLibTest.php +++ b/test/phpunit/AdminLibTest.php @@ -59,7 +59,9 @@ class AdminLibTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; From a69c3caf2c6a5a579312abf21a9ce922f1a5d017 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2018 14:10:06 +0200 Subject: [PATCH 35/53] Prepare compatibility with phpunit 6.1 --- test/phpunit/AdherentTest.php | 6 +- test/phpunit/AdminLibTest.php | 12 ++-- test/phpunit/BankAccountTest.php | 4 +- test/phpunit/BonPrelevementTest.php | 2 + test/phpunit/BuildDocTest.php | 4 +- test/phpunit/CMailFileTest.php | 6 +- test/phpunit/CategorieTest.php | 4 +- test/phpunit/ChargeSocialesTest.php | 20 ++++--- test/phpunit/CommandeFournisseurTest.php | 4 +- test/phpunit/CommandeTest.php | 4 +- test/phpunit/CommonObjectTest.php | 4 +- test/phpunit/CompanyBankAccountTest.php | 2 + test/phpunit/ContactTest.php | 4 +- test/phpunit/ContratTest.php | 2 + test/phpunit/CoreTest.php | 12 ++-- test/phpunit/DateLibTest.php | 32 ++++++----- test/phpunit/DateLibTzFranceTest.php | 2 + test/phpunit/DiscountTest.php | 2 + test/phpunit/EntrepotTest.php | 2 + test/phpunit/ExportTest.php | 2 + test/phpunit/FactureFournisseurTest.php | 2 + test/phpunit/FactureRecTest.php | 2 + test/phpunit/FactureTest.php | 4 +- test/phpunit/FactureTestRounding.php | 2 + test/phpunit/FichinterTest.php | 2 + test/phpunit/FilesLibTest.php | 6 +- test/phpunit/FormAdminTest.php | 2 + test/phpunit/Functions2LibTest.php | 4 +- test/phpunit/FunctionsLibTest.php | 16 +++--- test/phpunit/HolidayTest.php | 8 ++- test/phpunit/ImagesLibTest.php | 2 + test/phpunit/ImportTest.php | 2 + test/phpunit/JsonLibTest.php | 10 ++-- test/phpunit/LangTest.php | 2 + test/phpunit/MarginsLibTest.php | 6 +- test/phpunit/ModulesTest.php | 2 + test/phpunit/MouvementStockTest.php | 2 + test/phpunit/NumberingModulesTest.php | 6 +- test/phpunit/PaypalTest.php | 6 +- test/phpunit/PdfDocTest.php | 2 + test/phpunit/PgsqlTest.php | 6 +- test/phpunit/PricesTest.php | 8 ++- test/phpunit/ProductTest.php | 4 +- test/phpunit/ProjectTest.php | 2 + test/phpunit/PropalTest.php | 2 + test/phpunit/RestAPIUserTest.php | 22 ++++---- test/phpunit/ScriptsTest.php | 2 + test/phpunit/SecurityTest.php | 2 + test/phpunit/SocieteTest.php | 4 +- test/phpunit/SqlTest.php | 18 +++--- test/phpunit/UserGroupTest.php | 18 +++--- test/phpunit/UserTest.php | 4 +- test/phpunit/WebservicesInvoicesTest.php | 36 ++++++------ test/phpunit/WebservicesOrdersTest.php | 4 +- test/phpunit/WebservicesOtherTest.php | 4 +- test/phpunit/WebservicesProductsTest.php | 4 +- test/phpunit/WebservicesThirdpartyTest.php | 66 +++++++++++----------- test/phpunit/WebservicesUserTest.php | 4 +- test/phpunit/XCalLibTest.php | 4 +- 59 files changed, 275 insertions(+), 157 deletions(-) diff --git a/test/phpunit/AdherentTest.php b/test/phpunit/AdherentTest.php index 42b4ff7cf7f..316f74a7cc0 100644 --- a/test/phpunit/AdherentTest.php +++ b/test/phpunit/AdherentTest.php @@ -61,7 +61,9 @@ class AdherentTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; @@ -79,7 +81,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase global $conf,$user,$langs,$db; $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. - if (! empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { + if (! empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { print "\n".__METHOD__." Company must be setup to have name-firstname in order 'Firstname Lastname'\n"; die(); } diff --git a/test/phpunit/AdminLibTest.php b/test/phpunit/AdminLibTest.php index d7f3d17a583..937ede95f3b 100644 --- a/test/phpunit/AdminLibTest.php +++ b/test/phpunit/AdminLibTest.php @@ -59,7 +59,9 @@ class AdminLibTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; @@ -142,21 +144,21 @@ class AdminLibTest extends PHPUnit_Framework_TestCase return $result; } - + /** * testEnableModule - * + * * @return void */ public function testEnableModule() { global $conf, $db, $langs, $user; - + require_once dirname(__FILE__).'/../../htdocs/core/modules/modExpenseReport.class.php'; print "Enable module modExpenseReport"; $moduledescriptor=new modExpenseReport($db); $moduledescriptor->init(); $conf->setValues($db); } - + } diff --git a/test/phpunit/BankAccountTest.php b/test/phpunit/BankAccountTest.php index a212ff0317a..f6c135158d5 100644 --- a/test/phpunit/BankAccountTest.php +++ b/test/phpunit/BankAccountTest.php @@ -61,7 +61,9 @@ class BankAccountTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; diff --git a/test/phpunit/BonPrelevementTest.php b/test/phpunit/BonPrelevementTest.php index 0124b25e6c6..de0c3be3416 100644 --- a/test/phpunit/BonPrelevementTest.php +++ b/test/phpunit/BonPrelevementTest.php @@ -62,6 +62,8 @@ class BonPrelevementTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/BuildDocTest.php b/test/phpunit/BuildDocTest.php index 25b7bd15c03..1c8ac48c868 100644 --- a/test/phpunit/BuildDocTest.php +++ b/test/phpunit/BuildDocTest.php @@ -89,7 +89,9 @@ class BuildDocTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; diff --git a/test/phpunit/CMailFileTest.php b/test/phpunit/CMailFileTest.php index 092d2e1f41c..ddc69676170 100755 --- a/test/phpunit/CMailFileTest.php +++ b/test/phpunit/CMailFileTest.php @@ -59,7 +59,9 @@ class CMailFileTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; @@ -103,7 +105,7 @@ class CMailFileTest extends PHPUnit_Framework_TestCase $db=$this->savdb; $conf->global->MAIN_DISABLE_ALL_MAILS=1; // If I comment/remove this lien, unit test still works alone but failed when ran from AllTest. Don't know why. - + print __METHOD__."\n"; } /** diff --git a/test/phpunit/CategorieTest.php b/test/phpunit/CategorieTest.php index 574a8d793f9..394267d40e1 100644 --- a/test/phpunit/CategorieTest.php +++ b/test/phpunit/CategorieTest.php @@ -60,7 +60,9 @@ class CategorieTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; diff --git a/test/phpunit/ChargeSocialesTest.php b/test/phpunit/ChargeSocialesTest.php index 0836036afa5..8f06564eb1c 100644 --- a/test/phpunit/ChargeSocialesTest.php +++ b/test/phpunit/ChargeSocialesTest.php @@ -60,6 +60,8 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; @@ -117,7 +119,7 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase /** * testChargeSocialesCreate - * + * * @return void */ public function testChargeSocialesCreate() @@ -139,10 +141,10 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase /** * testChargeSocialesFetch - * + * * @param int $id Id of social contribution * @return void - * + * * @depends testChargeSocialesCreate * The depends says test is run only if previous is ok */ @@ -164,10 +166,10 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase /** * testChargeSocialesValid - * + * * @param Object $localobject Social contribution * @return void - * + * * @depends testChargeSocialesFetch * The depends says test is run only if previous is ok */ @@ -188,10 +190,10 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase /** * testChargeSocialesOther - * + * * @param Object $localobject Social contribution * @return void - * + * * @depends testChargeSocialesValid * The depends says test is run only if previous is ok */ @@ -216,10 +218,10 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase /** * testChargeSocialesDelete - * + * * @param int $id Social contribution * @return void - * + * * @depends testChargeSocialesOther * The depends says test is run only if previous is ok */ diff --git a/test/phpunit/CommandeFournisseurTest.php b/test/phpunit/CommandeFournisseurTest.php index 03880a56eca..61dcce7f06c 100644 --- a/test/phpunit/CommandeFournisseurTest.php +++ b/test/phpunit/CommandeFournisseurTest.php @@ -61,7 +61,9 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; diff --git a/test/phpunit/CommandeTest.php b/test/phpunit/CommandeTest.php index aaba882cc87..73d0977d7fd 100644 --- a/test/phpunit/CommandeTest.php +++ b/test/phpunit/CommandeTest.php @@ -59,7 +59,9 @@ class CommandeTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; diff --git a/test/phpunit/CommonObjectTest.php b/test/phpunit/CommonObjectTest.php index 18f96034fd1..09200a15b91 100644 --- a/test/phpunit/CommonObjectTest.php +++ b/test/phpunit/CommonObjectTest.php @@ -60,7 +60,9 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; diff --git a/test/phpunit/CompanyBankAccountTest.php b/test/phpunit/CompanyBankAccountTest.php index 95ea937a017..5c72dca72a0 100644 --- a/test/phpunit/CompanyBankAccountTest.php +++ b/test/phpunit/CompanyBankAccountTest.php @@ -60,6 +60,8 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/ContactTest.php b/test/phpunit/ContactTest.php index cb0f37875b3..b943020efea 100755 --- a/test/phpunit/ContactTest.php +++ b/test/phpunit/ContactTest.php @@ -68,6 +68,8 @@ class ContactTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; @@ -207,7 +209,7 @@ class ContactTest extends PHPUnit_Framework_TestCase $localobject->email='newemail@newemail.com'; $localobject->jabberid='New im id'; $localobject->default_lang='es_ES'; - + $result=$localobject->update($localobject->id,$user); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0, 'Contact::update error'); diff --git a/test/phpunit/ContratTest.php b/test/phpunit/ContratTest.php index 5adf002c885..7e7dfb64922 100644 --- a/test/phpunit/ContratTest.php +++ b/test/phpunit/ContratTest.php @@ -60,6 +60,8 @@ class ContratTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/CoreTest.php b/test/phpunit/CoreTest.php index 3a158260e96..43f74c840fe 100644 --- a/test/phpunit/CoreTest.php +++ b/test/phpunit/CoreTest.php @@ -62,7 +62,9 @@ class CoreTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; @@ -290,22 +292,22 @@ class CoreTest extends PHPUnit_Framework_TestCase } // Run tests - + $_SERVER["PHP_SELF"]='/DIR WITH SPACE/htdocs/admin/index.php?mainmenu=home&leftmenu=setup&username=weservices'; $result=test_sql_and_script_inject($_SERVER["PHP_SELF"], 2); $expectedresult=0; $this->assertEquals($expectedresult, $result, 'Error on test_sql_and_script_inject 1a'); - + $_SERVER["PHP_SELF"]='/DIR WITH SPACE/htdocs/admin/index.php?mainmenu=home&leftmenu=setup&username=weservices;badaction'; $result=test_sql_and_script_inject($_SERVER["PHP_SELF"], 2); $expectedresult=1; $this->assertEquals($expectedresult, $result, 'Error on test_sql_and_script_inject 1b'); - + $_GET['aaa']=""; $result=test_sql_and_script_inject($_GET['aaa'], 0); $expectedresult=1; $this->assertEquals($expectedresult, $result, 'Error on test_sql_and_script_inject 2'); - + $_POST['bbb']=""; $result=test_sql_and_script_inject($_POST['bbb'], 2); $expectedresult=1; diff --git a/test/phpunit/DateLibTest.php b/test/phpunit/DateLibTest.php index 02d85164d79..734465d0853 100644 --- a/test/phpunit/DateLibTest.php +++ b/test/phpunit/DateLibTest.php @@ -60,6 +60,8 @@ class DateLibTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; @@ -179,32 +181,32 @@ class DateLibTest extends PHPUnit_Framework_TestCase $user=$this->savuser; $langs=$this->savlangs; $db=$this->savdb; - + // With same hours - Tuesday/Wednesday jan 2013 $date1=dol_mktime(0, 0, 0, 1, 1, 2013); $date2=dol_mktime(0, 0, 0, 1, 2, 2013); - + $result=num_public_holiday($date1,$date2,'FR',1); print __METHOD__." result=".$result."\n"; $this->assertEquals(1,$result,'NumPublicHoliday for Tuesday/Wednesday jan 2013 for FR'); // 1 closed days - + $result=num_public_holiday($date1,$date2,'XX',1); print __METHOD__." result=".$result."\n"; $this->assertEquals(0,$result,'NumPublicHoliday for Tuesday/Wednesday jan 2013 for XX'); // no closed days (country unknown) - + // With same hours - Friday/Sunday jan 2013 $date1=dol_mktime(0, 0, 0, 1, 4, 2013); $date2=dol_mktime(0, 0, 0, 1, 6, 2013); - + $result=num_public_holiday($date1,$date2,'FR',1); print __METHOD__." result=".$result."\n"; - $this->assertEquals(2,$result,'NumPublicHoliday for FR'); // 1 opened day, 2 closed days - + $this->assertEquals(2,$result,'NumPublicHoliday for FR'); // 1 opened day, 2 closed days + $result=num_public_holiday($date1,$date2,'XX',1); print __METHOD__." result=".$result."\n"; $this->assertEquals(2,$result,'NumPublicHoliday for XX'); // 1 opened day, 2 closed days (even if country unknown) } - + /** * testNumOpenDay * @@ -217,32 +219,32 @@ class DateLibTest extends PHPUnit_Framework_TestCase $user=$this->savuser; $langs=$this->savlangs; $db=$this->savdb; - + // With same hours - Tuesday/Wednesday jan 2013 $date1=dol_mktime(0, 0, 0, 1, 1, 2013); $date2=dol_mktime(0, 0, 0, 1, 2, 2013); - + $result=num_open_day($date1,$date2,0,1,0,'FR'); print __METHOD__." result=".$result."\n"; $this->assertEquals(1,$result,'NumOpenDay Tuesday/Wednesday jan 2013 for FR'); // 1 opened days - + $result=num_open_day($date1,$date2,0,1,0,'XX'); print __METHOD__." result=".$result."\n"; $this->assertEquals(2,$result,'NumOpenDay Tuesday/Wednesday jan 2013 for XX'); // 2 opened days (country unknown) - + // With same hours - Friday/Sunday jan 2013 $date1=dol_mktime(0, 0, 0, 1, 4, 2013); $date2=dol_mktime(0, 0, 0, 1, 6, 2013); - + $result=num_open_day($date1,$date2,0,1,0,'FR'); print __METHOD__." result=".$result."\n"; $this->assertEquals(1,$result,'NumOpenDay for FR'); // 1 opened day, 2 closed - + $result=num_open_day($date1,$date2,'XX',1); print __METHOD__." result=".$result."\n"; $this->assertEquals(1,$result,'NumOpenDay for XX'); // 1 opened day, 2 closes (even if country unknown) } - + /** * testConvertTime2Seconds * diff --git a/test/phpunit/DateLibTzFranceTest.php b/test/phpunit/DateLibTzFranceTest.php index 668af000204..b41688c153f 100644 --- a/test/phpunit/DateLibTzFranceTest.php +++ b/test/phpunit/DateLibTzFranceTest.php @@ -60,6 +60,8 @@ class DateLibTzFranceTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/DiscountTest.php b/test/phpunit/DiscountTest.php index cf4d5033597..724a97e6f3e 100644 --- a/test/phpunit/DiscountTest.php +++ b/test/phpunit/DiscountTest.php @@ -60,6 +60,8 @@ class DiscountTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/EntrepotTest.php b/test/phpunit/EntrepotTest.php index d3d7c300308..6f27685faa7 100644 --- a/test/phpunit/EntrepotTest.php +++ b/test/phpunit/EntrepotTest.php @@ -60,6 +60,8 @@ class EntrepotTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php index 7c14b0ccd64..af1c1e95a26 100644 --- a/test/phpunit/ExportTest.php +++ b/test/phpunit/ExportTest.php @@ -64,6 +64,8 @@ class ExportTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/FactureFournisseurTest.php b/test/phpunit/FactureFournisseurTest.php index 199d397f50d..b91092f294e 100644 --- a/test/phpunit/FactureFournisseurTest.php +++ b/test/phpunit/FactureFournisseurTest.php @@ -60,6 +60,8 @@ class FactureFournisseurTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/FactureRecTest.php b/test/phpunit/FactureRecTest.php index f7f857fe317..07d728eb0ec 100644 --- a/test/phpunit/FactureRecTest.php +++ b/test/phpunit/FactureRecTest.php @@ -61,6 +61,8 @@ class FactureRecTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/FactureTest.php b/test/phpunit/FactureTest.php index 142a5284989..678992ed77c 100644 --- a/test/phpunit/FactureTest.php +++ b/test/phpunit/FactureTest.php @@ -59,7 +59,9 @@ class FactureTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; diff --git a/test/phpunit/FactureTestRounding.php b/test/phpunit/FactureTestRounding.php index 5fe0df4e5d0..4ed76d900bf 100644 --- a/test/phpunit/FactureTestRounding.php +++ b/test/phpunit/FactureTestRounding.php @@ -60,6 +60,8 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/FichinterTest.php b/test/phpunit/FichinterTest.php index baa72b7020a..4d6e1224498 100644 --- a/test/phpunit/FichinterTest.php +++ b/test/phpunit/FichinterTest.php @@ -60,6 +60,8 @@ class FichinterTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index f9000006b46..8e4cc4b009b 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -61,6 +61,8 @@ class FilesLibTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; @@ -399,7 +401,7 @@ class FilesLibTest extends PHPUnit_Framework_TestCase print __METHOD__." result=".join(',',$result)."\n"; $this->assertEquals(0,count($result)); } - + /** * testDolDirList * @@ -411,7 +413,7 @@ class FilesLibTest extends PHPUnit_Framework_TestCase public function testDolDirList() { global $conf,$user,$langs,$db; - + // Scan dir to guaruante we on't have library jquery twice (we accept exception of duplicte into ckeditor because all dir is removed for debian package, so there is no duplicate). $founddirs=dol_dir_list(DOL_DOCUMENT_ROOT.'/includes/', 'files', 1, '^jquery\.js', array('ckeditor')); print __METHOD__." count(founddirs)=".count($founddirs)."\n"; diff --git a/test/phpunit/FormAdminTest.php b/test/phpunit/FormAdminTest.php index 30c96600210..876e733b56d 100644 --- a/test/phpunit/FormAdminTest.php +++ b/test/phpunit/FormAdminTest.php @@ -60,6 +60,8 @@ class FormAdminTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/Functions2LibTest.php b/test/phpunit/Functions2LibTest.php index 470a570bf6e..87b2eaefe58 100644 --- a/test/phpunit/Functions2LibTest.php +++ b/test/phpunit/Functions2LibTest.php @@ -63,7 +63,9 @@ class Functions2LibTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index ca06655c845..4da3beb48ee 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -63,7 +63,9 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; @@ -130,21 +132,21 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase /*$tmp=dol_buildpath('/google/oauth2callback.php', 0); var_dump($tmp); */ - + /*$tmp=dol_buildpath('/google/oauth2callback.php', 1); var_dump($tmp); */ - + $result=dol_buildpath('/google/oauth2callback.php', 2); print __METHOD__." result=".$result."\n"; $this->assertStringStartsWith('http', $result); - + $result=dol_buildpath('/google/oauth2callback.php', 3); print __METHOD__." result=".$result."\n"; $this->assertStringStartsWith('http', $result); } - - + + /** * testGetBrowserInfo * @@ -999,5 +1001,5 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase return true; } - + } diff --git a/test/phpunit/HolidayTest.php b/test/phpunit/HolidayTest.php index a04646a8a14..1239cff2f92 100644 --- a/test/phpunit/HolidayTest.php +++ b/test/phpunit/HolidayTest.php @@ -62,6 +62,8 @@ class HolidayTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; @@ -201,11 +203,11 @@ class HolidayTest extends PHPUnit_Framework_TestCase $localobject->email='newemail@newemail.com'; $localobject->jabberid='New im id'; $localobject->default_lang='es_ES'; - + $result=$localobject->update($localobject->id,$user); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0, 'Holiday::update error'); - + $result=$localobject->update_note($localobject->note_private,'_private'); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0, 'Holiday::update_note (private) error'); @@ -213,7 +215,7 @@ class HolidayTest extends PHPUnit_Framework_TestCase $result=$localobject->update_note($localobject->note_public, '_public'); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0, 'Holiday::update_note (public) error'); - + $newobject=new Holiday($this->savdb); $result=$newobject->fetch($localobject->id); diff --git a/test/phpunit/ImagesLibTest.php b/test/phpunit/ImagesLibTest.php index 41c7005e25d..cc4e6bd7462 100644 --- a/test/phpunit/ImagesLibTest.php +++ b/test/phpunit/ImagesLibTest.php @@ -61,6 +61,8 @@ class ImagesLibTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/ImportTest.php b/test/phpunit/ImportTest.php index 067b06910c9..0e80b6384e8 100644 --- a/test/phpunit/ImportTest.php +++ b/test/phpunit/ImportTest.php @@ -62,6 +62,8 @@ class ImportTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/JsonLibTest.php b/test/phpunit/JsonLibTest.php index 66999e31c65..cd63ed2f221 100644 --- a/test/phpunit/JsonLibTest.php +++ b/test/phpunit/JsonLibTest.php @@ -62,7 +62,9 @@ class JsonLibTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; @@ -134,7 +136,7 @@ class JsonLibTest extends PHPUnit_Framework_TestCase // Do a test with an array starting with 0 $arraytotest=array(0=>array('key'=>1,'value'=>'PRODREF','label'=>'Product ref with é and special chars \\ \' "')); $arrayencodedexpected='[{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}]'; - + $encoded=json_encode($arraytotest); $this->assertEquals($arrayencodedexpected,$encoded); $decoded=json_decode($encoded,true); @@ -148,7 +150,7 @@ class JsonLibTest extends PHPUnit_Framework_TestCase // Same test but array start with 2 instead of 0 $arraytotest=array(2=>array('key'=>1,'value'=>'PRODREF','label'=>'Product ref with é and special chars \\ \' "')); $arrayencodedexpected='{"2":{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}}'; - + $encoded=json_encode($arraytotest); $this->assertEquals($arrayencodedexpected,$encoded); $decoded=json_decode($encoded,true); @@ -158,7 +160,7 @@ class JsonLibTest extends PHPUnit_Framework_TestCase $this->assertEquals($arrayencodedexpected,$encoded); $decoded=dol_json_decode($encoded,true); $this->assertEquals($arraytotest,$decoded,'test for dol_json_xxx'); - + // Test with object $now=gmmktime(12,0,0,1,1,1970); $objecttotest=new stdClass(); diff --git a/test/phpunit/LangTest.php b/test/phpunit/LangTest.php index 4487568c1d6..61a34b37271 100644 --- a/test/phpunit/LangTest.php +++ b/test/phpunit/LangTest.php @@ -72,6 +72,8 @@ class LangTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/MarginsLibTest.php b/test/phpunit/MarginsLibTest.php index 7c2e8f68ef6..ae06128925c 100644 --- a/test/phpunit/MarginsLibTest.php +++ b/test/phpunit/MarginsLibTest.php @@ -60,6 +60,8 @@ class MarginsLibTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; @@ -136,7 +138,7 @@ class MarginsLibTest extends PHPUnit_Framework_TestCase $this->assertEquals(25,$result[1]); print __METHOD__." result[2]=".$result[2]."\n"; $this->assertEquals(20,$result[2]); - + $result=getMarginInfos(10, 10, 19.6, 0, 0, 0, 8); var_dump($result); print __METHOD__." result[0]=".$result[0]."\n"; @@ -145,7 +147,7 @@ class MarginsLibTest extends PHPUnit_Framework_TestCase $this->assertEquals(12.5,$result[1]); print __METHOD__." result[2]=".$result[2]."\n"; $this->assertEquals(1/9*100,$result[2]); - + return 0; } diff --git a/test/phpunit/ModulesTest.php b/test/phpunit/ModulesTest.php index e769ce9dd51..46b2fb4ee91 100755 --- a/test/phpunit/ModulesTest.php +++ b/test/phpunit/ModulesTest.php @@ -59,6 +59,8 @@ class ModulesTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/MouvementStockTest.php b/test/phpunit/MouvementStockTest.php index 826b55851e2..2779b3011d6 100644 --- a/test/phpunit/MouvementStockTest.php +++ b/test/phpunit/MouvementStockTest.php @@ -62,6 +62,8 @@ class MouvementStockTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/NumberingModulesTest.php b/test/phpunit/NumberingModulesTest.php index b29cd03b2c9..26302e19ea9 100644 --- a/test/phpunit/NumberingModulesTest.php +++ b/test/phpunit/NumberingModulesTest.php @@ -59,6 +59,8 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; @@ -75,7 +77,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase public static function setUpBeforeClass() { global $conf,$user,$langs,$db; - + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. print __METHOD__."\n"; @@ -138,7 +140,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}-{0000}'; $conf->global->FACTURE_MERCURE_MASK_INVOICE='{yyyy}-{0000}'; $conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED=0; - + $localobject=new Facture($this->savdb); $localobject->initAsSpecimen(); $localobject->date=dol_mktime(12, 0, 0, 1, 1, 1915); // we use year 1915 to be sure to not have existing invoice for this year diff --git a/test/phpunit/PaypalTest.php b/test/phpunit/PaypalTest.php index fb48279cd66..59c28be2177 100644 --- a/test/phpunit/PaypalTest.php +++ b/test/phpunit/PaypalTest.php @@ -61,6 +61,8 @@ class PaypalTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; @@ -135,9 +137,9 @@ class PaypalTest extends PHPUnit_Framework_TestCase $urltotest=getPaypalPaymentUrl(1,'free'); print "urltotest=".$urltotest."\n"; - + $result=getURLContent($urltotest, 'GET'); - + print __METHOD__." result=".$result."\n"; $this->assertLessThanOrEqual($result, 0); diff --git a/test/phpunit/PdfDocTest.php b/test/phpunit/PdfDocTest.php index 13cb1b59ae3..0cf37b48762 100644 --- a/test/phpunit/PdfDocTest.php +++ b/test/phpunit/PdfDocTest.php @@ -63,6 +63,8 @@ class PdfDocTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/PgsqlTest.php b/test/phpunit/PgsqlTest.php index 05efcaeb30b..8347bc32905 100644 --- a/test/phpunit/PgsqlTest.php +++ b/test/phpunit/PgsqlTest.php @@ -62,6 +62,8 @@ class PgsqlTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; @@ -167,13 +169,13 @@ class PgsqlTest extends PHPUnit_Framework_TestCase $result=DoliDBPgsql::convertSQLFromMysql($sql); print __METHOD__." result=".$result."\n"; $this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c, ',') FROM table GROUP BY a.b", 'Test GROUP_CONCAT (without SEPARATOR)'); - + // Test GROUP_CONCAT (with SEPARATOR) $sql="SELECT a.b, GROUP_CONCAT(a.c SEPARATOR ',') FROM table GROUP BY a.b"; $result=DoliDBPgsql::convertSQLFromMysql($sql); print __METHOD__." result=".$result."\n"; $this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c, ',') FROM table GROUP BY a.b", 'Test GROUP_CONCAT (with SEPARATOR)'); - + return $result; } } diff --git a/test/phpunit/PricesTest.php b/test/phpunit/PricesTest.php index aee698c1a6e..9a89f8339b4 100755 --- a/test/phpunit/PricesTest.php +++ b/test/phpunit/PricesTest.php @@ -67,7 +67,9 @@ class PricesTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; @@ -160,8 +162,8 @@ class PricesTest extends PHPUnit_Framework_TestCase print __METHOD__." result1=".join(', ',$result1)."\n"; // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) $this->assertEquals(array(17.12, 1.71, 18.83, 8.56, 0.856, 9.416, 17.12, 1.71, 18.83, 0, 0, 0, 0, 0, 0, 0, 18.7, 1.87, 20.56),$result1,'Test1 FR'); - - + + /* * Country Spain */ diff --git a/test/phpunit/ProductTest.php b/test/phpunit/ProductTest.php index 199aace802c..f9d3390c693 100644 --- a/test/phpunit/ProductTest.php +++ b/test/phpunit/ProductTest.php @@ -60,7 +60,9 @@ class ProductTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; diff --git a/test/phpunit/ProjectTest.php b/test/phpunit/ProjectTest.php index c2f5d5b8161..ea7cf01c328 100644 --- a/test/phpunit/ProjectTest.php +++ b/test/phpunit/ProjectTest.php @@ -61,6 +61,8 @@ class ProjectTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/PropalTest.php b/test/phpunit/PropalTest.php index 707673e0d0f..23b07c25a26 100644 --- a/test/phpunit/PropalTest.php +++ b/test/phpunit/PropalTest.php @@ -60,6 +60,8 @@ class PropalTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/RestAPIUserTest.php b/test/phpunit/RestAPIUserTest.php index 189c17a0bd3..d25d0f1bc52 100644 --- a/test/phpunit/RestAPIUserTest.php +++ b/test/phpunit/RestAPIUserTest.php @@ -64,7 +64,9 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; @@ -106,7 +108,7 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase $user=$this->savuser; $langs=$this->savlangs; $db=$this->savdb; - + $this->api_url=DOL_MAIN_URL_ROOT.'/api/index.php'; $login='admin'; @@ -149,7 +151,7 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase $url = $this->api_url.'/user/123456789?api_key='.$this->api_key; //$addheaders=array('Content-Type: application/json'); - + print __METHOD__." Request url=".$url."\n"; $result=getURLContent($url, 'GET', '', 1, array()); //print __METHOD__." Result for unexisting user: ".var_export($result, true)."\n"; @@ -158,7 +160,7 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase $object=json_decode($result['content'], true); $this->assertNotNull($object, "Parsing of json result must no be null"); $this->assertEquals(404, $object['error']['code']); - + $url = $this->api_url.'/user/1?api_key='.$this->api_key; print __METHOD__." Request url=".$url."\n"; @@ -172,18 +174,18 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase } public function testRestCreateUser() { - + // attemp to create without mandatory fields : $url = $this->api_url.'/user?api_key='.$this->api_key; $addheaders=array('Content-Type: application/json'); - + $bodyobj = array( "lastname"=>"testRestUser", "password"=>"testRestPassword", "email"=>"test@restuser.com" ); $body = json_encode($bodyobj); - + print __METHOD__." Request url=".$url."\n"; $result=getURLContent($url, 'POST', $body, 1, $addheaders); //print __METHOD__." Result for creating incomplete user".var_export($result, true)."\n"; @@ -207,17 +209,17 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase print __METHOD__." Result code for creating user ".var_export($result, true)."\n"; print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; $this->assertEquals($result['curl_error_no'],''); - $object=json_decode($result['content'], true); + $object=json_decode($result['content'], true); $this->assertNotNull($object, "Parsing of json result must no be null"); $this->assertGreaterThan(0, $object['id'], $object['error']['code'].' '.$object['error']['message']); - + // attempt to create duplicated user print __METHOD__." Request url=".$url."\n"; $result=getURLContent($url, 'POST', $body, 1, $addheaders); //print __METHOD__." Result for creating duplicate user".var_export($result, true)."\n"; print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; $this->assertEquals($result['curl_error_no'],''); - $object=json_decode($result['content'], true); + $object=json_decode($result['content'], true); $this->assertNotNull($object, "Parsing of json result must no be null"); $this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']); } diff --git a/test/phpunit/ScriptsTest.php b/test/phpunit/ScriptsTest.php index b7916c39d9f..0c49567a4a4 100644 --- a/test/phpunit/ScriptsTest.php +++ b/test/phpunit/ScriptsTest.php @@ -72,6 +72,8 @@ class ScriptsTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 00714e7bfab..2796ecb2c32 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -72,6 +72,8 @@ class SecurityTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php index 24b868b743e..5f1ed299cdc 100755 --- a/test/phpunit/SocieteTest.php +++ b/test/phpunit/SocieteTest.php @@ -60,7 +60,9 @@ class SocieteTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; diff --git a/test/phpunit/SqlTest.php b/test/phpunit/SqlTest.php index 0a9acc50220..f2e3729fbe4 100644 --- a/test/phpunit/SqlTest.php +++ b/test/phpunit/SqlTest.php @@ -72,7 +72,9 @@ class SqlTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; @@ -143,16 +145,16 @@ class SqlTest extends PHPUnit_Framework_TestCase $listofsqldir = array(DOL_DOCUMENT_ROOT.'/install/mysql/tables', DOL_DOCUMENT_ROOT.'/install/mysql/migration'); - foreach ($listofsqldir as $dir) + foreach ($listofsqldir as $dir) { print 'Process dir '.$dir."\n"; $filesarray = scandir($dir); - - foreach($filesarray as $key => $file) + + foreach($filesarray as $key => $file) { if (! preg_match('/\.sql$/',$file)) continue; - + print 'Check sql file '.$file."\n"; $filecontent=file_get_contents($dir.'/'.$file); @@ -167,7 +169,7 @@ class SqlTest extends PHPUnit_Framework_TestCase $result=strpos($filecontent,'ON DELETE CASCADE'); print __METHOD__." Result for checking we don't have 'ON DELETE CASCADE' = ".$result."\n"; $this->assertTrue($result===false, 'Found ON DELETE CASCADE into '.$file.'. Bad.'); - + if ($dir == DOL_DOCUMENT_ROOT.'/install/mysql/migration') { // Test for migration files only @@ -176,9 +178,9 @@ class SqlTest extends PHPUnit_Framework_TestCase else { if (preg_match('/\.key\.sql$/',$file)) - { + { // Test for files key files only - + } else { diff --git a/test/phpunit/UserGroupTest.php b/test/phpunit/UserGroupTest.php index d41eefcbd39..b1e9b3bb43f 100644 --- a/test/phpunit/UserGroupTest.php +++ b/test/phpunit/UserGroupTest.php @@ -59,7 +59,9 @@ class UserGroupTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; @@ -117,7 +119,7 @@ class UserGroupTest extends PHPUnit_Framework_TestCase /** * testUserGroupCreate - * + * * @return void */ public function testUserGroupCreate() @@ -139,7 +141,7 @@ class UserGroupTest extends PHPUnit_Framework_TestCase /** * testUserGroupFetch - * + * * @param int $id Id of group * @return void * @depends testUserGroupCreate @@ -163,7 +165,7 @@ class UserGroupTest extends PHPUnit_Framework_TestCase /** * testUserGroupUpdate - * + * * @param Object $localobject Group * @return void * @depends testUserGroupFetch @@ -187,7 +189,7 @@ class UserGroupTest extends PHPUnit_Framework_TestCase /** * testUserGroupAddRight - * + * * @param Object $localobject Object to show * @return void * @depends testUserGroupUpdate @@ -210,7 +212,7 @@ class UserGroupTest extends PHPUnit_Framework_TestCase /** * testUserGroupDelRight - * + * * @param Object $localobject Object * @return void * @depends testUserGroupAddRight @@ -233,7 +235,7 @@ class UserGroupTest extends PHPUnit_Framework_TestCase /** * testUserGroupOther - * + * * @param Object $localobject Object * @return void * @depends testUserGroupDelRight @@ -261,7 +263,7 @@ class UserGroupTest extends PHPUnit_Framework_TestCase /** * testUserGroupDelete - * + * * @param int $id Id of object * @return void * @depends testUserGroupOther diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index 4e0c0ba58ca..912dd6f382b 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -59,7 +59,9 @@ class UserTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; diff --git a/test/phpunit/WebservicesInvoicesTest.php b/test/phpunit/WebservicesInvoicesTest.php index ce3275bb58e..6e2ae6fbda1 100644 --- a/test/phpunit/WebservicesInvoicesTest.php +++ b/test/phpunit/WebservicesInvoicesTest.php @@ -55,9 +55,9 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase protected $savdb; protected $soapclient; protected $socid; - + protected $ns = 'http://www.dolibarr.org/ns/'; - + /** * Constructor * We save global variables into local variables @@ -66,6 +66,8 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; @@ -73,8 +75,8 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase $this->savlangs=$langs; $this->savdb=$db; $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_invoice.php'; - - + + // Set the WebService URL print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; $this->soapclient = new nusoap_client($WS_DOL_URL); @@ -83,7 +85,7 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase $this->soapclient->soap_defencoding='UTF-8'; $this->soapclient->decodeUTF8(false); } - + // create third_parties, needed to test an invoice $societe=new Societe($db); $societe->ref=''; @@ -95,11 +97,11 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase $societe->date_creation=$now; $societe->tva_assuj=0; $societe->particulier=0; - + $societe->create($user); - + $this->socid = $societe->id; - + print __METHOD__." societe created id=".$societe->id."\n"; print __METHOD__." db->type=".$db->type." user->id=".$user->id; @@ -135,9 +137,9 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase $user=$this->savuser; $langs=$this->savlangs; $db=$this->savdb; - + print __METHOD__."\n"; - + } /** @@ -171,7 +173,7 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase $societe->fetch('', '', 'ref-phpunit'); print __METHOD__." societe loaded id=".$societe->id."\n"; */ - + $body = array ( "id" => NULL, "ref" => NULL, @@ -252,13 +254,13 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase return $result; } - + /** * testWSInvoicesGetInvoiceByRefExt - * + * * Retrieve an invoice using ref_ext * @depends testWSInvoicesCreateInvoice - * + * * @param array $result Invoice created by create method * @return array Invoice */ @@ -308,13 +310,13 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase return $result; } - + /** * testWSInvoicesUpdateInvoiceByRefExt - * + * * Update an invoice using ref_ext * @depends testWSInvoicesCreateInvoice - * + * * @param array $result invoice created by create method * @return array Invoice */ diff --git a/test/phpunit/WebservicesOrdersTest.php b/test/phpunit/WebservicesOrdersTest.php index 06ead4f4873..d9c718c399a 100644 --- a/test/phpunit/WebservicesOrdersTest.php +++ b/test/phpunit/WebservicesOrdersTest.php @@ -61,7 +61,9 @@ class WebservicesOrdersTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; diff --git a/test/phpunit/WebservicesOtherTest.php b/test/phpunit/WebservicesOtherTest.php index d04fc6b9b9c..d31d4ed9cc0 100644 --- a/test/phpunit/WebservicesOtherTest.php +++ b/test/phpunit/WebservicesOtherTest.php @@ -61,7 +61,9 @@ class WebservicesOtherTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; diff --git a/test/phpunit/WebservicesProductsTest.php b/test/phpunit/WebservicesProductsTest.php index fecc58a65e1..e9cdee38b8a 100644 --- a/test/phpunit/WebservicesProductsTest.php +++ b/test/phpunit/WebservicesProductsTest.php @@ -68,7 +68,9 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; diff --git a/test/phpunit/WebservicesThirdpartyTest.php b/test/phpunit/WebservicesThirdpartyTest.php index 2888c432e73..7bfd171436a 100644 --- a/test/phpunit/WebservicesThirdpartyTest.php +++ b/test/phpunit/WebservicesThirdpartyTest.php @@ -53,12 +53,12 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase protected $savlangs; protected $savdb; protected $soapclient; - + private $_WS_DOL_URL; private $_ns='http://www.dolibarr.org/ns/'; - - - + + + /** * Constructor @@ -68,15 +68,17 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; $this->savlangs=$langs; $this->savdb=$db; - + $this->_WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php'; - + // Set the WebService URL print __METHOD__." create nusoap_client for URL=".$this->_WS_DOL_URL."\n"; $this->soapclient = new nusoap_client($this->_WS_DOL_URL); @@ -146,10 +148,10 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase $user=$this->savuser; $langs=$this->savlangs; $db=$this->savdb; - + $WS_METHOD = 'createThirdParty'; - - + + // Call the WebService method and store its result in $result. $authentication=array( 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, @@ -157,7 +159,7 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase 'login'=>'admin', 'password'=>'admin', 'entity'=>''); - + $body = array ( "id" => NULL, "ref" => "name", @@ -195,7 +197,7 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase "vat_used" => "", "vat_number" => "" ); - + // Test URL $result=''; $parameters = array('authentication'=>$authentication, 'thirdparty'=>$body); @@ -215,20 +217,20 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase print $this->soapclient->response; print "\n"; } - + print __METHOD__." result=".$result['result']['result_code']."\n"; $this->assertEquals('OK',$result['result']['result_code']); - $this->assertEquals('name',$result['ref']); - + $this->assertEquals('name',$result['ref']); + return $result; } /** * testWSThirdpartygetThirdPartyById - * + * * Use id to retrieve thirdparty * @depends testWSThirdpartycreateThirdParty - * + * * @param array $result thirdparty created by create method * @return array thirpdarty updated */ @@ -278,18 +280,18 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase $this->assertEquals('0', $result['thirdparty']['status']); $this->assertEquals('1', $result['thirdparty']['client']); $this->assertEquals('0', $result['thirdparty']['supplier']); - - + + return $result; } - + /** * testWSThirdpartygetThirdPartyByRefExt * * Use ref_ext to retrieve thirdparty * * @depends testWSThirdpartycreateThirdParty - * + * * @param array $result thirdparty created by create method * @return array thirdparty */ @@ -301,9 +303,9 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase $langs=$this->savlangs; $db=$this->savdb; $id = $result['id']; - + $WS_METHOD = 'getThirdParty'; - + // Call the WebService method and store its result in $result. $authentication=array( 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, @@ -311,7 +313,7 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase 'login'=>'admin', 'password'=>'admin', 'entity'=>''); - + // Test URL $result=''; $parameters = array('authentication'=>$authentication, 'id'=>'', 'ref'=>'', 'ref_ext'=>'12'); @@ -332,7 +334,7 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase print $this->soapclient->response; print "\n"; } - + print __METHOD__." result=".$result['result']['result_code']."\n"; $this->assertEquals('OK',$result['result']['result_code']); $this->assertEquals($id, $result['thirdparty']['id']); @@ -341,11 +343,11 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase $this->assertEquals('0', $result['thirdparty']['status']); $this->assertEquals('1', $result['thirdparty']['client']); $this->assertEquals('0', $result['thirdparty']['supplier']); - - + + return $result; } - + /** * testWSThirdpartydeleteThirdParty * @@ -362,9 +364,9 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase $langs=$this->savlangs; $db=$this->savdb; $id = $result['id']; - + $WS_METHOD = 'deleteThirdParty'; - + // Call the WebService method and store its result in $result. $authentication=array( 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, @@ -372,7 +374,7 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase 'login'=>'admin', 'password'=>'admin', 'entity'=>''); - + $result=''; $parameters = array('authentication'=>$authentication, 'id'=>$id, 'ref'=>'', 'ref_ext'=>''); print __METHOD__." call method ".$WS_METHOD."\n"; @@ -393,7 +395,7 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase print __METHOD__." result=".$result['result']['result_code']."\n"; $this->assertEquals('OK',$result['result']['result_code']); - + return $result; } diff --git a/test/phpunit/WebservicesUserTest.php b/test/phpunit/WebservicesUserTest.php index 9be97167104..b4cc865bf5c 100644 --- a/test/phpunit/WebservicesUserTest.php +++ b/test/phpunit/WebservicesUserTest.php @@ -61,7 +61,9 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; diff --git a/test/phpunit/XCalLibTest.php b/test/phpunit/XCalLibTest.php index 3bbf3469b17..932f68aa18d 100644 --- a/test/phpunit/XCalLibTest.php +++ b/test/phpunit/XCalLibTest.php @@ -59,7 +59,9 @@ class XCalLibTest extends PHPUnit_Framework_TestCase */ function __construct() { - //$this->sharedFixture + parent::__construct(); + + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; $this->savuser=$user; From df721a5fbcd7e4ea04160d1779670f0b864dc07f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2018 14:18:04 +0200 Subject: [PATCH 36/53] Only min and max php version --- .travis.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.travis.yml b/.travis.yml index bac020e13c5..4c7a714eba1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -63,6 +63,14 @@ matrix: - php: nightly # We exclude some combinations not usefull to save Travis CPU exclude: + - php: '5.4' + env: DB=mysql + - php: '5.5' + env: DB=mysql + - php: '5.6' + env: DB=mysql + - php: '7.0' + env: DB=mysql - php: '5.4' env: DB=postgresql - php: '5.5' From 5bab9d59b29f4f7bcd5a580064fe137cd0c6b562 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2018 14:19:23 +0200 Subject: [PATCH 37/53] Fix var_dump --- test/phpunit/MarginsLibTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/test/phpunit/MarginsLibTest.php b/test/phpunit/MarginsLibTest.php index ae06128925c..21c07f7c04a 100644 --- a/test/phpunit/MarginsLibTest.php +++ b/test/phpunit/MarginsLibTest.php @@ -140,7 +140,6 @@ class MarginsLibTest extends PHPUnit_Framework_TestCase $this->assertEquals(20,$result[2]); $result=getMarginInfos(10, 10, 19.6, 0, 0, 0, 8); - var_dump($result); print __METHOD__." result[0]=".$result[0]."\n"; $this->assertEquals(8,$result[0]); print __METHOD__." result[1]=".$result[1]."\n"; From 32a03f3c0bb2c316bb15122feece365824ddef34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2018 14:25:52 +0200 Subject: [PATCH 38/53] Fix eol --- htdocs/expedition/class/expedition.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 8a46f14c829..c666bbf4c37 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -48,14 +48,14 @@ class Expedition extends CommonObject * @var string ID to identify managed object */ public $element="shipping"; - + public $fk_element="fk_expedition"; - + /** * @var string Name of table without prefix where object is stored */ public $table_element="expedition"; - + public $table_element_line="expeditiondet"; public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe public $picto = 'sending'; @@ -478,7 +478,7 @@ class Expedition extends CommonObject $sql.= ", e.note_private, e.note_public"; $sql.= ', e.fk_incoterms, e.location_incoterms'; $sql.= ', i.libelle as libelle_incoterms'; - $sql.= ', s.libelle as shipping_method'; + $sql.= ', s.libelle as shipping_method'; $sql.= ", el.fk_source as origin_id, el.sourcetype as origin"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->db->escape($this->element)."'"; @@ -2293,7 +2293,7 @@ class ExpeditionLigne extends CommonObjectLine * @var string ID to identify managed object */ public $element='expeditiondet'; - + /** * @var string Name of table without prefix where object is stored */ From 42cb2b07db9bfe53947fc088327e467def77b8f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2018 15:22:49 +0200 Subject: [PATCH 39/53] Only min and max version --- .travis.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 996f3c898b6..5550550b905 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,7 +38,6 @@ php: - '7.0' - '7.1' - '7.2' -#- hhvm only with dist: trusty - nightly env: @@ -60,7 +59,6 @@ env: matrix: fast_finish: true allow_failures: - - php: hhvm - php: nightly # We exclude some combinations not usefull to save Travis CPU exclude: @@ -72,6 +70,8 @@ matrix: env: DB=mysql - php: '7.0' env: DB=mysql + - php: '7.1' + env: DB=mysql - php: '5.4' env: DB=postgresql - php: '5.5' @@ -82,8 +82,6 @@ matrix: env: DB=postgresql - php: '7.1' env: DB=postgresql - - php: hhvm - env: DB=postgresql - php: nightly env: DB=postgresql From ebba0b9e675a9ee98fc9b5f7c71bef8468258443 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2018 15:24:29 +0200 Subject: [PATCH 40/53] phpunit 6.1 compatibility --- test/phpunit/AccountingAccountTest.php | 2 ++ test/phpunit/GetUrlLibTest.php | 2 ++ test/phpunit/SupplierProposalTest.php | 2 ++ test/phpunit/UtilsTest.php | 2 ++ 4 files changed, 8 insertions(+) diff --git a/test/phpunit/AccountingAccountTest.php b/test/phpunit/AccountingAccountTest.php index ba7f567b4a0..1ada8944854 100644 --- a/test/phpunit/AccountingAccountTest.php +++ b/test/phpunit/AccountingAccountTest.php @@ -59,6 +59,8 @@ class AccountingAccountTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/GetUrlLibTest.php b/test/phpunit/GetUrlLibTest.php index 21dacd5a0f1..2a6d218dc93 100644 --- a/test/phpunit/GetUrlLibTest.php +++ b/test/phpunit/GetUrlLibTest.php @@ -61,6 +61,8 @@ class GetUrlLibTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/SupplierProposalTest.php b/test/phpunit/SupplierProposalTest.php index ee4729ed47f..2428bd6d441 100644 --- a/test/phpunit/SupplierProposalTest.php +++ b/test/phpunit/SupplierProposalTest.php @@ -63,6 +63,8 @@ class SupplierProposalTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; diff --git a/test/phpunit/UtilsTest.php b/test/phpunit/UtilsTest.php index b80ce84f624..e9c3ede729b 100644 --- a/test/phpunit/UtilsTest.php +++ b/test/phpunit/UtilsTest.php @@ -59,6 +59,8 @@ class UtilsTest extends PHPUnit_Framework_TestCase */ function __construct() { + parent::__construct(); + //$this->sharedFixture global $conf,$user,$langs,$db; $this->savconf=$conf; From e0b272941fcfa5f4941b60a5a421193d8502b081 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2018 15:25:27 +0200 Subject: [PATCH 41/53] Fix mariadb --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4c7a714eba1..22593b1eb08 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,13 +64,13 @@ matrix: # We exclude some combinations not usefull to save Travis CPU exclude: - php: '5.4' - env: DB=mysql + env: DB=mariadb - php: '5.5' - env: DB=mysql + env: DB=mariadb - php: '5.6' - env: DB=mysql + env: DB=mariadb - php: '7.0' - env: DB=mysql + env: DB=mariadb - php: '5.4' env: DB=postgresql - php: '5.5' From bb5fae0e46af9af7d4cb5260c9b66420a4be0cd1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2018 15:30:56 +0200 Subject: [PATCH 42/53] Fix eol --- htdocs/product/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 672ad334422..52815c1303d 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1068,7 +1068,7 @@ else print ''; } if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) - { + { // Volume print ''.$langs->trans("Volume").''; print ''; From dda0c5699e12114e4641caba097ab725b1349745 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2018 15:59:09 +0200 Subject: [PATCH 43/53] Update actions_setnotes.inc.php --- htdocs/core/actions_setnotes.inc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_setnotes.inc.php b/htdocs/core/actions_setnotes.inc.php index 899a9a260fb..ec253d5ef4a 100644 --- a/htdocs/core/actions_setnotes.inc.php +++ b/htdocs/core/actions_setnotes.inc.php @@ -53,8 +53,9 @@ if ($action == 'setnote_public' && ! empty($permissionnote) && ! GETPOST('cancel $hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); $hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); $hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); - require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; + $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result < 0) dol_print_error($db,$result); } } From ddd6ac296c67ad78149850c2be97cd3b8ea9bd40 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2018 16:09:40 +0200 Subject: [PATCH 44/53] Fix missing class --- htdocs/core/lib/pdf.lib.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 5eaf345fe04..c5fd49c81a4 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1195,8 +1195,16 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl $note=(! empty($object->lines[$i]->note)?$object->lines[$i]->note:''); $dbatch=(! empty($object->lines[$i]->detail_batch)?$object->lines[$i]->detail_batch:false); - if ($issupplierline) $prodser = new ProductFournisseur($db); - else $prodser = new Product($db); + if ($issupplierline) + { + include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; + $prodser = new ProductFournisseur($db); + } + else + { + include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + $prodser = new Product($db); + } if ($idprod) { From 3baaa2e975791b6b69f3e327859c7b650306bb41 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2018 16:18:08 +0200 Subject: [PATCH 45/53] Fix syntax error --- .../modules/dons/html_cerfafr.modules.php | 311 +++++++++--------- 1 file changed, 156 insertions(+), 155 deletions(-) diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index 8a22babea18..6aa9d4629e9 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -168,7 +168,7 @@ class html_cerfafr extends ModeleDon $form = str_replace('__DATE__',dol_print_date($don->date,'day',false,$outputlangs),$form); //$form = str_replace('__IP__',$user->ip,$form); // TODO $user->ip not exist $form = str_replace('__AMOUNT__', price($don->amount), $form); - $form = str_replace('__AMOUNTLETTERS__',amountToLetters($don->amount),$form); + $form = str_replace('__AMOUNTLETTERS__', $this->amountToLetters($don->amount),$form); $form = str_replace('__CURRENCY__',$outputlangs->transnoentitiesnoconv("Currency".$currency),$form); $form = str_replace('__CURRENCYCODE__',$conf->currency,$form); $form = str_replace('__MAIN_INFO_SOCIETE_NOM__',$mysoc->name,$form); @@ -277,163 +277,164 @@ class html_cerfafr extends ModeleDon return 0; } } -} -/** - * numbers to letters - * - * @param mixed $montant amount - * @param mixed $devise1 devise 1 ex: euro - * @param mixed $devise2 devise 2 ex: centimes - * @return string amount in letters - */ -private function amountToLetters($montant, $devise1='', $devise2='') -{ - $unite = array(); - $dix = array(); - $cent = array(); - if(empty($devise1)) $dev1='euros'; - else $dev1=$devise1; - if(empty($devise2)) $dev2='centimes'; - else $dev2=$devise2; - $valeur_entiere=intval($montant); - $valeur_decimal=intval(round($montant-intval($montant), 2)*100); - $dix_c=intval($valeur_decimal%100/10); - $cent_c=intval($valeur_decimal%1000/100); - $unite[1]=$valeur_entiere%10; - $dix[1]=intval($valeur_entiere%100/10); - $cent[1]=intval($valeur_entiere%1000/100); - $unite[2]=intval($valeur_entiere%10000/1000); - $dix[2]=intval($valeur_entiere%100000/10000); - $cent[2]=intval($valeur_entiere%1000000/100000); - $unite[3]=intval($valeur_entiere%10000000/1000000); - $dix[3]=intval($valeur_entiere%100000000/10000000); - $cent[3]=intval($valeur_entiere%1000000000/100000000); - $chif=array('', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit', 'neuf', 'dix', 'onze', 'douze', 'treize', 'quatorze', 'quinze', 'seize', 'dix sept', 'dix huit', 'dix neuf'); - $secon_c=''; - $trio_c=''; - for($i=1; $i<=3; $i++){ - $prim[$i]=''; - $secon[$i]=''; - $trio[$i]=''; - if($dix[$i]==0){ + /** + * numbers to letters + * + * @param mixed $montant amount + * @param mixed $devise1 devise 1 ex: euro + * @param mixed $devise2 devise 2 ex: centimes + * @return string amount in letters + */ + private function amountToLetters($montant, $devise1='', $devise2='') + { + $unite = array(); + $dix = array(); + $cent = array(); + if(empty($devise1)) $dev1='euros'; + else $dev1=$devise1; + if(empty($devise2)) $dev2='centimes'; + else $dev2=$devise2; + $valeur_entiere=intval($montant); + $valeur_decimal=intval(round($montant-intval($montant), 2)*100); + $dix_c=intval($valeur_decimal%100/10); + $cent_c=intval($valeur_decimal%1000/100); + $unite[1]=$valeur_entiere%10; + $dix[1]=intval($valeur_entiere%100/10); + $cent[1]=intval($valeur_entiere%1000/100); + $unite[2]=intval($valeur_entiere%10000/1000); + $dix[2]=intval($valeur_entiere%100000/10000); + $cent[2]=intval($valeur_entiere%1000000/100000); + $unite[3]=intval($valeur_entiere%10000000/1000000); + $dix[3]=intval($valeur_entiere%100000000/10000000); + $cent[3]=intval($valeur_entiere%1000000000/100000000); + $chif=array('', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit', 'neuf', 'dix', 'onze', 'douze', 'treize', 'quatorze', 'quinze', 'seize', 'dix sept', 'dix huit', 'dix neuf'); + $secon_c=''; + $trio_c=''; + for($i=1; $i<=3; $i++){ + $prim[$i]=''; $secon[$i]=''; - $prim[$i]=$chif[$unite[$i]]; + $trio[$i]=''; + if($dix[$i]==0){ + $secon[$i]=''; + $prim[$i]=$chif[$unite[$i]]; + } + else if($dix[$i]==1){ + $secon[$i]=''; + $prim[$i]=$chif[($unite[$i]+10)]; + } + else if($dix[$i]==2){ + if($unite[$i]==1){ + $secon[$i]='vingt et'; + $prim[$i]=$chif[$unite[$i]]; + } + else { + $secon[$i]='vingt'; + $prim[$i]=$chif[$unite[$i]]; + } + } + else if($dix[$i]==3){ + if($unite[$i]==1){ + $secon[$i]='trente et'; + $prim[$i]=$chif[$unite[$i]]; + } + else { + $secon[$i]='trente'; + $prim[$i]=$chif[$unite[$i]]; + } + } + else if($dix[$i]==4){ + if($unite[$i]==1){ + $secon[$i]='quarante et'; + $prim[$i]=$chif[$unite[$i]]; + } + else { + $secon[$i]='quarante'; + $prim[$i]=$chif[$unite[$i]]; + } + } + else if($dix[$i]==5){ + if($unite[$i]==1){ + $secon[$i]='cinquante et'; + $prim[$i]=$chif[$unite[$i]]; + } + else { + $secon[$i]='cinquante'; + $prim[$i]=$chif[$unite[$i]]; + } + } + else if($dix[$i]==6){ + if($unite[$i]==1){ + $secon[$i]='soixante et'; + $prim[$i]=$chif[$unite[$i]]; + } + else { + $secon[$i]='soixante'; + $prim[$i]=$chif[$unite[$i]]; + } + } + else if($dix[$i]==7){ + if($unite[$i]==1){ + $secon[$i]='soixante et'; + $prim[$i]=$chif[$unite[$i]+10]; + } + else { + $secon[$i]='soixante'; + $prim[$i]=$chif[$unite[$i]+10]; + } + } + else if($dix[$i]==8){ + if($unite[$i]==1){ + $secon[$i]='quatre-vingts et'; + $prim[$i]=$chif[$unite[$i]]; + } + else { + $secon[$i]='quatre-vingt'; + $prim[$i]=$chif[$unite[$i]]; + } + } + else if($dix[$i]==9){ + if($unite[$i]==1){ + $secon[$i]='quatre-vingts et'; + $prim[$i]=$chif[$unite[$i]+10]; + } + else { + $secon[$i]='quatre-vingts'; + $prim[$i]=$chif[$unite[$i]+10]; + } + } + if($cent[$i]==1) $trio[$i]='cent'; + else if($cent[$i]!=0 || $cent[$i]!='') $trio[$i]=$chif[$cent[$i]] .' cents'; } - else if($dix[$i]==1){ - $secon[$i]=''; - $prim[$i]=$chif[($unite[$i]+10)]; - } - else if($dix[$i]==2){ - if($unite[$i]==1){ - $secon[$i]='vingt et'; - $prim[$i]=$chif[$unite[$i]]; - } - else { - $secon[$i]='vingt'; - $prim[$i]=$chif[$unite[$i]]; - } - } - else if($dix[$i]==3){ - if($unite[$i]==1){ - $secon[$i]='trente et'; - $prim[$i]=$chif[$unite[$i]]; - } - else { - $secon[$i]='trente'; - $prim[$i]=$chif[$unite[$i]]; - } - } - else if($dix[$i]==4){ - if($unite[$i]==1){ - $secon[$i]='quarante et'; - $prim[$i]=$chif[$unite[$i]]; - } - else { - $secon[$i]='quarante'; - $prim[$i]=$chif[$unite[$i]]; - } - } - else if($dix[$i]==5){ - if($unite[$i]==1){ - $secon[$i]='cinquante et'; - $prim[$i]=$chif[$unite[$i]]; - } - else { - $secon[$i]='cinquante'; - $prim[$i]=$chif[$unite[$i]]; - } - } - else if($dix[$i]==6){ - if($unite[$i]==1){ - $secon[$i]='soixante et'; - $prim[$i]=$chif[$unite[$i]]; - } - else { - $secon[$i]='soixante'; - $prim[$i]=$chif[$unite[$i]]; - } - } - else if($dix[$i]==7){ - if($unite[$i]==1){ - $secon[$i]='soixante et'; - $prim[$i]=$chif[$unite[$i]+10]; - } - else { - $secon[$i]='soixante'; - $prim[$i]=$chif[$unite[$i]+10]; - } - } - else if($dix[$i]==8){ - if($unite[$i]==1){ - $secon[$i]='quatre-vingts et'; - $prim[$i]=$chif[$unite[$i]]; - } - else { - $secon[$i]='quatre-vingt'; - $prim[$i]=$chif[$unite[$i]]; - } - } - else if($dix[$i]==9){ - if($unite[$i]==1){ - $secon[$i]='quatre-vingts et'; - $prim[$i]=$chif[$unite[$i]+10]; - } - else { - $secon[$i]='quatre-vingts'; - $prim[$i]=$chif[$unite[$i]+10]; - } - } - if($cent[$i]==1) $trio[$i]='cent'; - else if($cent[$i]!=0 || $cent[$i]!='') $trio[$i]=$chif[$cent[$i]] .' cents'; + + + $chif2=array('', 'dix', 'vingt', 'trente', 'quarante', 'cinquante', 'soixante', 'soixante-dix', 'quatre-vingts', 'quatre-vingts dix'); + $secon_c=$chif2[$dix_c]; + if($cent_c==1) $trio_c='cent'; + else if($cent_c!=0 || $cent_c!='') $trio_c=$chif[$cent_c] .' cents'; + + if(($cent[3]==0 || $cent[3]=='') && ($dix[3]==0 || $dix[3]=='') && ($unite[3]==1)) + $somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' million '; + else if(($cent[3]!=0 && $cent[3]!='') || ($dix[3]!=0 && $dix[3]!='') || ($unite[3]!=0 && $unite[3]!='')) + $somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' millions '; + else + $somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]; + + if(($cent[2]==0 || $cent[2]=='') && ($dix[2]==0 || $dix[2]=='') && ($unite[2]==1)) + $somme = $somme.' mille '; + else if(($cent[2]!=0 && $cent[2]!='') || ($dix[2]!=0 && $dix[2]!='') || ($unite[2]!=0 && $unite[2]!='')) + $somme = $somme. $trio[2]. ' ' .$secon[2]. ' ' . $prim[2]. ' milles '; + else + $somme = $somme. $trio[2]. ' ' .$secon[2]. ' ' . $prim[2]; + + $somme = $somme. $trio[1]. ' ' .$secon[1]. ' ' . $prim[1]; + + $somme = $somme. ' '. $dev1 .' ' ; + + if(($cent_c=='0' || $cent_c=='') && ($dix_c=='0' || $dix_c=='')) + return $somme. ' et zéro '. $dev2; + else + return $somme. $trio_c. ' ' .$secon_c. ' ' . $dev2; } - -$chif2=array('', 'dix', 'vingt', 'trente', 'quarante', 'cinquante', 'soixante', 'soixante-dix', 'quatre-vingts', 'quatre-vingts dix'); - $secon_c=$chif2[$dix_c]; - if($cent_c==1) $trio_c='cent'; - else if($cent_c!=0 || $cent_c!='') $trio_c=$chif[$cent_c] .' cents'; - - if(($cent[3]==0 || $cent[3]=='') && ($dix[3]==0 || $dix[3]=='') && ($unite[3]==1)) - $somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' million '; - else if(($cent[3]!=0 && $cent[3]!='') || ($dix[3]!=0 && $dix[3]!='') || ($unite[3]!=0 && $unite[3]!='')) - $somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' millions '; - else - $somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]; - - if(($cent[2]==0 || $cent[2]=='') && ($dix[2]==0 || $dix[2]=='') && ($unite[2]==1)) - $somme = $somme.' mille '; - else if(($cent[2]!=0 && $cent[2]!='') || ($dix[2]!=0 && $dix[2]!='') || ($unite[2]!=0 && $unite[2]!='')) - $somme = $somme. $trio[2]. ' ' .$secon[2]. ' ' . $prim[2]. ' milles '; - else - $somme = $somme. $trio[2]. ' ' .$secon[2]. ' ' . $prim[2]; - - $somme = $somme. $trio[1]. ' ' .$secon[1]. ' ' . $prim[1]; - - $somme = $somme. ' '. $dev1 .' ' ; - - if(($cent_c=='0' || $cent_c=='') && ($dix_c=='0' || $dix_c=='')) - return $somme. ' et zéro '. $dev2; - else - return $somme. $trio_c. ' ' .$secon_c. ' ' . $dev2; } From 0bf850c1ea33f02679c1d016230a7ae200f46caa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2018 16:26:00 +0200 Subject: [PATCH 46/53] Fix phpcs --- htdocs/core/modules/dons/html_cerfafr.modules.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index 6aa9d4629e9..d6b998da357 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -436,5 +436,4 @@ class html_cerfafr extends ModeleDon else return $somme. $trio_c. ' ' .$secon_c. ' ' . $dev2; } - } From 887a40cf1dc795aa57aece8345d7b6c10946a7a0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2018 16:45:03 +0200 Subject: [PATCH 47/53] Remove TODO --- htdocs/admin/system/index.php | 2 +- htdocs/core/class/html.form.class.php | 5 +-- htdocs/core/class/html.formfile.class.php | 8 ++-- htdocs/core/class/html.formother.class.php | 8 ++-- htdocs/core/get_info.php | 2 +- htdocs/core/lib/agenda.lib.php | 8 ++-- htdocs/core/lib/ajax.lib.php | 2 +- htdocs/core/lib/functions.lib.php | 6 +-- htdocs/core/tpl/objectline_view.tpl.php | 4 +- htdocs/main.inc.php | 48 +--------------------- htdocs/societe/paymentmodes.php | 2 +- htdocs/user/class/user.class.php | 2 +- 12 files changed, 25 insertions(+), 72 deletions(-) diff --git a/htdocs/admin/system/index.php b/htdocs/admin/system/index.php index 7ffef739993..cf79ae910b3 100644 --- a/htdocs/admin/system/index.php +++ b/htdocs/admin/system/index.php @@ -105,7 +105,7 @@ print '
'; print ''; print "\n"; print "\n"; -print "\n"; +print "\n"; print '
".$langs->trans("Browser")."
".$langs->trans("UserAgent")."" .$_SERVER["HTTP_USER_AGENT"]."
".$langs->trans("Smartphone")."".(empty($conf->browser->phone)?$langs->trans("No"):$conf->browser->phone)."
".$langs->trans("Smartphone")."".(($conf->browser->layout != 'phone')?$langs->trans("No"):$langs->trans("Yes"))."
'; print '
'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a21c7ac310f..550ecea4867 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -51,12 +51,12 @@ class Form * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ public $error=''; - + var $num; // Cache arrays @@ -4957,7 +4957,6 @@ class Form if (! empty($conf->use_javascript_ajax) && (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR != "none")) { $usecalendar = ((empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR == 'eldy')?'jquery':$conf->global->MAIN_POPUP_CALENDAR); } - //if (! empty($conf->browser->phone)) $usecalendar='combo'; if ($d) { diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 003235f57c9..3758fe950bb 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -40,7 +40,7 @@ class FormFile * @var string Error code (or message) */ public $error; - + public $numoffiles; public $infofiles; // Used to return informations by function getDocumentsLink @@ -678,7 +678,7 @@ class FormFile $formadmin=new FormAdmin($this->db); $defaultlang=$codelang?$codelang:$langs->getDefaultLang(); $morecss='maxwidth150'; - if (! empty($conf->browser->phone)) $morecss='maxwidth100'; + if ($conf->browser->layout == 'phone') $morecss='maxwidth100'; $out.= $formadmin->select_language($defaultlang, 'lang_id', 0, 0, 0, 0, 0, $morecss); } else @@ -1318,7 +1318,7 @@ class FormFile if (empty($disablemove)) { - if ($nboffiles > 1 && empty($conf->browser->phone)) { + if ($nboffiles > 1 && $conf->browser->layout != 'phone') { print ''; if ($i > 0) { print 'id.'">'.img_up('default',0,'imgupforline').''; @@ -1329,7 +1329,7 @@ class FormFile print ''; } else { - print 'browser->phone) && empty($disablemove)) ?' class="linecolmove tdlineupdown"':' class="linecolmove"').'>'; + print 'browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown"':' class="linecolmove"').'>'; print ''; } } diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 9a4bdc46b75..ed371cc1e23 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -38,7 +38,7 @@ class FormOther { private $db; - + /** * @var string Error code (or message) */ @@ -1029,7 +1029,7 @@ class FormOther if (! empty($boxidactivatedforuser[$box->id])) continue; // Already visible for user $label=$langs->transnoentitiesnoconv($box->boxlabel); //if (preg_match('/graph/',$box->class)) $label.=' ('.$langs->trans("Graph").')'; - if (preg_match('/graph/',$box->class) && empty($conf->browser->phone)) + if (preg_match('/graph/',$box->class) && $conf->browser->layout != 'phone') { $label=$label.' '; } @@ -1163,7 +1163,7 @@ class FormOther } } - if (empty($conf->browser->phone)) + if ($conf->browser->layout != 'phone') { $emptybox->box_id='A'; $emptybox->info_box_head=array(); @@ -1190,7 +1190,7 @@ class FormOther } } - if (empty($conf->browser->phone)) + if ($conf->browser->layout != 'phone') { $emptybox->box_id='B'; $emptybox->info_box_head=array(); diff --git a/htdocs/core/get_info.php b/htdocs/core/get_info.php index 2f08a1d7d24..4e52c584083 100644 --- a/htdocs/core/get_info.php +++ b/htdocs/core/get_info.php @@ -134,7 +134,7 @@ if (! empty($conf->modulebuilder->enabled)) // Link to print main content area /* -if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && empty($conf->browser->phone)) +if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $conf->browser->layout != 'phone') { $qs=dol_escape_htmltag($_SERVER["QUERY_STRING"]); diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 9f8d1988c07..324ddc76cd7 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -68,7 +68,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print '
'; - if (! empty($conf->browser->phone)) print '
'; + if ($conf->browser->layout == 'phone') print '
'; else print ''; - if (! empty($conf->browser->phone)) print '
'; + if ($conf->browser->layout == 'phone') print '
'; else print '
'; print ''; @@ -180,10 +180,10 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print '
'; - if (! empty($conf->browser->phone)) print ''; + if ($conf->browser->layout == 'phone') print ''; else print '
'; print ''; print '
'; @@ -193,7 +193,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print '
'; - if (! empty($conf->browser->phone)) print ''; + if ($conf->browser->layout == 'phone') print ''; else print '
'; print '
'; // Close fichecenter diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 8fec9a5c160..8a39043a680 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -377,7 +377,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $ // select2 disabled for smartphones with standard browser. // TODO With select2 v4, it seems ok, except that responsive style on table become crazy when scrolling at end of array) - if (! empty($conf->browser->phone)) return ''; + if ($conf->browser->layout == 'phone') return ''; if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return ''; if (empty($conf->use_javascript_ajax)) return ''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ee72252281c..95157ffea8d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1353,7 +1353,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $width=80; $cssclass='photoref'; $showimage=$object->is_photo_available($conf->product->multidir_output[$entity]); $maxvisiblephotos=(isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO)?$conf->global->PRODUCT_MAX_VISIBLE_PHOTO:5); - if ($conf->browser->phone) $maxvisiblephotos=1; + if ($conf->browser->layout == 'phone') $maxvisiblephotos=1; if ($showimage) $morehtmlleft.='
'.$object->show_photos('product', $conf->product->multidir_output[$entity],'small',$maxvisiblephotos,0,0,0,$width,0).'
'; else { @@ -1372,7 +1372,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $width=80; $cssclass='photoref'; $showimage=$object->is_photo_available($conf->ticket->multidir_output[$entity].'/'.$object->track_id); $maxvisiblephotos=(isset($conf->global->TICKETSUP_MAX_VISIBLE_PHOTO)?$conf->global->TICKETSUP_MAX_VISIBLE_PHOTO:2); - if ($conf->browser->phone) $maxvisiblephotos=1; + if ($conf->browser->layout == 'phone') $maxvisiblephotos=1; if ($showimage) $morehtmlleft.='
'.$object->show_photos('ticket', $conf->ticket->multidir_output[$entity],'small',$maxvisiblephotos,0,0,0,$width,0).'
'; else { @@ -2549,7 +2549,7 @@ function dol_print_phone($phone,$countrycode='',$cid=0,$socid=0,$addlink='',$sep } if (! empty($addlink)) // Link on phone number (+ link to add action if conf->global->AGENDA_ADDACTIONFORPHONE set) { - if (! empty($conf->browser->phone) || (! empty($conf->clicktodial->enabled) && ! empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) // If phone or option for, we use link of phone + if ($conf->browser->layout == 'phone' || (! empty($conf->clicktodial->enabled) && ! empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) // If phone or option for, we use link of phone { $newphone =''; diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index dbedf2be1ce..e7166c14b28 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -292,7 +292,7 @@ $domData .= ' data-product_type="'.$line->product_type.'"'; 1 && empty($conf->browser->phone) && ($this->situation_counter == 1 || !$this->situation_cycle_ref) && empty($disablemove)) { ?> + if ($num > 1 && $conf->browser->layout != 'phone' && ($this->situation_counter == 1 || !$this->situation_cycle_ref) && empty($disablemove)) { ?> 0) { ?> id; ?>"> @@ -306,7 +306,7 @@ $domData .= ' data-product_type="'.$line->product_type.'"'; - browser->phone) && empty($disablemove)) ?' class="linecolmove tdlineupdown"':' class="linecolmove"'); ?>> + browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown"':' class="linecolmove"'); ?>> diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 26dcb94a0ba..4a385fdc6cb 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -256,8 +256,6 @@ if (isset($_SERVER["HTTP_USER_AGENT"])) $conf->browser->os=$tmp['browseros']; $conf->browser->version=$tmp['browserversion']; $conf->browser->layout=$tmp['layout']; // 'classic', 'phone', 'tablet' - $conf->browser->phone=$tmp['phone']; // TODO deprecated, use ->layout - $conf->browser->tablet=$tmp['tablet']; // TODO deprecated, use ->layout //var_dump($conf->browser); if ($conf->browser->layout == 'phone') $conf->dol_no_mouse_hover=1; @@ -486,17 +484,6 @@ if (! defined('NOLOGIN')) $_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadValueForCode"); $test=false; - // TODO @deprecated Remove this. Hook must be used, not this trigger. - $user->trigger_mesg='ErrorBadValueForCode - login='.GETPOST("username","alpha",2); - // Call of triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf); - if ($result < 0) { - $error++; - } - // End Call of triggers - // Hooks on failed login $action=''; $hookmanager->initHooks(array('login')); @@ -565,17 +552,6 @@ if (! defined('NOLOGIN')) // We set a generic message if not defined inside function checkLoginPassEntity or subfunctions if (empty($_SESSION["dol_loginmesg"])) $_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword"); - // TODO @deprecated Remove this. Hook must be used, not this trigger. - $user->trigger_mesg=$langs->trans("ErrorBadLoginPassword").' - login='.GETPOST("username","alpha",2); - // Call of triggers - include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf,GETPOST("username","alpha",2)); - if ($result < 0) { - $error++; - } - // End Call of triggers - // Hooks on failed login $action=''; $hookmanager->initHooks(array('login')); @@ -612,27 +588,12 @@ if (! defined('NOLOGIN')) $langs->loadLangs(array('main', 'errors')); $_SESSION["dol_loginmesg"]=$langs->trans("ErrorCantLoadUserFromDolibarrDatabase",$login); - - // TODO @deprecated Remove this. Hook must be used, not this trigger. - $user->trigger_mesg='ErrorCantLoadUserFromDolibarrDatabase - login='.$login; } if ($resultFetchUser < 0) { $_SESSION["dol_loginmesg"]=$user->error; - - // TODO @deprecated Remove this. Hook must be used, not this trigger. - $user->trigger_mesg=$user->error; } - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf); - if ($result < 0) { - $error++; - } - // End call triggers - // Hooks on failed login $action=''; $hookmanager->initHooks(array('login')); @@ -671,16 +632,10 @@ if (! defined('NOLOGIN')) $langs->loadLangs(array('main', 'errors')); $_SESSION["dol_loginmesg"]=$langs->trans("ErrorCantLoadUserFromDolibarrDatabase",$login); - - // TODO @deprecated Remove this. Hook must be used, not this trigger. - $user->trigger_mesg='ErrorCantLoadUserFromDolibarrDatabase - login='.$login; } if ($resultFetchUser < 0) { $_SESSION["dol_loginmesg"]=$user->error; - - // TODO @deprecated Remove this. Hook must be used, not this trigger. - $user->trigger_mesg=$user->error; } // TODO @deprecated Remove this. Hook must be used, not this trigger. @@ -900,7 +855,6 @@ if (! empty($conf->dol_use_jmobile) && in_array($conf->theme,array('bureau2crea' $conf->theme='eldy'; $conf->css = "/theme/".$conf->theme."/style.css.php"; } -//var_dump($conf->browser->phone); if (! defined('NOREQUIRETRAN')) { @@ -1574,7 +1528,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a } // Link to print main content area - if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && empty($conf->browser->phone)) + if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $conf->browser->layout != 'phone') { $qs=dol_escape_htmltag($_SERVER["QUERY_STRING"]); diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index d099cfcc103..f8fcacb2bb3 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1184,7 +1184,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $formadmin=new FormAdmin($db); $defaultlang=$codelang?$codelang:$langs->getDefaultLang(); $morecss='maxwidth150'; - if (! empty($conf->browser->phone)) $morecss='maxwidth100'; + if ($conf->browser->layout == 'phone') $morecss='maxwidth100'; $out.= $formadmin->select_language($defaultlang, 'lang_idrib'.$rib->id, 0, 0, 0, 0, 0, $morecss); } // Button diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 7cac0419772..adde437575c 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2232,7 +2232,7 @@ class User extends CommonObject $label.= '
'.$langs->trans("Browser").': '.$conf->browser->name.($conf->browser->version?' '.$conf->browser->version:'').' ('.$_SERVER['HTTP_USER_AGENT'].')'; $label.= '
'.$langs->trans("Layout").': '.$conf->browser->layout; $label.= '
'.$langs->trans("Screen").': '.$_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; - if (! empty($conf->browser->phone)) $label.= '
'.$langs->trans("Phone").': '.$conf->browser->phone; + if ($conf->browser->layout == 'phone') $label.= '
'.$langs->trans("Phone").': '.$langs->trans("Yes");; if (! empty($_SESSION["disablemodules"])) $label.= '
'.$langs->trans("DisabledModules").':
'.join(', ',explode(',',$_SESSION["disablemodules"])); } if ($infologin < 0) $label=''; From edd55fc75683f986e662efe9f9f217fe8912cd57 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2018 16:47:58 +0200 Subject: [PATCH 48/53] Fix all TODO in main and master files --- htdocs/main.inc.php | 26 ++------------------------ htdocs/master.inc.php | 2 +- 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 4a385fdc6cb..ce157beff0d 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -638,16 +638,6 @@ if (! defined('NOLOGIN')) $_SESSION["dol_loginmesg"]=$user->error; } - // TODO @deprecated Remove this. Hook must be used, not this trigger. - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf); - if ($result < 0) { - $error++; - } - // End call triggers - // Hooks on failed login $action=''; $hookmanager->initHooks(array('login')); @@ -735,17 +725,6 @@ if (! defined('NOLOGIN')) $loginfo = 'TZ='.$_SESSION["dol_tz"].';TZString='.$_SESSION["dol_tz_string"].';Screen='.$_SESSION["dol_screenwidth"].'x'.$_SESSION["dol_screenheight"]; - // TODO @deprecated Remove this. Hook must be used, not this trigger. - $user->trigger_mesg = $loginfo; - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('USER_LOGIN',$user,$user,$langs,$conf); - if ($result < 0) { - $error++; - } - // End call triggers - // Hooks on successfull login $action=''; $hookmanager->initHooks(array('login')); @@ -1753,9 +1732,8 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra $bugbaseurl.= '?title='; $bugbaseurl.= urlencode("Bug: "); $bugbaseurl.= '&body='; - // TODO use .github/ISSUE_TEMPLATE.md to generate? - $bugbaseurl .= urlencode("# Bug\n"); - $bugbaseurl .= urlencode("\n"); + $bugbaseurl.= urlencode("# Bug\n"); + $bugbaseurl.= urlencode("\n"); $bugbaseurl.= urlencode("## Environment\n"); $bugbaseurl.= urlencode("- **Version**: " . DOL_VERSION . "\n"); $bugbaseurl.= urlencode("- **OS**: " . php_uname('s') . "\n"); diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 52c4c9780c7..56ff709da8a 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -80,7 +80,7 @@ if (! empty($dolibarr_main_document_root_alt)) { if (preg_match('/^http(s)?:/',$value)) { - // TODO: Make this a warning rather than an error since the correct value can be derived in most cases + // Show error message $correct_value = str_replace($dolibarr_main_url_root, '', $value); print 'Error:
'."\n"; print 'Wrong $dolibarr_main_url_root_alt value in conf.php file.
'."\n"; From a68f5cad7730eafeb222c4645238273e58efd1a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2018 17:18:19 +0200 Subject: [PATCH 49/53] Fix syntax error --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 3758fe950bb..aea6acd6661 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1329,7 +1329,7 @@ class FormFile print ''; } else { - print 'browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown"':' class="linecolmove"').'>'; + print 'browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown"':' class="linecolmove"').'>'; print ''; } } From 4cca4ce020f2e843f2ae157ba0d18de88649a81d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2018 17:21:45 +0200 Subject: [PATCH 50/53] Update stripe.class.php --- htdocs/stripe/class/stripe.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index d6c6268dc4e..a1a4d58acac 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -379,7 +379,6 @@ class Stripe extends CommonObject "dol_id" => "" . $item . "", "dol_type" => "" . $origin . "", "dol_thirdparty_id" => "" . $societe->id . "", - "FULLTAG" => $description, 'dol_thirdparty_name' => $societe->name, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, From 7ca45cd117b730eac2b4cd38c23f28b44787d73f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2018 17:22:45 +0200 Subject: [PATCH 51/53] Update stripe.class.php --- htdocs/stripe/class/stripe.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index a1a4d58acac..ebb9fd3e394 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -398,7 +398,7 @@ class Stripe extends CommonObject "amount" => "$stripeamount", "currency" => "$currency", "capture" => true, - "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt + "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt "description" => "Stripe payment: ".$description, "metadata" => $metadata, "source" => "$source" @@ -408,7 +408,7 @@ class Stripe extends CommonObject "amount" => "$stripeamount", "currency" => "$currency", "capture" => true, - "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt + "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt "description" => "Stripe payment: ".$description, "metadata" => $metadata, "source" => "$source", From 3cc268c840436f80bafc245eb28da68ab7e9746e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2018 17:23:38 +0200 Subject: [PATCH 52/53] Update stripe.class.php --- htdocs/stripe/class/stripe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index ebb9fd3e394..b810f29fcdc 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -433,7 +433,7 @@ class Stripe extends CommonObject "amount" => "$stripeamount", "currency" => "$currency", "capture" => true, - "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt + "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt "description" => "Stripe payment: ".$description, "metadata" => $metadata, "source" => "$source", From d2afffaecaa3e2244809c21aea12edadef9b7bfc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2018 17:53:31 +0200 Subject: [PATCH 53/53] Fix phpcs --- htdocs/stripe/class/stripe.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 88dfba61806..5e3cfc7f522 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -378,7 +378,7 @@ class Stripe extends CommonObject "dol_id" => "" . $item . "", "dol_type" => "" . $origin . "", "dol_thirdparty_id" => "" . $societe->id . "", - 'dol_thirdparty_name' => $societe->name, + 'dol_thirdparty_name' => $societe->name, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR']) @@ -398,7 +398,7 @@ class Stripe extends CommonObject "currency" => "$currency", "capture" => true, "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt - "description" => "Stripe payment: ".$description, + "description" => "Stripe payment: ".$description, "metadata" => $metadata, "source" => "$source" )); @@ -406,7 +406,7 @@ class Stripe extends CommonObject $paymentarray = array( "amount" => "$stripeamount", "currency" => "$currency", - "capture" => true, + "capture" => true, "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt "description" => "Stripe payment: ".$description, "metadata" => $metadata, @@ -431,7 +431,7 @@ class Stripe extends CommonObject $paymentarray = array( "amount" => "$stripeamount", "currency" => "$currency", - "capture" => true, + "capture" => true, "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt "description" => "Stripe payment: ".$description, "metadata" => $metadata,