From f613688b28c5b104d7816bc5ab5756d48a420b08 Mon Sep 17 00:00:00 2001
From: Anthony Berton <34568357+bb2a@users.noreply.github.com>
Date: Thu, 8 Apr 2021 13:37:09 +0200
Subject: [PATCH 001/449] add_option
---
htdocs/admin/notification.php | 17 +++++++++++++++++
htdocs/core/class/notify.class.php | 24 +++++++++++++++++++++---
htdocs/langs/en_US/admin.lang | 1 +
htdocs/langs/en_US/other.lang | 3 +++
htdocs/langs/fr_FR/admin.lang | 1 +
htdocs/langs/fr_FR/other.lang | 3 +++
6 files changed, 46 insertions(+), 3 deletions(-)
diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php
index e1cf115626f..6609021cc2a 100644
--- a/htdocs/admin/notification.php
+++ b/htdocs/admin/notification.php
@@ -97,6 +97,10 @@ if ($action == 'setvalue' && $user->admin) {
$error++;
}
+ $result = dolibarr_set_const($db, "NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE", GETPOST("notif_disable", "alphawithlgt"), 'chaine', 0, '', $conf->entity);
+ if ($result < 0) {
+ $error++;
+ }
if (!$error) {
$db->commit();
@@ -198,6 +202,19 @@ if (!empty($conf->global->NOTIFICATION_EMAIL_FROM) && !isValidEmail($conf->globa
}
print '';
print '';
+$arrayofnotifto = array(
+'',
+$langs->trans('notiftouser'),
+$langs->trans('notiftofixedemail'),
+$langs->trans('notiftouserandtofixedemail')
+);
+var_dump($arrayofnotifto,$conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE);
+print '
Date: Thu, 8 Apr 2021 11:44:24 +0000
Subject: [PATCH 002/449] Fixing style errors.
---
htdocs/admin/notification.php | 2 +-
htdocs/core/class/notify.class.php | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php
index 6609021cc2a..d467b6bb62d 100644
--- a/htdocs/admin/notification.php
+++ b/htdocs/admin/notification.php
@@ -208,7 +208,7 @@ $langs->trans('notiftouser'),
$langs->trans('notiftofixedemail'),
$langs->trans('notiftouserandtofixedemail')
);
-var_dump($arrayofnotifto,$conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE);
+var_dump($arrayofnotifto, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE);
print '';
print $langs->trans("NotificationDisableConfirmMessage").' ';
print '';
diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php
index 92555da891a..695a17a75d8 100644
--- a/htdocs/core/class/notify.class.php
+++ b/htdocs/core/class/notify.class.php
@@ -112,18 +112,18 @@ class Notify
$langs->load("mails");
$listofnotiftodo = $this->getNotificationsArray($action, $socid, $object, 0);
- if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE)){
- if ($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 1 || $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 3){
- foreach($listofnotiftodo as $val){
- if ($val['type'] == 'touser'){
+ if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE)) {
+ if ($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 1 || $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 3) {
+ foreach ($listofnotiftodo as $val) {
+ if ($val['type'] == 'touser') {
unset($listofnotiftodo[$val['email']]);
$listofnotiftodo = array_merge($listofnotiftodo);
}
}
}
- if ($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 2 || $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 3){
- foreach($listofnotiftodo as $val){
- if ($val['type'] == 'tofixedemail'){
+ if ($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 2 || $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 3) {
+ foreach ($listofnotiftodo as $val) {
+ if ($val['type'] == 'tofixedemail') {
unset($listofnotiftodo[$val['email']]);
$listofnotiftodo = array_merge($listofnotiftodo);
}
From 822d9b227bdd2eb7e8b304f8fa501fe1d03adfb7 Mon Sep 17 00:00:00 2001
From: Anthony Berton <34568357+bb2a@users.noreply.github.com>
Date: Thu, 8 Apr 2021 13:50:55 +0200
Subject: [PATCH 003/449] Update notification.php
---
htdocs/admin/notification.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php
index 6609021cc2a..85e097dceb3 100644
--- a/htdocs/admin/notification.php
+++ b/htdocs/admin/notification.php
@@ -202,13 +202,14 @@ if (!empty($conf->global->NOTIFICATION_EMAIL_FROM) && !isValidEmail($conf->globa
}
print ' ';
print ' ';
+
$arrayofnotifto = array(
'',
$langs->trans('notiftouser'),
$langs->trans('notiftofixedemail'),
$langs->trans('notiftouserandtofixedemail')
);
-var_dump($arrayofnotifto,$conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE);
+
print '';
print $langs->trans("NotificationDisableConfirmMessage").' ';
print '';
From d3053c0c1b8ffaac71253bc12d6f3f0f249280f0 Mon Sep 17 00:00:00 2001
From: Anthony Berton <34568357+bb2a@users.noreply.github.com>
Date: Wed, 28 Apr 2021 23:35:47 +0200
Subject: [PATCH 004/449] delete_fr_lang
---
htdocs/langs/fr_FR/admin.lang | 1 -
htdocs/langs/fr_FR/other.lang | 3 ---
2 files changed, 4 deletions(-)
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 02e0b27af5d..ef48fc0a82d 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -1662,7 +1662,6 @@ MailingDelay=Temps d'attente, en seconde, avant d'envoyer le prochain message
NotificationSetup=Configuration du module Notification par email
NotificationEMailFrom=Adresse émettrice (From) des emails envoyés lors des notifications
FixedEmailTarget=Email fixe cible destinataires
-NotificationDisableConfirmMessage=Notifications desactivé dans les messages de confirmation
##### Sendings #####
SendingsSetup=Configuration du module Expédition/Livraison
SendingsReceiptModel=Modèles de bordereau d'expédition
diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang
index 4e228ed50bd..a8078129464 100644
--- a/htdocs/langs/fr_FR/other.lang
+++ b/htdocs/langs/fr_FR/other.lang
@@ -35,9 +35,6 @@ OnlyOneFieldForXAxisIsPossible=1 seul champ est actuellement possible en tant qu
AtLeastOneMeasureIsRequired=Au moins 1 champ de mesure est requis
AtLeastOneXAxisIsRequired=Au moins 1 champ pour l'axe X est requis
LatestBlogPosts=Derniers articles du Blog
-notiftouser=Aux utilisateurs
-notiftofixedemail=Vers les courriers fixe
-notiftouserandtofixedemail=Aux utilisateurs et les courriers fixe
Notify_ORDER_VALIDATE=Validation commande client
Notify_ORDER_SENTBYMAIL=Envoi commande client par email
Notify_ORDER_SUPPLIER_SENTBYMAIL=Envoi commande fournisseur par email
From c1e6109c4bfecda86c9ae06be638196729b2b616 Mon Sep 17 00:00:00 2001
From: Anthony Berton <34568357+bb2a@users.noreply.github.com>
Date: Thu, 29 Apr 2021 00:03:16 +0200
Subject: [PATCH 005/449] Update
---
htdocs/admin/notification.php | 28 ++++++++++++++++++++++------
htdocs/core/class/notify.class.php | 24 +++++++++++-------------
htdocs/langs/en_US/admin.lang | 3 ++-
3 files changed, 35 insertions(+), 20 deletions(-)
diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php
index 85e097dceb3..93263998cbe 100644
--- a/htdocs/admin/notification.php
+++ b/htdocs/admin/notification.php
@@ -204,16 +204,32 @@ print ' ';
print ' ';
$arrayofnotifto = array(
-'',
-$langs->trans('notiftouser'),
-$langs->trans('notiftofixedemail'),
-$langs->trans('notiftouserandtofixedemail')
+-1 => '',
+1 => $langs->trans('notiftouser'),
+2 => $langs->trans('notiftofixedemail'),
+3 => $langs->trans('notiftouserandtofixedemail')
);
print '';
-print $langs->trans("NotificationDisableConfirmMessage").' ';
+print $langs->trans("NotificationDisableConfirmMessageUser").'';
print '';
-print $form->selectarray("notif_disable", $arrayofnotifto, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE, 0, 0, 0, '', 1, 0, 0, '', 'maxwidth400', 1);
+if ($conf->use_javascript_ajax) {
+ print ajax_constantonoff('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER');
+} else {
+ $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
+ print $form->selectarray("NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER", $arrval, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER);
+}
+print ' ';
+print ' ';
+print '';
+print $langs->trans("NotificationDisableConfirmMessageFix").' ';
+print '';
+if ($conf->use_javascript_ajax) {
+ print ajax_constantonoff('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX');
+} else {
+ $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
+ print $form->selectarray("NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX", $arrval, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX);
+}
print ' ';
print ' ';
print '';
diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php
index 695a17a75d8..11ca1c43d3e 100644
--- a/htdocs/core/class/notify.class.php
+++ b/htdocs/core/class/notify.class.php
@@ -112,21 +112,19 @@ class Notify
$langs->load("mails");
$listofnotiftodo = $this->getNotificationsArray($action, $socid, $object, 0);
- if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE)) {
- if ($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 1 || $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 3) {
- foreach ($listofnotiftodo as $val) {
- if ($val['type'] == 'touser') {
- unset($listofnotiftodo[$val['email']]);
- $listofnotiftodo = array_merge($listofnotiftodo);
- }
+ if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER)) {
+ foreach ($listofnotiftodo as $val) {
+ if ($val['type'] == 'touser') {
+ unset($listofnotiftodo[$val['email']]);
+ $listofnotiftodo = array_merge($listofnotiftodo);
}
}
- if ($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 2 || $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 3) {
- foreach ($listofnotiftodo as $val) {
- if ($val['type'] == 'tofixedemail') {
- unset($listofnotiftodo[$val['email']]);
- $listofnotiftodo = array_merge($listofnotiftodo);
- }
+ }
+ if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX)) {
+ foreach ($listofnotiftodo as $val) {
+ if ($val['type'] == 'tofixedemail') {
+ unset($listofnotiftodo[$val['email']]);
+ $listofnotiftodo = array_merge($listofnotiftodo);
}
}
}
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 73d2a5ca558..2154539939c 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1673,7 +1673,8 @@ MailingDelay=Seconds to wait after sending next message
NotificationSetup=Email Notification module setup
NotificationEMailFrom=Sender email (From) for emails sent by the Notifications module
FixedEmailTarget=Recipient
-NotificationDisableConfirmMessage=Notification disable in confirm message
+NotificationDisableConfirmMessageFix=Disable notification info in confirm message for fix notification
+NotificationDisableConfirmMessageUser=Disable notification info in confirm message for user notification
##### Sendings #####
SendingsSetup=Shipping module setup
SendingsReceiptModel=Sending receipt model
From b6ddea57f3e462dd2ffa312e5252b78f7571323d Mon Sep 17 00:00:00 2001
From: Anthony Berton <34568357+bb2a@users.noreply.github.com>
Date: Thu, 29 Apr 2021 00:17:55 +0200
Subject: [PATCH 006/449] update
---
htdocs/admin/notification.php | 7 -------
1 file changed, 7 deletions(-)
diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php
index 6b17b9134f7..bf4928dc5a4 100644
--- a/htdocs/admin/notification.php
+++ b/htdocs/admin/notification.php
@@ -203,13 +203,6 @@ if (!empty($conf->global->NOTIFICATION_EMAIL_FROM) && !isValidEmail($conf->globa
print '';
print '';
-$arrayofnotifto = array(
--1 => '',
-1 => $langs->trans('notiftouser'),
-2 => $langs->trans('notiftofixedemail'),
-3 => $langs->trans('notiftouserandtofixedemail')
-);
-
print '';
print $langs->trans("NotificationDisableConfirmMessageUser").' ';
print '';
From 1d81322120391fc8337fee12e4ec4907c851c051 Mon Sep 17 00:00:00 2001
From: Anthony Berton <34568357+bb2a@users.noreply.github.com>
Date: Thu, 6 May 2021 22:54:32 +0200
Subject: [PATCH 007/449] Update pdf.php
---
htdocs/admin/pdf.php | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php
index 7d7b5e36a40..256038d356c 100644
--- a/htdocs/admin/pdf.php
+++ b/htdocs/admin/pdf.php
@@ -4,6 +4,7 @@
* Copyright (C) 2005-2011 Regis Houssin
* Copyright (C) 2012-2107 Juanjo Menent
* Copyright (C) 2019 Ferran Marcet
+ * Copyright (C) 2021 Anthony Berton
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -329,6 +330,11 @@ print ''.$langs->trans("MAIN_DOCUMENTS_LOGO_HEIGHT").'
print ' ';
print ' ';
+// Width of picture product lign
+print ''.$langs->trans("MAIN_DOCUMENTS_WITH_PICTURE_WIDTH").' ';
+print ' ';
+print ' ';
+
// Show project
if (!empty($conf->projet->enabled)) {
From 2e50fde9aa4f310519630a9edebad9ffc63fb3fa Mon Sep 17 00:00:00 2001
From: Anthony Berton <34568357+bb2a@users.noreply.github.com>
Date: Fri, 7 May 2021 22:13:53 +0200
Subject: [PATCH 008/449] edit_in_propal
---
htdocs/comm/propal/card.php | 24 +++++++++++------------
htdocs/comm/propal/class/propal.class.php | 4 ++--
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 229303849f0..f7d8f1731d6 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -2064,12 +2064,12 @@ if ($action == 'create') {
print '';
print ' ';
- if ($object->statut == Propal::STATUS_DRAFT && $action == 'editdate' && $usercancreate) {
+ if ($action == 'editdate' && $usercancreate) {
print ' ';
- if ($object->statut == Propal::STATUS_DRAFT && $action == 'editecheance' && $usercancreate) {
+ if ($action == 'editecheance' && $usercancreate) {
print ' ';
- if ($object->statut == Propal::STATUS_DRAFT && $action == 'editconditions' && $usercancreate) {
+ if ($action == 'editconditions' && $usercancreate) {
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
} else {
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none');
@@ -2140,12 +2140,12 @@ if ($action == 'create') {
print '';
print ' ';
- if ($object->statut == Propal::STATUS_DRAFT && $action == 'editmode' && $usercancreate) {
+ if ($action == 'editmode' && $usercancreate) {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
} else {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none');
@@ -2169,12 +2169,12 @@ if ($action == 'create') {
print ' ('.$langs->trans('AfterOrder').')';
}
print ' ';
- if ($action != 'editavailability' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
+ if ($action != 'editavailability' && $usercancreate) {
print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1).' ';
}
print ' ';
print '';
- if ($object->statut == Propal::STATUS_DRAFT && $action == 'editavailability' && $usercancreate) {
+ if ($action == 'editavailability' && $usercancreate) {
$form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'availability_id', 1);
} else {
$form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'none', 1);
@@ -2226,12 +2226,12 @@ if ($action == 'create') {
print '';
print ' ';
- if ($object->statut == Propal::STATUS_DRAFT && $action == 'editdemandreason' && $usercancreate) {
+ if ($action == 'editdemandreason' && $usercancreate) {
$form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'demand_reason_id', 1);
} else {
$form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'none');
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index c544f5f7fe9..500f7b14380 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -1974,7 +1974,7 @@ class Propal extends CommonObject
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET datep = '".$this->db->idate($date)."'";
- $sql .= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
+ $sql .= " WHERE rowid = ".$this->id;
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -2030,7 +2030,7 @@ class Propal extends CommonObject
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fin_validite = ".($date_fin_validite != '' ? "'".$this->db->idate($date_fin_validite)."'" : 'null');
- $sql .= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
+ $sql .= " WHERE rowid = ".$this->id;
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
From 7836651f84380abf85204f876264593ce05b6054 Mon Sep 17 00:00:00 2001
From: lmarcouiller
Date: Tue, 27 Jul 2021 09:51:38 +0200
Subject: [PATCH 009/449] Fix debug bar for php 8.0
---
htdocs/includes/symfony/var-dumper/Cloner/VarCloner.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/includes/symfony/var-dumper/Cloner/VarCloner.php b/htdocs/includes/symfony/var-dumper/Cloner/VarCloner.php
index 98d6e9e51c1..20cc8d08354 100644
--- a/htdocs/includes/symfony/var-dumper/Cloner/VarCloner.php
+++ b/htdocs/includes/symfony/var-dumper/Cloner/VarCloner.php
@@ -291,7 +291,7 @@ class VarCloner extends AbstractCloner
if (!empty($frame['line'])) {
ob_start();
debug_zval_dump($obj);
- self::$hashMask = substr(ob_get_clean(), 17);
+ self::$hashMask = strlen(substr(ob_get_clean(), 17));
}
}
From b0133224d89cc8b001452c24489c79fe1b913d87 Mon Sep 17 00:00:00 2001
From: lmarcouiller
Date: Thu, 29 Jul 2021 10:20:01 +0200
Subject: [PATCH 010/449] Update of var_dumper package 3.0 -> 3.2
---
composer.json | 2 +-
composer.lock | 4 +-
.../symfony/var-dumper/Caster/AmqpCaster.php | 106 +++++---
.../symfony/var-dumper/Caster/ArgsStub.php | 80 ++++++
.../symfony/var-dumper/Caster/Caster.php | 44 ++-
.../symfony/var-dumper/Caster/ClassStub.php | 87 ++++++
.../symfony/var-dumper/Caster/ConstStub.php | 5 +
.../symfony/var-dumper/Caster/CutStub.php | 5 +-
.../symfony/var-dumper/Caster/DOMCaster.php | 6 +-
.../symfony/var-dumper/Caster/EnumStub.php | 5 +-
.../var-dumper/Caster/ExceptionCaster.php | 186 ++++++++-----
.../symfony/var-dumper/Caster/LinkStub.php | 51 ++++
.../symfony/var-dumper/Caster/PdoCaster.php | 6 +
.../symfony/var-dumper/Caster/RedisCaster.php | 77 ++++++
.../var-dumper/Caster/ReflectionCaster.php | 92 ++++---
.../var-dumper/Caster/ResourceCaster.php | 9 +-
.../symfony/var-dumper/Caster/SplCaster.php | 10 +-
.../symfony/var-dumper/Caster/StubCaster.php | 16 +-
.../var-dumper/Caster/XmlReaderCaster.php | 77 ++++++
.../var-dumper/Cloner/AbstractCloner.php | 53 ++--
.../var-dumper/Cloner/ClonerInterface.php | 4 +-
.../symfony/var-dumper/Cloner/Cursor.php | 1 +
.../symfony/var-dumper/Cloner/Data.php | 98 +++++--
.../var-dumper/Cloner/DumperInterface.php | 32 +--
.../symfony/var-dumper/Cloner/Stub.php | 1 +
.../symfony/var-dumper/Cloner/VarCloner.php | 82 ++++--
.../var-dumper/Dumper/AbstractDumper.php | 79 ++++--
.../symfony/var-dumper/Dumper/CliDumper.php | 76 ++++--
.../var-dumper/Dumper/DataDumperInterface.php | 2 +-
.../symfony/var-dumper/Dumper/HtmlDumper.php | 245 ++++++++++++-----
htdocs/includes/symfony/var-dumper/LICENSE | 2 +-
htdocs/includes/symfony/var-dumper/README.md | 23 +-
.../var-dumper/Test/VarDumperTestTrait.php | 17 +-
.../var-dumper/Tests/Caster/CasterTest.php | 3 +-
.../Tests/Caster/ExceptionCasterTest.php | 225 ++++++++++++++++
.../var-dumper/Tests/Caster/PdoCasterTest.php | 41 +--
.../Tests/Caster/RedisCasterTest.php | 85 ++++++
.../Tests/Caster/ReflectionCasterTest.php | 101 +++----
.../var-dumper/Tests/Caster/SplCasterTest.php | 39 ++-
.../Tests/Caster/StubCasterTest.php | 171 ++++++++++++
.../Tests/Caster/XmlReaderCasterTest.php | 248 +++++++++++++++++
.../var-dumper/Tests/CliDumperTest.php | 251 +++++++++++-------
.../Tests/Fixtures/FooInterface.php | 11 +
.../Tests/Fixtures/NotLoadableClass.php | 7 +
.../var-dumper/Tests/Fixtures/Twig.php | 26 +-
.../var-dumper/Tests/Fixtures/xml_reader.xml | 10 +
.../var-dumper/Tests/HtmlDumperTest.php | 52 ++--
.../Tests/Test/VarDumperTestTraitTest.php | 3 +-
.../var-dumper/Tests/VarClonerTest.php | 109 +++++++-
.../includes/symfony/var-dumper/composer.json | 9 +-
.../symfony/var-dumper/phpunit.xml.dist | 4 +
51 files changed, 2393 insertions(+), 585 deletions(-)
create mode 100644 htdocs/includes/symfony/var-dumper/Caster/ArgsStub.php
create mode 100644 htdocs/includes/symfony/var-dumper/Caster/ClassStub.php
create mode 100644 htdocs/includes/symfony/var-dumper/Caster/LinkStub.php
create mode 100644 htdocs/includes/symfony/var-dumper/Caster/RedisCaster.php
create mode 100644 htdocs/includes/symfony/var-dumper/Caster/XmlReaderCaster.php
create mode 100644 htdocs/includes/symfony/var-dumper/Tests/Caster/ExceptionCasterTest.php
create mode 100644 htdocs/includes/symfony/var-dumper/Tests/Caster/RedisCasterTest.php
create mode 100644 htdocs/includes/symfony/var-dumper/Tests/Caster/StubCasterTest.php
create mode 100644 htdocs/includes/symfony/var-dumper/Tests/Caster/XmlReaderCasterTest.php
create mode 100644 htdocs/includes/symfony/var-dumper/Tests/Fixtures/FooInterface.php
create mode 100644 htdocs/includes/symfony/var-dumper/Tests/Fixtures/NotLoadableClass.php
create mode 100644 htdocs/includes/symfony/var-dumper/Tests/Fixtures/xml_reader.xml
diff --git a/composer.json b/composer.json
index 130fda34945..8d82f530df8 100644
--- a/composer.json
+++ b/composer.json
@@ -35,7 +35,7 @@
"nnnick/chartjs" : "^2.9",
"stripe/stripe-php" : "6.43.1",
"maximebf/debugbar" : "1.15.1",
- "symfony/var-dumper" : "3"
+ "symfony/var-dumper" : "3.2"
},
"require-dev" : {
"php-parallel-lint/php-parallel-lint" : "^0",
diff --git a/composer.lock b/composer.lock
index 3e867f8f186..5f761cb63fe 100644
--- a/composer.lock
+++ b/composer.lock
@@ -591,7 +591,7 @@
},
{
"name": "symfony/var-dumper",
- "version": "v3.0.0",
+ "version": "v3.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
@@ -616,7 +616,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.0-dev"
+ "dev-master": "3.2-dev"
}
},
"autoload": {
diff --git a/htdocs/includes/symfony/var-dumper/Caster/AmqpCaster.php b/htdocs/includes/symfony/var-dumper/Caster/AmqpCaster.php
index 4e9b351c181..655262f4065 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/AmqpCaster.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/AmqpCaster.php
@@ -48,7 +48,16 @@ class AmqpCaster
{
$prefix = Caster::PREFIX_VIRTUAL;
- // BC layer in the ampq lib
+ $a += array(
+ $prefix.'is_connected' => $c->isConnected(),
+ );
+
+ // Recent version of the extension already expose private properties
+ if (isset($a["\x00AMQPConnection\x00login"])) {
+ return $a;
+ }
+
+ // BC layer in the amqp lib
if (method_exists($c, 'getReadTimeout')) {
$timeout = $c->getReadTimeout();
} else {
@@ -56,13 +65,13 @@ class AmqpCaster
}
$a += array(
- $prefix.'isConnected' => $c->isConnected(),
+ $prefix.'is_connected' => $c->isConnected(),
$prefix.'login' => $c->getLogin(),
$prefix.'password' => $c->getPassword(),
$prefix.'host' => $c->getHost(),
- $prefix.'port' => $c->getPort(),
$prefix.'vhost' => $c->getVhost(),
- $prefix.'readTimeout' => $timeout,
+ $prefix.'port' => $c->getPort(),
+ $prefix.'read_timeout' => $timeout,
);
return $a;
@@ -73,11 +82,19 @@ class AmqpCaster
$prefix = Caster::PREFIX_VIRTUAL;
$a += array(
- $prefix.'isConnected' => $c->isConnected(),
- $prefix.'channelId' => $c->getChannelId(),
- $prefix.'prefetchSize' => $c->getPrefetchSize(),
- $prefix.'prefetchCount' => $c->getPrefetchCount(),
+ $prefix.'is_connected' => $c->isConnected(),
+ $prefix.'channel_id' => $c->getChannelId(),
+ );
+
+ // Recent version of the extension already expose private properties
+ if (isset($a["\x00AMQPChannel\x00connection"])) {
+ return $a;
+ }
+
+ $a += array(
$prefix.'connection' => $c->getConnection(),
+ $prefix.'prefetch_size' => $c->getPrefetchSize(),
+ $prefix.'prefetch_count' => $c->getPrefetchCount(),
);
return $a;
@@ -88,11 +105,19 @@ class AmqpCaster
$prefix = Caster::PREFIX_VIRTUAL;
$a += array(
- $prefix.'name' => $c->getName(),
$prefix.'flags' => self::extractFlags($c->getFlags()),
- $prefix.'arguments' => $c->getArguments(),
+ );
+
+ // Recent version of the extension already expose private properties
+ if (isset($a["\x00AMQPQueue\x00name"])) {
+ return $a;
+ }
+
+ $a += array(
$prefix.'connection' => $c->getConnection(),
$prefix.'channel' => $c->getChannel(),
+ $prefix.'name' => $c->getName(),
+ $prefix.'arguments' => $c->getArguments(),
);
return $a;
@@ -103,12 +128,24 @@ class AmqpCaster
$prefix = Caster::PREFIX_VIRTUAL;
$a += array(
- $prefix.'name' => $c->getName(),
$prefix.'flags' => self::extractFlags($c->getFlags()),
- $prefix.'type' => isset(self::$exchangeTypes[$c->getType()]) ? new ConstStub(self::$exchangeTypes[$c->getType()], $c->getType()) : $c->getType(),
- $prefix.'arguments' => $c->getArguments(),
- $prefix.'channel' => $c->getChannel(),
+ );
+
+ $type = isset(self::$exchangeTypes[$c->getType()]) ? new ConstStub(self::$exchangeTypes[$c->getType()], $c->getType()) : $c->getType();
+
+ // Recent version of the extension already expose private properties
+ if (isset($a["\x00AMQPExchange\x00name"])) {
+ $a["\x00AMQPExchange\x00type"] = $type;
+
+ return $a;
+ }
+
+ $a += array(
$prefix.'connection' => $c->getConnection(),
+ $prefix.'channel' => $c->getChannel(),
+ $prefix.'name' => $c->getName(),
+ $prefix.'type' => $type,
+ $prefix.'arguments' => $c->getArguments(),
);
return $a;
@@ -118,28 +155,37 @@ class AmqpCaster
{
$prefix = Caster::PREFIX_VIRTUAL;
+ $deliveryMode = new ConstStub($c->getDeliveryMode().(2 === $c->getDeliveryMode() ? ' (persistent)' : ' (non-persistent)'), $c->getDeliveryMode());
+
+ // Recent version of the extension already expose private properties
+ if (isset($a["\x00AMQPEnvelope\x00body"])) {
+ $a["\0AMQPEnvelope\0delivery_mode"] = $deliveryMode;
+
+ return $a;
+ }
+
if (!($filter & Caster::EXCLUDE_VERBOSE)) {
$a += array($prefix.'body' => $c->getBody());
}
$a += array(
- $prefix.'routingKey' => $c->getRoutingKey(),
- $prefix.'deliveryTag' => $c->getDeliveryTag(),
- $prefix.'deliveryMode' => new ConstStub($c->getDeliveryMode().(2 === $c->getDeliveryMode() ? ' (persistent)' : ' (non-persistent)'), $c->getDeliveryMode()),
- $prefix.'exchangeName' => $c->getExchangeName(),
- $prefix.'isRedelivery' => $c->isRedelivery(),
- $prefix.'contentType' => $c->getContentType(),
- $prefix.'contentEncoding' => $c->getContentEncoding(),
- $prefix.'type' => $c->getType(),
- $prefix.'timestamp' => $c->getTimestamp(),
- $prefix.'priority' => $c->getPriority(),
- $prefix.'expiration' => $c->getExpiration(),
- $prefix.'userId' => $c->getUserId(),
- $prefix.'appId' => $c->getAppId(),
- $prefix.'messageId' => $c->getMessageId(),
- $prefix.'replyTo' => $c->getReplyTo(),
- $prefix.'correlationId' => $c->getCorrelationId(),
+ $prefix.'delivery_tag' => $c->getDeliveryTag(),
+ $prefix.'is_redelivery' => $c->isRedelivery(),
+ $prefix.'exchange_name' => $c->getExchangeName(),
+ $prefix.'routing_key' => $c->getRoutingKey(),
+ $prefix.'content_type' => $c->getContentType(),
+ $prefix.'content_encoding' => $c->getContentEncoding(),
$prefix.'headers' => $c->getHeaders(),
+ $prefix.'delivery_mode' => $deliveryMode,
+ $prefix.'priority' => $c->getPriority(),
+ $prefix.'correlation_id' => $c->getCorrelationId(),
+ $prefix.'reply_to' => $c->getReplyTo(),
+ $prefix.'expiration' => $c->getExpiration(),
+ $prefix.'message_id' => $c->getMessageId(),
+ $prefix.'timestamp' => $c->getTimeStamp(),
+ $prefix.'type' => $c->getType(),
+ $prefix.'user_id' => $c->getUserId(),
+ $prefix.'app_id' => $c->getAppId(),
);
return $a;
diff --git a/htdocs/includes/symfony/var-dumper/Caster/ArgsStub.php b/htdocs/includes/symfony/var-dumper/Caster/ArgsStub.php
new file mode 100644
index 00000000000..6675caa0478
--- /dev/null
+++ b/htdocs/includes/symfony/var-dumper/Caster/ArgsStub.php
@@ -0,0 +1,80 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\VarDumper\Caster;
+
+use Symfony\Component\VarDumper\Cloner\Stub;
+
+/**
+ * Represents a list of function arguments.
+ *
+ * @author Nicolas Grekas
+ */
+class ArgsStub extends EnumStub
+{
+ private static $parameters = array();
+
+ public function __construct(array $args, $function, $class)
+ {
+ list($variadic, $params) = self::getParameters($function, $class);
+
+ $values = array();
+ foreach ($args as $k => $v) {
+ $values[$k] = !is_scalar($v) && !$v instanceof Stub ? new CutStub($v) : $v;
+ }
+ if (null === $params) {
+ parent::__construct($values, false);
+
+ return;
+ }
+ if (count($values) < count($params)) {
+ $params = array_slice($params, 0, count($values));
+ } elseif (count($values) > count($params)) {
+ $values[] = new EnumStub(array_splice($values, count($params)), false);
+ $params[] = $variadic;
+ }
+ if (array('...') === $params) {
+ $this->dumpKeys = false;
+ $this->value = $values[0]->value;
+ } else {
+ $this->value = array_combine($params, $values);
+ }
+ }
+
+ private static function getParameters($function, $class)
+ {
+ if (isset(self::$parameters[$k = $class.'::'.$function])) {
+ return self::$parameters[$k];
+ }
+
+ try {
+ $r = null !== $class ? new \ReflectionMethod($class, $function) : new \ReflectionFunction($function);
+ } catch (\ReflectionException $e) {
+ return array(null, null);
+ }
+
+ $variadic = '...';
+ $params = array();
+ foreach ($r->getParameters() as $v) {
+ $k = '$'.$v->name;
+ if ($v->isPassedByReference()) {
+ $k = '&'.$k;
+ }
+ if (method_exists($v, 'isVariadic') && $v->isVariadic()) {
+ $variadic .= $k;
+ } else {
+ $params[] = $k;
+ }
+ }
+
+ return self::$parameters[$k] = array($variadic, $params);
+ }
+}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/Caster.php b/htdocs/includes/symfony/var-dumper/Caster/Caster.php
index 23e72e87701..7c7fe00ece4 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/Caster.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/Caster.php
@@ -11,6 +11,8 @@
namespace Symfony\Component\VarDumper\Caster;
+use Symfony\Component\VarDumper\Cloner\Stub;
+
/**
* Helper for filtering out properties in casters.
*
@@ -36,29 +38,39 @@ class Caster
/**
* Casts objects to arrays and adds the dynamic property prefix.
*
- * @param object $obj The object to cast.
- * @param \ReflectionClass $reflector The class reflector to use for inspecting the object definition.
+ * @param object $obj The object to cast
+ * @param \ReflectionClass $reflector The class reflector to use for inspecting the object definition
*
- * @return array The array-cast of the object, with prefixed dynamic properties.
+ * @return array The array-cast of the object, with prefixed dynamic properties
*/
public static function castObject($obj, \ReflectionClass $reflector)
{
if ($reflector->hasMethod('__debugInfo')) {
$a = $obj->__debugInfo();
+ } elseif ($obj instanceof \Closure) {
+ $a = array();
} else {
$a = (array) $obj;
}
+ if ($obj instanceof \__PHP_Incomplete_Class) {
+ return $a;
+ }
if ($a) {
+ $combine = false;
$p = array_keys($a);
foreach ($p as $i => $k) {
- if (!isset($k[0]) || ("\0" !== $k[0] && !$reflector->hasProperty($k))) {
+ if (isset($k[0]) ? "\0" !== $k[0] && !$reflector->hasProperty($k) : \PHP_VERSION_ID >= 70200) {
+ $combine = true;
$p[$i] = self::PREFIX_DYNAMIC.$k;
} elseif (isset($k[16]) && "\0" === $k[16] && 0 === strpos($k, "\0class@anonymous\0")) {
+ $combine = true;
$p[$i] = "\0".$reflector->getParentClass().'@anonymous'.strrchr($k, "\0");
}
}
- $a = array_combine($p, $a);
+ if ($combine) {
+ $a = array_combine($p, $a);
+ }
}
return $a;
@@ -70,14 +82,17 @@ class Caster
* By default, a single match in the $filter bit field filters properties out, following an "or" logic.
* When EXCLUDE_STRICT is set, an "and" logic is applied: all bits must match for a property to be removed.
*
- * @param array $a The array containing the properties to filter.
- * @param int $filter A bit field of Caster::EXCLUDE_* constants specifying which properties to filter out.
- * @param string[] $listedProperties List of properties to exclude when Caster::EXCLUDE_VERBOSE is set, and to preserve when Caster::EXCLUDE_NOT_IMPORTANT is set.
+ * @param array $a The array containing the properties to filter
+ * @param int $filter A bit field of Caster::EXCLUDE_* constants specifying which properties to filter out
+ * @param string[] $listedProperties List of properties to exclude when Caster::EXCLUDE_VERBOSE is set, and to preserve when Caster::EXCLUDE_NOT_IMPORTANT is set
+ * @param int &$count Set to the number of removed properties
*
* @return array The filtered array
*/
- public static function filter(array $a, $filter, array $listedProperties = array())
+ public static function filter(array $a, $filter, array $listedProperties = array(), &$count = 0)
{
+ $count = 0;
+
foreach ($a as $k => $v) {
$type = self::EXCLUDE_STRICT & $filter;
@@ -108,9 +123,20 @@ class Caster
if ((self::EXCLUDE_STRICT & $filter) ? $type === $filter : $type) {
unset($a[$k]);
+ ++$count;
}
}
return $a;
}
+
+ public static function castPhpIncompleteClass(\__PHP_Incomplete_Class $c, array $a, Stub $stub, $isNested)
+ {
+ if (isset($a['__PHP_Incomplete_Class_Name'])) {
+ $stub->class .= '('.$a['__PHP_Incomplete_Class_Name'].')';
+ unset($a['__PHP_Incomplete_Class_Name']);
+ }
+
+ return $a;
+ }
}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/ClassStub.php b/htdocs/includes/symfony/var-dumper/Caster/ClassStub.php
new file mode 100644
index 00000000000..59efecda9eb
--- /dev/null
+++ b/htdocs/includes/symfony/var-dumper/Caster/ClassStub.php
@@ -0,0 +1,87 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\VarDumper\Caster;
+
+/**
+ * Represents a PHP class identifier.
+ *
+ * @author Nicolas Grekas
+ */
+class ClassStub extends ConstStub
+{
+ /**
+ * Constructor.
+ *
+ * @param string A PHP identifier, e.g. a class, method, interface, etc. name
+ * @param callable The callable targeted by the identifier when it is ambiguous or not a real PHP identifier
+ */
+ public function __construct($identifier, $callable = null)
+ {
+ $this->value = $identifier;
+
+ if (0 < $i = strrpos($identifier, '\\')) {
+ $this->attr['ellipsis'] = strlen($identifier) - $i;
+ }
+
+ try {
+ if (null !== $callable) {
+ if ($callable instanceof \Closure) {
+ $r = new \ReflectionFunction($callable);
+ } elseif (is_object($callable)) {
+ $r = array($callable, '__invoke');
+ } elseif (is_array($callable)) {
+ $r = $callable;
+ } elseif (false !== $i = strpos($callable, '::')) {
+ $r = array(substr($callable, 0, $i), substr($callable, 2 + $i));
+ } else {
+ $r = new \ReflectionFunction($callable);
+ }
+ } elseif (false !== $i = strpos($identifier, '::')) {
+ $r = array(substr($identifier, 0, $i), substr($identifier, 2 + $i));
+ } else {
+ $r = new \ReflectionClass($identifier);
+ }
+
+ if (is_array($r)) {
+ try {
+ $r = new \ReflectionMethod($r[0], $r[1]);
+ } catch (\ReflectionException $e) {
+ $r = new \ReflectionClass($r[0]);
+ }
+ }
+ } catch (\ReflectionException $e) {
+ return;
+ }
+
+ if ($f = $r->getFileName()) {
+ $this->attr['file'] = $f;
+ $this->attr['line'] = $r->getStartLine();
+ }
+ }
+
+ public static function wrapCallable($callable)
+ {
+ if (is_object($callable) || !is_callable($callable)) {
+ return $callable;
+ }
+
+ if (!is_array($callable)) {
+ $callable = new static($callable);
+ } elseif (is_string($callable[0])) {
+ $callable[0] = new static($callable[0]);
+ } else {
+ $callable[1] = new static($callable[1], $callable);
+ }
+
+ return $callable;
+ }
+}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/ConstStub.php b/htdocs/includes/symfony/var-dumper/Caster/ConstStub.php
index f20e03cdf0d..26c0010b66a 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/ConstStub.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/ConstStub.php
@@ -25,4 +25,9 @@ class ConstStub extends Stub
$this->class = $name;
$this->value = $value;
}
+
+ public function __toString()
+ {
+ return (string) $this->value;
+ }
}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/CutStub.php b/htdocs/includes/symfony/var-dumper/Caster/CutStub.php
index 8781f5cf3c6..61140eb361d 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/CutStub.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/CutStub.php
@@ -39,9 +39,12 @@ class CutStub extends Stub
case 'resource':
case 'unknown type':
+ case 'resource (closed)':
$this->type = self::TYPE_RESOURCE;
$this->handle = (int) $value;
- $this->class = @get_resource_type($value);
+ if ('Unknown' === $this->class = @get_resource_type($value)) {
+ $this->class = 'Closed';
+ }
$this->cut = -1;
break;
diff --git a/htdocs/includes/symfony/var-dumper/Caster/DOMCaster.php b/htdocs/includes/symfony/var-dumper/Caster/DOMCaster.php
index e04cf9534b3..3a99865370c 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/DOMCaster.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/DOMCaster.php
@@ -107,7 +107,7 @@ class DOMCaster
'namespaceURI' => $dom->namespaceURI,
'prefix' => $dom->prefix,
'localName' => $dom->localName,
- 'baseURI' => $dom->baseURI,
+ 'baseURI' => $dom->baseURI ? new LinkStub($dom->baseURI) : $dom->baseURI,
'textContent' => new CutStub($dom->textContent),
);
@@ -144,7 +144,7 @@ class DOMCaster
'version' => $dom->version,
'xmlVersion' => $dom->xmlVersion,
'strictErrorChecking' => $dom->strictErrorChecking,
- 'documentURI' => $dom->documentURI,
+ 'documentURI' => $dom->documentURI ? new LinkStub($dom->documentURI) : $dom->documentURI,
'config' => $dom->config,
'formatOutput' => $dom->formatOutput,
'validateOnParse' => $dom->validateOnParse,
@@ -237,7 +237,7 @@ class DOMCaster
'columnNumber' => $dom->columnNumber,
'offset' => $dom->offset,
'relatedNode' => $dom->relatedNode,
- 'uri' => $dom->uri,
+ 'uri' => $dom->uri ? new LinkStub($dom->uri, $dom->lineNumber) : $dom->uri,
);
return $a;
diff --git a/htdocs/includes/symfony/var-dumper/Caster/EnumStub.php b/htdocs/includes/symfony/var-dumper/Caster/EnumStub.php
index 67bb2e16390..3cee23eac20 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/EnumStub.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/EnumStub.php
@@ -20,8 +20,11 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*/
class EnumStub extends Stub
{
- public function __construct(array $values)
+ public $dumpKeys = true;
+
+ public function __construct(array $values, $dumpKeys = true)
{
$this->value = $values;
+ $this->dumpKeys = $dumpKeys;
}
}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/ExceptionCaster.php b/htdocs/includes/symfony/var-dumper/Caster/ExceptionCaster.php
index a5a8773e859..8c84137e646 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/ExceptionCaster.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/ExceptionCaster.php
@@ -41,6 +41,8 @@ class ExceptionCaster
E_STRICT => 'E_STRICT',
);
+ private static $framesCache = array();
+
public static function castError(\Error $e, array $a, Stub $stub, $isNested, $filter = 0)
{
return self::filterExceptionArray($stub->class, $a, "\0Error\0", $filter);
@@ -65,13 +67,9 @@ class ExceptionCaster
$prefix = Caster::PREFIX_PROTECTED;
$xPrefix = "\0Exception\0";
- if (isset($a[$xPrefix.'previous'], $a[$xPrefix.'trace'])) {
+ if (isset($a[$xPrefix.'previous'], $a[$xPrefix.'trace']) && $a[$xPrefix.'previous'] instanceof \Exception) {
$b = (array) $a[$xPrefix.'previous'];
- array_unshift($b[$xPrefix.'trace'], array(
- 'function' => 'new '.get_class($a[$xPrefix.'previous']),
- 'file' => $b[$prefix.'file'],
- 'line' => $b[$prefix.'line'],
- ));
+ self::traceUnshift($b[$xPrefix.'trace'], get_class($a[$xPrefix.'previous']), $b[$prefix.'file'], $b[$prefix.'line']);
$a[$xPrefix.'trace'] = new TraceStub($b[$xPrefix.'trace'], false, 0, -1 - count($a[$xPrefix.'trace']->value));
}
@@ -88,6 +86,7 @@ class ExceptionCaster
$stub->class = '';
$stub->handle = 0;
$frames = $trace->value;
+ $prefix = Caster::PREFIX_VIRTUAL;
$a = array();
$j = count($frames);
@@ -97,34 +96,38 @@ class ExceptionCaster
if (!isset($trace->value[$i])) {
return array();
}
- $lastCall = isset($frames[$i]['function']) ? ' ==> '.(isset($frames[$i]['class']) ? $frames[0]['class'].$frames[$i]['type'] : '').$frames[$i]['function'].'()' : '';
+ $lastCall = isset($frames[$i]['function']) ? (isset($frames[$i]['class']) ? $frames[0]['class'].$frames[$i]['type'] : '').$frames[$i]['function'].'()' : '';
+ $frames[] = array('function' => '');
for ($j += $trace->numberingOffset - $i++; isset($frames[$i]); ++$i, --$j) {
- $call = isset($frames[$i]['function']) ? (isset($frames[$i]['class']) ? $frames[$i]['class'].$frames[$i]['type'] : '').$frames[$i]['function'].'()' : '???';
+ $f = $frames[$i];
+ $call = isset($f['function']) ? (isset($f['class']) ? $f['class'].$f['type'] : '').$f['function'].'()' : '???';
- $a[Caster::PREFIX_VIRTUAL.$j.'. '.$call.$lastCall] = new FrameStub(
+ $label = substr_replace($prefix, "title=Stack level $j.", 2, 0).$lastCall;
+ $frame = new FrameStub(
array(
- 'object' => isset($frames[$i]['object']) ? $frames[$i]['object'] : null,
- 'class' => isset($frames[$i]['class']) ? $frames[$i]['class'] : null,
- 'type' => isset($frames[$i]['type']) ? $frames[$i]['type'] : null,
- 'function' => isset($frames[$i]['function']) ? $frames[$i]['function'] : null,
+ 'object' => isset($f['object']) ? $f['object'] : null,
+ 'class' => isset($f['class']) ? $f['class'] : null,
+ 'type' => isset($f['type']) ? $f['type'] : null,
+ 'function' => isset($f['function']) ? $f['function'] : null,
) + $frames[$i - 1],
- $trace->keepArgs,
+ false,
true
);
+ $f = self::castFrameStub($frame, array(), $frame, true);
+ if (isset($f[$prefix.'src'])) {
+ foreach ($f[$prefix.'src']->value as $label => $frame) {
+ $label = substr_replace($label, "title=Stack level $j.&", 2, 0);
+ }
+ $f = $frames[$i - 1];
+ if ($trace->keepArgs && !empty($f['args']) && $frame instanceof EnumStub) {
+ $frame->value['arguments'] = new ArgsStub($f['args'], isset($f['function']) ? $f['function'] : null, isset($f['class']) ? $f['class'] : null);
+ }
+ }
+ $a[$label] = $frame;
- $lastCall = ' ==> '.$call;
+ $lastCall = $call;
}
- $a[Caster::PREFIX_VIRTUAL.$j.'. {main}'.$lastCall] = new FrameStub(
- array(
- 'object' => null,
- 'class' => null,
- 'type' => null,
- 'function' => '{main}',
- ) + $frames[$i - 1],
- $trace->keepArgs,
- true
- );
if (null !== $trace->sliceLength) {
$a = array_slice($a, 0, $trace->sliceLength, true);
}
@@ -141,30 +144,52 @@ class ExceptionCaster
$prefix = Caster::PREFIX_VIRTUAL;
if (isset($f['file'], $f['line'])) {
- if (preg_match('/\((\d+)\)(?:\([\da-f]{32}\))? : (?:eval\(\)\'d code|runtime-created function)$/', $f['file'], $match)) {
- $f['file'] = substr($f['file'], 0, -strlen($match[0]));
- $f['line'] = (int) $match[1];
- }
- if (file_exists($f['file']) && 0 <= self::$srcContext) {
- $src[$f['file'].':'.$f['line']] = self::extractSource(explode("\n", file_get_contents($f['file'])), $f['line'], self::$srcContext);
+ $cacheKey = $f;
+ unset($cacheKey['object'], $cacheKey['args']);
+ $cacheKey[] = self::$srcContext;
+ $cacheKey = implode('-', $cacheKey);
- if (!empty($f['class']) && is_subclass_of($f['class'], 'Twig_Template') && method_exists($f['class'], 'getDebugInfo')) {
- $template = isset($f['object']) ? $f['object'] : new $f['class'](new \Twig_Environment(new \Twig_Loader_Filesystem()));
+ if (isset(self::$framesCache[$cacheKey])) {
+ $a[$prefix.'src'] = self::$framesCache[$cacheKey];
+ } else {
+ if (preg_match('/\((\d+)\)(?:\([\da-f]{32}\))? : (?:eval\(\)\'d code|runtime-created function)$/', $f['file'], $match)) {
+ $f['file'] = substr($f['file'], 0, -strlen($match[0]));
+ $f['line'] = (int) $match[1];
+ }
+ $caller = isset($f['function']) ? sprintf('in %s() on line %d', (isset($f['class']) ? $f['class'].$f['type'] : '').$f['function'], $f['line']) : null;
+ $src = $f['line'];
+ $srcKey = $f['file'];
+ $ellipsis = explode(DIRECTORY_SEPARATOR, $srcKey);
+ $ellipsis = 3 < count($ellipsis) ? 2 + strlen(implode(array_slice($ellipsis, -2))) : 0;
- try {
- $templateName = $template->getTemplateName();
- $templateSrc = explode("\n", method_exists($template, 'getSource') ? $template->getSource() : $template->getEnvironment()->getLoader()->getSource($templateName));
+ if (file_exists($f['file']) && 0 <= self::$srcContext) {
+ if (!empty($f['class']) && (is_subclass_of($f['class'], 'Twig\Template') || is_subclass_of($f['class'], 'Twig_Template')) && method_exists($f['class'], 'getDebugInfo')) {
+ $template = isset($f['object']) ? $f['object'] : unserialize(sprintf('O:%d:"%s":0:{}', strlen($f['class']), $f['class']));
+
+ $ellipsis = 0;
+ $templateSrc = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getCode() : (method_exists($template, 'getSource') ? $template->getSource() : '');
$templateInfo = $template->getDebugInfo();
if (isset($templateInfo[$f['line']])) {
- $src[$templateName.':'.$templateInfo[$f['line']]] = self::extractSource($templateSrc, $templateInfo[$f['line']], self::$srcContext);
+ if (!method_exists($template, 'getSourceContext') || !file_exists($templatePath = $template->getSourceContext()->getPath())) {
+ $templatePath = null;
+ }
+ if ($templateSrc) {
+ $src = self::extractSource($templateSrc, $templateInfo[$f['line']], self::$srcContext, $caller, 'twig', $templatePath);
+ $srcKey = ($templatePath ?: $template->getTemplateName()).':'.$templateInfo[$f['line']];
+ }
+ }
+ }
+ if ($srcKey == $f['file']) {
+ $src = self::extractSource(file_get_contents($f['file']), $f['line'], self::$srcContext, $caller, 'php', $f['file']);
+ $srcKey .= ':'.$f['line'];
+ if ($ellipsis) {
+ $ellipsis += 1 + strlen($f['line']);
}
- } catch (\Twig_Error_Loader $e) {
}
}
- } else {
- $src[$f['file']] = $f['line'];
+ $srcAttr = $ellipsis ? 'ellipsis='.$ellipsis : '';
+ self::$framesCache[$cacheKey] = $a[$prefix.'src'] = new EnumStub(array("\0~$srcAttr\0$srcKey" => $src));
}
- $a[$prefix.'src'] = new EnumStub($src);
}
unset($a[$prefix.'args'], $a[$prefix.'line'], $a[$prefix.'file']);
@@ -176,8 +201,8 @@ class ExceptionCaster
unset($a[$k]);
}
}
- if ($frame->keepArgs && isset($f['args'])) {
- $a[$prefix.'args'] = $f['args'];
+ if ($frame->keepArgs && !empty($f['args'])) {
+ $a[$prefix.'arguments'] = new ArgsStub($f['args'], $f['function'], $f['class']);
}
return $a;
@@ -193,46 +218,81 @@ class ExceptionCaster
}
if (!($filter & Caster::EXCLUDE_VERBOSE)) {
- array_unshift($trace, array(
- 'function' => $xClass ? 'new '.$xClass : null,
- 'file' => $a[Caster::PREFIX_PROTECTED.'file'],
- 'line' => $a[Caster::PREFIX_PROTECTED.'line'],
- ));
- $a[$xPrefix.'trace'] = new TraceStub($trace);
+ if (isset($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line'])) {
+ self::traceUnshift($trace, $xClass, $a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line']);
+ }
+ $a[$xPrefix.'trace'] = new TraceStub($trace, self::$traceArgs);
}
if (empty($a[$xPrefix.'previous'])) {
unset($a[$xPrefix.'previous']);
}
unset($a[$xPrefix.'string'], $a[Caster::PREFIX_DYNAMIC.'xdebug_message'], $a[Caster::PREFIX_DYNAMIC.'__destructorException']);
+ if (isset($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line'])) {
+ $a[Caster::PREFIX_PROTECTED.'file'] = new LinkStub($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line']);
+ }
+
return $a;
}
- private static function extractSource(array $srcArray, $line, $srcContext)
+ private static function traceUnshift(&$trace, $class, $file, $line)
{
+ if (isset($trace[0]['file'], $trace[0]['line']) && $trace[0]['file'] === $file && $trace[0]['line'] === $line) {
+ return;
+ }
+ array_unshift($trace, array(
+ 'function' => $class ? 'new '.$class : null,
+ 'file' => $file,
+ 'line' => $line,
+ ));
+ }
+
+ private static function extractSource($srcLines, $line, $srcContext, $title, $lang, $file = null)
+ {
+ $srcLines = explode("\n", $srcLines);
$src = array();
for ($i = $line - 1 - $srcContext; $i <= $line - 1 + $srcContext; ++$i) {
- $src[] = (isset($srcArray[$i]) ? $srcArray[$i] : '')."\n";
+ $src[] = (isset($srcLines[$i]) ? $srcLines[$i] : '')."\n";
}
+ $srcLines = array();
$ltrim = 0;
- while (' ' === $src[0][$ltrim] || "\t" === $src[0][$ltrim]) {
- $i = $srcContext << 1;
- while ($i > 0 && $src[0][$ltrim] === $src[$i][$ltrim]) {
- --$i;
- }
- if ($i) {
- break;
+ do {
+ $pad = null;
+ for ($i = $srcContext << 1; $i >= 0; --$i) {
+ if (isset($src[$i][$ltrim]) && "\r" !== ($c = $src[$i][$ltrim]) && "\n" !== $c) {
+ if (null === $pad) {
+ $pad = $c;
+ }
+ if ((' ' !== $c && "\t" !== $c) || $pad !== $c) {
+ break;
+ }
+ }
}
++$ltrim;
- }
- if ($ltrim) {
- foreach ($src as $i => $line) {
- $src[$i] = substr($line, $ltrim);
+ } while (0 > $i && null !== $pad);
+
+ --$ltrim;
+
+ foreach ($src as $i => $c) {
+ if ($ltrim) {
+ $c = isset($c[$ltrim]) && "\r" !== $c[$ltrim] ? substr($c, $ltrim) : ltrim($c, " \t");
}
+ $c = substr($c, 0, -1);
+ if ($i !== $srcContext) {
+ $c = new ConstStub('default', $c);
+ } else {
+ $c = new ConstStub($c, $title);
+ if (null !== $file) {
+ $c->attr['file'] = $file;
+ $c->attr['line'] = $line;
+ }
+ }
+ $c->attr['lang'] = $lang;
+ $srcLines[sprintf("\0~%d\0", $i + $line - $srcContext)] = $c;
}
- return implode('', $src);
+ return new EnumStub($srcLines);
}
}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/LinkStub.php b/htdocs/includes/symfony/var-dumper/Caster/LinkStub.php
new file mode 100644
index 00000000000..ea39c5b08ee
--- /dev/null
+++ b/htdocs/includes/symfony/var-dumper/Caster/LinkStub.php
@@ -0,0 +1,51 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\VarDumper\Caster;
+
+/**
+ * Represents a file or a URL.
+ *
+ * @author Nicolas Grekas
+ */
+class LinkStub extends ConstStub
+{
+ public function __construct($label, $line = 0, $href = null)
+ {
+ $this->value = $label;
+
+ if (null === $href) {
+ $href = $label;
+ }
+ if (is_string($href)) {
+ if (0 === strpos($href, 'file://')) {
+ if ($href === $label) {
+ $label = substr($label, 7);
+ }
+ $href = substr($href, 7);
+ } elseif (false !== strpos($href, '://')) {
+ $this->attr['href'] = $href;
+
+ return;
+ }
+ if (file_exists($href)) {
+ if ($line) {
+ $this->attr['line'] = $line;
+ }
+ $this->attr['file'] = realpath($href) ?: $href;
+
+ if ($this->attr['file'] === $label && 3 < count($ellipsis = explode(DIRECTORY_SEPARATOR, $href))) {
+ $this->attr['ellipsis'] = 2 + strlen(implode(array_slice($ellipsis, -2)));
+ }
+ }
+ }
+ }
+}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/PdoCaster.php b/htdocs/includes/symfony/var-dumper/Caster/PdoCaster.php
index e60b9275fd8..b8667824773 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/PdoCaster.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/PdoCaster.php
@@ -77,6 +77,12 @@ class PdoCaster
} catch (\Exception $e) {
}
}
+ if (isset($attr[$k = 'STATEMENT_CLASS'][1])) {
+ if ($attr[$k][1]) {
+ $attr[$k][1] = new ArgsStub($attr[$k][1], '__construct', $attr[$k][0]);
+ }
+ $attr[$k][0] = new ClassStub($attr[$k][0]);
+ }
$prefix = Caster::PREFIX_VIRTUAL;
$a += array(
diff --git a/htdocs/includes/symfony/var-dumper/Caster/RedisCaster.php b/htdocs/includes/symfony/var-dumper/Caster/RedisCaster.php
new file mode 100644
index 00000000000..07a3a1b0911
--- /dev/null
+++ b/htdocs/includes/symfony/var-dumper/Caster/RedisCaster.php
@@ -0,0 +1,77 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\VarDumper\Caster;
+
+use Symfony\Component\VarDumper\Cloner\Stub;
+
+/**
+ * Casts Redis class from ext-redis to array representation.
+ *
+ * @author Nicolas Grekas
+ */
+class RedisCaster
+{
+ private static $serializer = array(
+ \Redis::SERIALIZER_NONE => 'NONE',
+ \Redis::SERIALIZER_PHP => 'PHP',
+ 2 => 'IGBINARY', // Optional Redis::SERIALIZER_IGBINARY
+ );
+
+ public static function castRedis(\Redis $c, array $a, Stub $stub, $isNested)
+ {
+ $prefix = Caster::PREFIX_VIRTUAL;
+
+ if (defined('HHVM_VERSION_ID')) {
+ if (isset($a[Caster::PREFIX_PROTECTED.'serializer'])) {
+ $ser = $a[Caster::PREFIX_PROTECTED.'serializer'];
+ $a[Caster::PREFIX_PROTECTED.'serializer'] = isset(self::$serializer[$ser]) ? new ConstStub(self::$serializer[$ser], $ser) : $ser;
+ }
+
+ return $a;
+ }
+
+ if (!$connected = $c->isConnected()) {
+ return $a + array(
+ $prefix.'isConnected' => $connected,
+ );
+ }
+
+ $ser = $c->getOption(\Redis::OPT_SERIALIZER);
+ $retry = defined('Redis::OPT_SCAN') ? $c->getOption(\Redis::OPT_SCAN) : 0;
+
+ return $a + array(
+ $prefix.'isConnected' => $connected,
+ $prefix.'host' => $c->getHost(),
+ $prefix.'port' => $c->getPort(),
+ $prefix.'auth' => $c->getAuth(),
+ $prefix.'dbNum' => $c->getDbNum(),
+ $prefix.'timeout' => $c->getTimeout(),
+ $prefix.'persistentId' => $c->getPersistentID(),
+ $prefix.'options' => new EnumStub(array(
+ 'READ_TIMEOUT' => $c->getOption(\Redis::OPT_READ_TIMEOUT),
+ 'SERIALIZER' => isset(self::$serializer[$ser]) ? new ConstStub(self::$serializer[$ser], $ser) : $ser,
+ 'PREFIX' => $c->getOption(\Redis::OPT_PREFIX),
+ 'SCAN' => new ConstStub($retry ? 'RETRY' : 'NORETRY', $retry),
+ )),
+ );
+ }
+
+ public static function castRedisArray(\RedisArray $c, array $a, Stub $stub, $isNested)
+ {
+ $prefix = Caster::PREFIX_VIRTUAL;
+
+ return $a + array(
+ $prefix.'hosts' => $c->_hosts(),
+ $prefix.'function' => ClassStub::wrapCallable($c->_function()),
+ );
+ }
+}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/ReflectionCaster.php b/htdocs/includes/symfony/var-dumper/Caster/ReflectionCaster.php
index 936e11982ee..dcb5a2f29ca 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/ReflectionCaster.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/ReflectionCaster.php
@@ -53,19 +53,32 @@ class ReflectionCaster
}
if ($f = $c->getFileName()) {
- $a[$prefix.'file'] = $f;
+ $a[$prefix.'file'] = new LinkStub($f, $c->getStartLine());
$a[$prefix.'line'] = $c->getStartLine().' to '.$c->getEndLine();
}
$prefix = Caster::PREFIX_DYNAMIC;
- unset($a['name'], $a[$prefix.'0'], $a[$prefix.'this'], $a[$prefix.'parameter'], $a[Caster::PREFIX_VIRTUAL.'extra']);
+ unset($a['name'], $a[$prefix.'this'], $a[$prefix.'parameter'], $a[Caster::PREFIX_VIRTUAL.'extra']);
return $a;
}
public static function castGenerator(\Generator $c, array $a, Stub $stub, $isNested)
{
- return class_exists('ReflectionGenerator', false) ? self::castReflectionGenerator(new \ReflectionGenerator($c), $a, $stub, $isNested) : $a;
+ if (!class_exists('ReflectionGenerator', false)) {
+ return $a;
+ }
+
+ // Cannot create ReflectionGenerator based on a terminated Generator
+ try {
+ $reflectionGenerator = new \ReflectionGenerator($c);
+ } catch (\Exception $e) {
+ $a[Caster::PREFIX_VIRTUAL.'closed'] = true;
+
+ return $a;
+ }
+
+ return self::castReflectionGenerator($reflectionGenerator, $a, $stub, $isNested);
}
public static function castType(\ReflectionType $c, array $a, Stub $stub, $isNested)
@@ -73,7 +86,7 @@ class ReflectionCaster
$prefix = Caster::PREFIX_VIRTUAL;
$a += array(
- $prefix.'type' => $c->__toString(),
+ $prefix.'name' => $c instanceof \ReflectionNamedType ? $c->getName() : $c->__toString(),
$prefix.'allowsNull' => $c->allowsNull(),
$prefix.'isBuiltin' => $c->isBuiltin(),
);
@@ -88,31 +101,33 @@ class ReflectionCaster
if ($c->getThis()) {
$a[$prefix.'this'] = new CutStub($c->getThis());
}
- $x = $c->getFunction();
+ $function = $c->getFunction();
$frame = array(
- 'class' => isset($x->class) ? $x->class : null,
- 'type' => isset($x->class) ? ($x->isStatic() ? '::' : '->') : null,
- 'function' => $x->name,
+ 'class' => isset($function->class) ? $function->class : null,
+ 'type' => isset($function->class) ? ($function->isStatic() ? '::' : '->') : null,
+ 'function' => $function->name,
'file' => $c->getExecutingFile(),
'line' => $c->getExecutingLine(),
);
if ($trace = $c->getTrace(DEBUG_BACKTRACE_IGNORE_ARGS)) {
- $x = new \ReflectionGenerator($c->getExecutingGenerator());
+ $function = new \ReflectionGenerator($c->getExecutingGenerator());
array_unshift($trace, array(
'function' => 'yield',
- 'file' => $x->getExecutingFile(),
- 'line' => $x->getExecutingLine() - 1,
+ 'file' => $function->getExecutingFile(),
+ 'line' => $function->getExecutingLine() - 1,
));
$trace[] = $frame;
$a[$prefix.'trace'] = new TraceStub($trace, false, 0, -1, -1);
} else {
- $x = new FrameStub($frame, false, true);
- $x = ExceptionCaster::castFrameStub($x, array(), $x, true);
+ $function = new FrameStub($frame, false, true);
+ $function = ExceptionCaster::castFrameStub($function, array(), $function, true);
$a[$prefix.'executing'] = new EnumStub(array(
- $frame['class'].$frame['type'].$frame['function'].'()' => $x[$prefix.'src'],
+ $frame['class'].$frame['type'].$frame['function'].'()' => $function[$prefix.'src'],
));
}
+ $a[Caster::PREFIX_VIRTUAL.'closed'] = false;
+
return $a;
}
@@ -157,7 +172,12 @@ class ReflectionCaster
));
if (isset($a[$prefix.'returnType'])) {
- $a[$prefix.'returnType'] = (string) $a[$prefix.'returnType'];
+ $v = $a[$prefix.'returnType'];
+ $v = $v instanceof \ReflectionNamedType ? $v->getName() : $v->__toString();
+ $a[$prefix.'returnType'] = new ClassStub($a[$prefix.'returnType']->allowsNull() ? '?'.$v : $v, array(class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', ''));
+ }
+ if (isset($a[$prefix.'class'])) {
+ $a[$prefix.'class'] = new ClassStub($a[$prefix.'class']);
}
if (isset($a[$prefix.'this'])) {
$a[$prefix.'this'] = new CutStub($a[$prefix.'this']);
@@ -165,12 +185,12 @@ class ReflectionCaster
foreach ($c->getParameters() as $v) {
$k = '$'.$v->name;
- if ($v->isPassedByReference()) {
- $k = '&'.$k;
- }
if (method_exists($v, 'isVariadic') && $v->isVariadic()) {
$k = '...'.$k;
}
+ if ($v->isPassedByReference()) {
+ $k = '&'.$k;
+ }
$a[$prefix.'parameters'][$k] = $v;
}
if (isset($a[$prefix.'parameters'])) {
@@ -213,24 +233,22 @@ class ReflectionCaster
'position' => 'getPosition',
'isVariadic' => 'isVariadic',
'byReference' => 'isPassedByReference',
+ 'allowsNull' => 'allowsNull',
));
- try {
- if (method_exists($c, 'hasType')) {
- if ($c->hasType()) {
- $a[$prefix.'typeHint'] = $c->getType()->__toString();
- }
- } elseif ($c->isArray()) {
- $a[$prefix.'typeHint'] = 'array';
- } elseif (method_exists($c, 'isCallable') && $c->isCallable()) {
- $a[$prefix.'typeHint'] = 'callable';
- } elseif ($v = $c->getClass()) {
- $a[$prefix.'typeHint'] = $v->name;
- }
- } catch (\ReflectionException $e) {
- if (preg_match('/^Class ([^ ]++) does not exist$/', $e->getMessage(), $m)) {
- $a[$prefix.'typeHint'] = $m[1];
+ if (method_exists($c, 'getType')) {
+ if ($v = $c->getType()) {
+ $a[$prefix.'typeHint'] = $v instanceof \ReflectionNamedType ? $v->getName() : $v->__toString();
}
+ } elseif (preg_match('/^(?:[^ ]++ ){4}([a-zA-Z_\x7F-\xFF][^ ]++)/', $c, $v)) {
+ $a[$prefix.'typeHint'] = $v[1];
+ }
+
+ if (isset($a[$prefix.'typeHint'])) {
+ $v = $a[$prefix.'typeHint'];
+ $a[$prefix.'typeHint'] = new ClassStub($v, array(class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', ''));
+ } else {
+ unset($a[$prefix.'allowsNull']);
}
try {
@@ -238,9 +256,13 @@ class ReflectionCaster
if (method_exists($c, 'isDefaultValueConstant') && $c->isDefaultValueConstant()) {
$a[$prefix.'default'] = new ConstStub($c->getDefaultValueConstantName(), $v);
}
+ if (null === $v) {
+ unset($a[$prefix.'allowsNull']);
+ }
} catch (\ReflectionException $e) {
- if (isset($a[$prefix.'typeHint']) && $c->allowsNull()) {
+ if (isset($a[$prefix.'typeHint']) && $c->allowsNull() && !class_exists('ReflectionNamedType', false)) {
$a[$prefix.'default'] = null;
+ unset($a[$prefix.'allowsNull']);
}
}
@@ -288,7 +310,7 @@ class ReflectionCaster
$x = isset($a[Caster::PREFIX_VIRTUAL.'extra']) ? $a[Caster::PREFIX_VIRTUAL.'extra']->value : array();
if (method_exists($c, 'getFileName') && $m = $c->getFileName()) {
- $x['file'] = $m;
+ $x['file'] = new LinkStub($m, $c->getStartLine());
$x['line'] = $c->getStartLine().' to '.$c->getEndLine();
}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/ResourceCaster.php b/htdocs/includes/symfony/var-dumper/Caster/ResourceCaster.php
index 903641f69c6..3cdb27c3087 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/ResourceCaster.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/ResourceCaster.php
@@ -40,12 +40,17 @@ class ResourceCaster
public static function castStream($stream, array $a, Stub $stub, $isNested)
{
- return stream_get_meta_data($stream) + static::castStreamContext($stream, $a, $stub, $isNested);
+ $a = stream_get_meta_data($stream) + static::castStreamContext($stream, $a, $stub, $isNested);
+ if (isset($a['uri'])) {
+ $a['uri'] = new LinkStub($a['uri']);
+ }
+
+ return $a;
}
public static function castStreamContext($stream, array $a, Stub $stub, $isNested)
{
- return stream_context_get_params($stream);
+ return @stream_context_get_params($stream) ?: $a;
}
public static function castGd($gd, array $a, Stub $stub, $isNested)
diff --git a/htdocs/includes/symfony/var-dumper/Caster/SplCaster.php b/htdocs/includes/symfony/var-dumper/Caster/SplCaster.php
index 97f21463821..4f23efa52d2 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/SplCaster.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/SplCaster.php
@@ -36,7 +36,7 @@ class SplCaster
$b = array(
$prefix.'flag::STD_PROP_LIST' => (bool) ($flags & \ArrayObject::STD_PROP_LIST),
$prefix.'flag::ARRAY_AS_PROPS' => (bool) ($flags & \ArrayObject::ARRAY_AS_PROPS),
- $prefix.'iteratorClass' => $c->getIteratorClass(),
+ $prefix.'iteratorClass' => new ClassStub($c->getIteratorClass()),
$prefix.'storage' => $c->getArrayCopy(),
);
@@ -71,7 +71,7 @@ class SplCaster
$c->setIteratorMode(\SplDoublyLinkedList::IT_MODE_KEEP | $mode & ~\SplDoublyLinkedList::IT_MODE_DELETE);
$a += array(
- $prefix.'mode' => new ConstStub((($mode & \SplDoublyLinkedList::IT_MODE_LIFO) ? 'IT_MODE_LIFO' : 'IT_MODE_FIFO').' | '.(($mode & \SplDoublyLinkedList::IT_MODE_KEEP) ? 'IT_MODE_KEEP' : 'IT_MODE_DELETE'), $mode),
+ $prefix.'mode' => new ConstStub((($mode & \SplDoublyLinkedList::IT_MODE_LIFO) ? 'IT_MODE_LIFO' : 'IT_MODE_FIFO').' | '.(($mode & \SplDoublyLinkedList::IT_MODE_DELETE) ? 'IT_MODE_DELETE' : 'IT_MODE_KEEP'), $mode),
$prefix.'dllist' => iterator_to_array($c),
);
$c->setIteratorMode($mode);
@@ -115,6 +115,10 @@ class SplCaster
}
}
+ if (isset($a[$prefix.'realPath'])) {
+ $a[$prefix.'realPath'] = new LinkStub($a[$prefix.'realPath']);
+ }
+
if (isset($a[$prefix.'perms'])) {
$a[$prefix.'perms'] = new ConstStub(sprintf('0%o', $a[$prefix.'perms']), $a[$prefix.'perms']);
}
@@ -180,7 +184,7 @@ class SplCaster
$storage = array();
unset($a[Caster::PREFIX_DYNAMIC."\0gcdata"]); // Don't hit https://bugs.php.net/65967
- foreach ($c as $obj) {
+ foreach (clone $c as $obj) {
$storage[spl_object_hash($obj)] = array(
'object' => $obj,
'info' => $c->getInfo(),
diff --git a/htdocs/includes/symfony/var-dumper/Caster/StubCaster.php b/htdocs/includes/symfony/var-dumper/Caster/StubCaster.php
index ebad5ba9844..2ec096c5a8c 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/StubCaster.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/StubCaster.php
@@ -28,9 +28,17 @@ class StubCaster
$stub->value = $c->value;
$stub->handle = $c->handle;
$stub->cut = $c->cut;
+ $stub->attr = $c->attr;
- return array();
+ if (Stub::TYPE_REF === $c->type && !$c->class && is_string($c->value) && !preg_match('//u', $c->value)) {
+ $stub->type = Stub::TYPE_STRING;
+ $stub->class = Stub::STRING_BINARY;
+ }
+
+ $a = array();
}
+
+ return $a;
}
public static function castCutArray(CutArrayStub $c, array $a, Stub $stub, $isNested)
@@ -52,15 +60,17 @@ class StubCaster
public static function castEnum(EnumStub $c, array $a, Stub $stub, $isNested)
{
if ($isNested) {
- $stub->class = '';
+ $stub->class = $c->dumpKeys ? '' : null;
$stub->handle = 0;
$stub->value = null;
+ $stub->cut = $c->cut;
+ $stub->attr = $c->attr;
$a = array();
if ($c->value) {
foreach (array_keys($c->value) as $k) {
- $keys[] = Caster::PREFIX_VIRTUAL.$k;
+ $keys[] = !isset($k[0]) || "\0" !== $k[0] ? Caster::PREFIX_VIRTUAL.$k : $k;
}
// Preserve references with array_combine()
$a = array_combine($keys, $c->value);
diff --git a/htdocs/includes/symfony/var-dumper/Caster/XmlReaderCaster.php b/htdocs/includes/symfony/var-dumper/Caster/XmlReaderCaster.php
new file mode 100644
index 00000000000..c371009a17a
--- /dev/null
+++ b/htdocs/includes/symfony/var-dumper/Caster/XmlReaderCaster.php
@@ -0,0 +1,77 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\VarDumper\Caster;
+
+use Symfony\Component\VarDumper\Cloner\Stub;
+
+/**
+ * Casts XmlReader class to array representation.
+ *
+ * @author Baptiste Clavié
+ */
+class XmlReaderCaster
+{
+ private static $nodeTypes = array(
+ \XmlReader::NONE => 'NONE',
+ \XmlReader::ELEMENT => 'ELEMENT',
+ \XmlReader::ATTRIBUTE => 'ATTRIBUTE',
+ \XmlReader::TEXT => 'TEXT',
+ \XmlReader::CDATA => 'CDATA',
+ \XmlReader::ENTITY_REF => 'ENTITY_REF',
+ \XmlReader::ENTITY => 'ENTITY',
+ \XmlReader::PI => 'PI (Processing Instruction)',
+ \XmlReader::COMMENT => 'COMMENT',
+ \XmlReader::DOC => 'DOC',
+ \XmlReader::DOC_TYPE => 'DOC_TYPE',
+ \XmlReader::DOC_FRAGMENT => 'DOC_FRAGMENT',
+ \XmlReader::NOTATION => 'NOTATION',
+ \XmlReader::WHITESPACE => 'WHITESPACE',
+ \XmlReader::SIGNIFICANT_WHITESPACE => 'SIGNIFICANT_WHITESPACE',
+ \XmlReader::END_ELEMENT => 'END_ELEMENT',
+ \XmlReader::END_ENTITY => 'END_ENTITY',
+ \XmlReader::XML_DECLARATION => 'XML_DECLARATION',
+ );
+
+ public static function castXmlReader(\XmlReader $reader, array $a, Stub $stub, $isNested)
+ {
+ $props = Caster::PREFIX_VIRTUAL.'parserProperties';
+ $info = array(
+ 'localName' => $reader->localName,
+ 'prefix' => $reader->prefix,
+ 'nodeType' => new ConstStub(self::$nodeTypes[$reader->nodeType], $reader->nodeType),
+ 'depth' => $reader->depth,
+ 'isDefault' => $reader->isDefault,
+ 'isEmptyElement' => \XmlReader::NONE === $reader->nodeType ? null : $reader->isEmptyElement,
+ 'xmlLang' => $reader->xmlLang,
+ 'attributeCount' => $reader->attributeCount,
+ 'value' => $reader->value,
+ 'namespaceURI' => $reader->namespaceURI,
+ 'baseURI' => $reader->baseURI ? new LinkStub($reader->baseURI) : $reader->baseURI,
+ $props => array(
+ 'LOADDTD' => $reader->getParserProperty(\XmlReader::LOADDTD),
+ 'DEFAULTATTRS' => $reader->getParserProperty(\XmlReader::DEFAULTATTRS),
+ 'VALIDATE' => $reader->getParserProperty(\XmlReader::VALIDATE),
+ 'SUBST_ENTITIES' => $reader->getParserProperty(\XmlReader::SUBST_ENTITIES),
+ ),
+ );
+
+ if ($info[$props] = Caster::filter($info[$props], Caster::EXCLUDE_EMPTY, array(), $count)) {
+ $info[$props] = new EnumStub($info[$props]);
+ $info[$props]->cut = $count;
+ }
+
+ $info = Caster::filter($info, Caster::EXCLUDE_EMPTY, array(), $count);
+ // +2 because hasValue and hasAttributes are always filtered
+ $stub->cut += $count + 2;
+
+ return $a + $info;
+ }
+}
diff --git a/htdocs/includes/symfony/var-dumper/Cloner/AbstractCloner.php b/htdocs/includes/symfony/var-dumper/Cloner/AbstractCloner.php
index 2807ceb935b..437230e24ea 100644
--- a/htdocs/includes/symfony/var-dumper/Cloner/AbstractCloner.php
+++ b/htdocs/includes/symfony/var-dumper/Cloner/AbstractCloner.php
@@ -22,6 +22,8 @@ use Symfony\Component\VarDumper\Exception\ThrowingCasterException;
abstract class AbstractCloner implements ClonerInterface
{
public static $defaultCasters = array(
+ '__PHP_Incomplete_Class' => 'Symfony\Component\VarDumper\Caster\Caster::castPhpIncompleteClass',
+
'Symfony\Component\VarDumper\Caster\CutStub' => 'Symfony\Component\VarDumper\Caster\StubCaster::castStub',
'Symfony\Component\VarDumper\Caster\CutArrayStub' => 'Symfony\Component\VarDumper\Caster\StubCaster::castCutArray',
'Symfony\Component\VarDumper\Caster\ConstStub' => 'Symfony\Component\VarDumper\Caster\StubCaster::castStub',
@@ -67,6 +69,8 @@ abstract class AbstractCloner implements ClonerInterface
'DOMProcessingInstruction' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castProcessingInstruction',
'DOMXPath' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castXPath',
+ 'XmlReader' => 'Symfony\Component\VarDumper\Caster\XmlReaderCaster::castXmlReader',
+
'ErrorException' => 'Symfony\Component\VarDumper\Caster\ExceptionCaster::castErrorException',
'Exception' => 'Symfony\Component\VarDumper\Caster\ExceptionCaster::castException',
'Error' => 'Symfony\Component\VarDumper\Caster\ExceptionCaster::castError',
@@ -100,6 +104,9 @@ abstract class AbstractCloner implements ClonerInterface
'MongoCursorInterface' => 'Symfony\Component\VarDumper\Caster\MongoCaster::castCursor',
+ 'Redis' => 'Symfony\Component\VarDumper\Caster\RedisCaster::castRedis',
+ 'RedisArray' => 'Symfony\Component\VarDumper\Caster\RedisCaster::castRedisArray',
+
':curl' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castCurl',
':dba' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castDba',
':dba persistent' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castDba',
@@ -111,6 +118,7 @@ abstract class AbstractCloner implements ClonerInterface
':pgsql result' => 'Symfony\Component\VarDumper\Caster\PgSqlCaster::castResult',
':process' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castProcess',
':stream' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castStream',
+ ':persistent stream' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castStream',
':stream-context' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castStreamContext',
':xml' => 'Symfony\Component\VarDumper\Caster\XmlResourceCaster::castXml',
);
@@ -125,7 +133,7 @@ abstract class AbstractCloner implements ClonerInterface
private $filter = 0;
/**
- * @param callable[]|null $casters A map of casters.
+ * @param callable[]|null $casters A map of casters
*
* @see addCasters
*/
@@ -146,7 +154,7 @@ abstract class AbstractCloner implements ClonerInterface
* Resource types are to be prefixed with a `:`,
* see e.g. static::$defaultCasters.
*
- * @param callable[] $casters A map of casters.
+ * @param callable[] $casters A map of casters
*/
public function addCasters(array $casters)
{
@@ -178,10 +186,10 @@ abstract class AbstractCloner implements ClonerInterface
/**
* Clones a PHP variable.
*
- * @param mixed $var Any PHP variable.
- * @param int $filter A bit field of Caster::EXCLUDE_* constants.
+ * @param mixed $var Any PHP variable
+ * @param int $filter A bit field of Caster::EXCLUDE_* constants
*
- * @return Data The cloned variable represented by a Data object.
+ * @return Data The cloned variable represented by a Data object
*/
public function cloneVar($var, $filter = 0)
{
@@ -216,19 +224,19 @@ abstract class AbstractCloner implements ClonerInterface
/**
* Effectively clones the PHP variable.
*
- * @param mixed $var Any PHP variable.
+ * @param mixed $var Any PHP variable
*
- * @return array The cloned variable represented in an array.
+ * @return array The cloned variable represented in an array
*/
abstract protected function doClone($var);
/**
* Casts an object to an array representation.
*
- * @param Stub $stub The Stub for the casted object.
- * @param bool $isNested True if the object is nested in the dumped structure.
+ * @param Stub $stub The Stub for the casted object
+ * @param bool $isNested True if the object is nested in the dumped structure
*
- * @return array The object casted as array.
+ * @return array The object casted as array
*/
protected function castObject(Stub $stub, $isNested)
{
@@ -245,14 +253,15 @@ abstract class AbstractCloner implements ClonerInterface
new \ReflectionClass($class),
array_reverse(array($class => $class) + class_parents($class) + class_implements($class) + array('*' => '*')),
);
+ $classInfo[1] = array_map('strtolower', $classInfo[1]);
$this->classInfo[$class] = $classInfo;
}
- $a = $this->callCaster('Symfony\Component\VarDumper\Caster\Caster::castObject', $obj, $classInfo[0], null, $isNested);
+ $a = Caster::castObject($obj, $classInfo[0]);
foreach ($classInfo[1] as $p) {
- if (!empty($this->casters[$p = strtolower($p)])) {
+ if (!empty($this->casters[$p])) {
foreach ($this->casters[$p] as $p) {
$a = $this->callCaster($p, $obj, $a, $stub, $isNested);
}
@@ -265,10 +274,10 @@ abstract class AbstractCloner implements ClonerInterface
/**
* Casts a resource to an array representation.
*
- * @param Stub $stub The Stub for the casted resource.
- * @param bool $isNested True if the object is nested in the dumped structure.
+ * @param Stub $stub The Stub for the casted resource
+ * @param bool $isNested True if the object is nested in the dumped structure
*
- * @return array The resource casted as array.
+ * @return array The resource casted as array
*/
protected function castResource(Stub $stub, $isNested)
{
@@ -288,13 +297,13 @@ abstract class AbstractCloner implements ClonerInterface
/**
* Calls a custom caster.
*
- * @param callable $callback The caster.
- * @param object|resource $obj The object/resource being casted.
- * @param array $a The result of the previous cast for chained casters.
- * @param Stub $stub The Stub for the casted object/resource.
- * @param bool $isNested True if $obj is nested in the dumped structure.
+ * @param callable $callback The caster
+ * @param object|resource $obj The object/resource being casted
+ * @param array $a The result of the previous cast for chained casters
+ * @param Stub $stub The Stub for the casted object/resource
+ * @param bool $isNested True if $obj is nested in the dumped structure
*
- * @return array The casted object/resource.
+ * @return array The casted object/resource
*/
private function callCaster($callback, $obj, $a, $stub, $isNested)
{
@@ -305,7 +314,7 @@ abstract class AbstractCloner implements ClonerInterface
$a = $cast;
}
} catch (\Exception $e) {
- $a[(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠'] = new ThrowingCasterException($e);
+ $a = array((Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)) + $a;
}
return $a;
diff --git a/htdocs/includes/symfony/var-dumper/Cloner/ClonerInterface.php b/htdocs/includes/symfony/var-dumper/Cloner/ClonerInterface.php
index c1df5933dbf..7ed287a2ddf 100644
--- a/htdocs/includes/symfony/var-dumper/Cloner/ClonerInterface.php
+++ b/htdocs/includes/symfony/var-dumper/Cloner/ClonerInterface.php
@@ -19,9 +19,9 @@ interface ClonerInterface
/**
* Clones a PHP variable.
*
- * @param mixed $var Any PHP variable.
+ * @param mixed $var Any PHP variable
*
- * @return Data The cloned variable represented by a Data object.
+ * @return Data The cloned variable represented by a Data object
*/
public function cloneVar($var);
}
diff --git a/htdocs/includes/symfony/var-dumper/Cloner/Cursor.php b/htdocs/includes/symfony/var-dumper/Cloner/Cursor.php
index 162f3293cf2..9db55992e4a 100644
--- a/htdocs/includes/symfony/var-dumper/Cloner/Cursor.php
+++ b/htdocs/includes/symfony/var-dumper/Cloner/Cursor.php
@@ -38,4 +38,5 @@ class Cursor
public $hashLength = 0;
public $hashCut = 0;
public $stop = false;
+ public $attr = array();
}
diff --git a/htdocs/includes/symfony/var-dumper/Cloner/Data.php b/htdocs/includes/symfony/var-dumper/Cloner/Data.php
index 43a7b67971e..22fd2fd1a4a 100644
--- a/htdocs/includes/symfony/var-dumper/Cloner/Data.php
+++ b/htdocs/includes/symfony/var-dumper/Cloner/Data.php
@@ -11,18 +11,22 @@
namespace Symfony\Component\VarDumper\Cloner;
+use Symfony\Component\VarDumper\Caster\Caster;
+
/**
* @author Nicolas Grekas
*/
class Data
{
private $data;
+ private $position = 0;
+ private $key = 0;
private $maxDepth = 20;
private $maxItemsPerDepth = -1;
private $useRefHandles = -1;
/**
- * @param array $data A array as returned by ClonerInterface::cloneVar().
+ * @param array $data A array as returned by ClonerInterface::cloneVar()
*/
public function __construct(array $data)
{
@@ -30,7 +34,7 @@ class Data
}
/**
- * @return array The raw data structure.
+ * @return array The raw data structure
*/
public function getRawData()
{
@@ -40,9 +44,9 @@ class Data
/**
* Returns a depth limited clone of $this.
*
- * @param int $maxDepth The max dumped depth level.
+ * @param int $maxDepth The max dumped depth level
*
- * @return self A clone of $this.
+ * @return self A clone of $this
*/
public function withMaxDepth($maxDepth)
{
@@ -53,11 +57,11 @@ class Data
}
/**
- * Limits the numbers of elements per depth level.
+ * Limits the number of elements per depth level.
*
- * @param int $maxItemsPerDepth The max number of items dumped per depth level.
+ * @param int $maxItemsPerDepth The max number of items dumped per depth level
*
- * @return self A clone of $this.
+ * @return self A clone of $this
*/
public function withMaxItemsPerDepth($maxItemsPerDepth)
{
@@ -70,9 +74,9 @@ class Data
/**
* Enables/disables objects' identifiers tracking.
*
- * @param bool $useRefHandles False to hide global ref. handles.
+ * @param bool $useRefHandles False to hide global ref. handles
*
- * @return self A clone of $this.
+ * @return self A clone of $this
*/
public function withRefHandles($useRefHandles)
{
@@ -82,22 +86,66 @@ class Data
return $data;
}
+ /**
+ * Seeks to a specific key in nested data structures.
+ *
+ * @param string|int $key The key to seek to
+ *
+ * @return self|null A clone of $this of null if the key is not set
+ */
+ public function seek($key)
+ {
+ $item = $this->data[$this->position][$this->key];
+
+ if (!$item instanceof Stub || !$item->position) {
+ return;
+ }
+ $keys = array($key);
+
+ switch ($item->type) {
+ case Stub::TYPE_OBJECT:
+ $keys[] = Caster::PREFIX_DYNAMIC.$key;
+ $keys[] = Caster::PREFIX_PROTECTED.$key;
+ $keys[] = Caster::PREFIX_VIRTUAL.$key;
+ $keys[] = "\0$item->class\0$key";
+ case Stub::TYPE_ARRAY:
+ case Stub::TYPE_RESOURCE:
+ break;
+ default:
+ return;
+ }
+
+ $data = null;
+ $children = $this->data[$item->position];
+
+ foreach ($keys as $key) {
+ if (isset($children[$key]) || array_key_exists($key, $children)) {
+ $data = clone $this;
+ $data->key = $key;
+ $data->position = $item->position;
+ break;
+ }
+ }
+
+ return $data;
+ }
+
/**
* Dumps data with a DumperInterface dumper.
*/
public function dump(DumperInterface $dumper)
{
$refs = array(0);
- $this->dumpItem($dumper, new Cursor(), $refs, $this->data[0][0]);
+ $this->dumpItem($dumper, new Cursor(), $refs, $this->data[$this->position][$this->key]);
}
/**
* Depth-first dumping of items.
*
- * @param DumperInterface $dumper The dumper being used for dumping.
- * @param Cursor $cursor A cursor used for tracking dumper state position.
- * @param array &$refs A map of all references discovered while dumping.
- * @param mixed $item A Stub object or the original value being dumped.
+ * @param DumperInterface $dumper The dumper being used for dumping
+ * @param Cursor $cursor A cursor used for tracking dumper state position
+ * @param array &$refs A map of all references discovered while dumping
+ * @param mixed $item A Stub object or the original value being dumped
*/
private function dumpItem($dumper, $cursor, &$refs, $item)
{
@@ -107,6 +155,7 @@ class Data
$firstSeen = true;
if (!$item instanceof Stub) {
+ $cursor->attr = array();
$type = gettype($item);
} elseif (Stub::TYPE_REF === $item->type) {
if ($item->handle) {
@@ -119,6 +168,7 @@ class Data
$cursor->hardRefHandle = $this->useRefHandles & $item->handle;
$cursor->hardRefCount = $item->refCount;
}
+ $cursor->attr = $item->attr;
$type = $item->class ?: gettype($item->value);
$item = $item->value;
}
@@ -133,6 +183,7 @@ class Data
}
$cursor->softRefHandle = $this->useRefHandles & $item->handle;
$cursor->softRefCount = $item->refCount;
+ $cursor->attr = $item->attr;
$cut = $item->cut;
if ($item->position && $firstSeen) {
@@ -162,7 +213,7 @@ class Data
$withChildren = $children && $cursor->depth !== $this->maxDepth && $this->maxItemsPerDepth;
$dumper->enterHash($cursor, $item->type, $item->class, $withChildren);
if ($withChildren) {
- $cut = $this->dumpChildren($dumper, $cursor, $refs, $children, $cut, $item->type);
+ $cut = $this->dumpChildren($dumper, $cursor, $refs, $children, $cut, $item->type, null !== $item->class);
} elseif ($children && 0 <= $cut) {
$cut += count($children);
}
@@ -186,15 +237,16 @@ class Data
* Dumps children of hash structures.
*
* @param DumperInterface $dumper
- * @param Cursor $parentCursor The cursor of the parent hash.
- * @param array &$refs A map of all references discovered while dumping.
- * @param array $children The children to dump.
- * @param int $hashCut The number of items removed from the original hash.
- * @param string $hashType A Cursor::HASH_* const.
+ * @param Cursor $parentCursor The cursor of the parent hash
+ * @param array &$refs A map of all references discovered while dumping
+ * @param array $children The children to dump
+ * @param int $hashCut The number of items removed from the original hash
+ * @param string $hashType A Cursor::HASH_* const
+ * @param bool $dumpKeys Whether keys should be dumped or not
*
- * @return int The final number of removed items.
+ * @return int The final number of removed items
*/
- private function dumpChildren($dumper, $parentCursor, &$refs, $children, $hashCut, $hashType)
+ private function dumpChildren($dumper, $parentCursor, &$refs, $children, $hashCut, $hashType, $dumpKeys)
{
$cursor = clone $parentCursor;
++$cursor->depth;
@@ -204,7 +256,7 @@ class Data
$cursor->hashCut = $hashCut;
foreach ($children as $key => $child) {
$cursor->hashKeyIsBinary = isset($key[0]) && !preg_match('//u', $key);
- $cursor->hashKey = $key;
+ $cursor->hashKey = $dumpKeys ? $key : null;
$this->dumpItem($dumper, $cursor, $refs, $child);
if (++$cursor->hashIndex === $this->maxItemsPerDepth || $cursor->stop) {
$parentCursor->stop = true;
diff --git a/htdocs/includes/symfony/var-dumper/Cloner/DumperInterface.php b/htdocs/includes/symfony/var-dumper/Cloner/DumperInterface.php
index eba23d42297..cb7981694f9 100644
--- a/htdocs/includes/symfony/var-dumper/Cloner/DumperInterface.php
+++ b/htdocs/includes/symfony/var-dumper/Cloner/DumperInterface.php
@@ -21,40 +21,40 @@ interface DumperInterface
/**
* Dumps a scalar value.
*
- * @param Cursor $cursor The Cursor position in the dump.
- * @param string $type The PHP type of the value being dumped.
- * @param scalar $value The scalar value being dumped.
+ * @param Cursor $cursor The Cursor position in the dump
+ * @param string $type The PHP type of the value being dumped
+ * @param scalar $value The scalar value being dumped
*/
public function dumpScalar(Cursor $cursor, $type, $value);
/**
* Dumps a string.
*
- * @param Cursor $cursor The Cursor position in the dump.
- * @param string $str The string being dumped.
- * @param bool $bin Whether $str is UTF-8 or binary encoded.
- * @param int $cut The number of characters $str has been cut by.
+ * @param Cursor $cursor The Cursor position in the dump
+ * @param string $str The string being dumped
+ * @param bool $bin Whether $str is UTF-8 or binary encoded
+ * @param int $cut The number of characters $str has been cut by
*/
public function dumpString(Cursor $cursor, $str, $bin, $cut);
/**
* Dumps while entering an hash.
*
- * @param Cursor $cursor The Cursor position in the dump.
- * @param int $type A Cursor::HASH_* const for the type of hash.
- * @param string $class The object class, resource type or array count.
- * @param bool $hasChild When the dump of the hash has child item.
+ * @param Cursor $cursor The Cursor position in the dump
+ * @param int $type A Cursor::HASH_* const for the type of hash
+ * @param string $class The object class, resource type or array count
+ * @param bool $hasChild When the dump of the hash has child item
*/
public function enterHash(Cursor $cursor, $type, $class, $hasChild);
/**
* Dumps while leaving an hash.
*
- * @param Cursor $cursor The Cursor position in the dump.
- * @param int $type A Cursor::HASH_* const for the type of hash.
- * @param string $class The object class, resource type or array count.
- * @param bool $hasChild When the dump of the hash has child item.
- * @param int $cut The number of items the hash has been cut by.
+ * @param Cursor $cursor The Cursor position in the dump
+ * @param int $type A Cursor::HASH_* const for the type of hash
+ * @param string $class The object class, resource type or array count
+ * @param bool $hasChild When the dump of the hash has child item
+ * @param int $cut The number of items the hash has been cut by
*/
public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut);
}
diff --git a/htdocs/includes/symfony/var-dumper/Cloner/Stub.php b/htdocs/includes/symfony/var-dumper/Cloner/Stub.php
index f58a57a7276..313c591fc83 100644
--- a/htdocs/includes/symfony/var-dumper/Cloner/Stub.php
+++ b/htdocs/includes/symfony/var-dumper/Cloner/Stub.php
@@ -37,4 +37,5 @@ class Stub
public $handle = 0;
public $refCount = 0;
public $position = 0;
+ public $attr = array();
}
diff --git a/htdocs/includes/symfony/var-dumper/Cloner/VarCloner.php b/htdocs/includes/symfony/var-dumper/Cloner/VarCloner.php
index 20cc8d08354..6a3b451bda7 100644
--- a/htdocs/includes/symfony/var-dumper/Cloner/VarCloner.php
+++ b/htdocs/includes/symfony/var-dumper/Cloner/VarCloner.php
@@ -25,10 +25,9 @@ class VarCloner extends AbstractCloner
protected function doClone($var)
{
$useExt = $this->useExt;
- $i = 0; // Current iteration position in $queue
$len = 1; // Length of $queue
$pos = 0; // Number of cloned items past the first level
- $refs = 0; // Hard references counter
+ $refsCounter = 0; // Hard references counter
$queue = array(array($var)); // This breadth-first queue is the return value
$arrayRefs = array(); // Map of queue indexes to stub array objects
$hardRefs = array(); // Map of original zval hashes to stub objects
@@ -60,27 +59,32 @@ class VarCloner extends AbstractCloner
for ($i = 0; $i < $len; ++$i) {
$indexed = true; // Whether the currently iterated array is numerically indexed or not
$j = -1; // Position in the currently iterated array
- $step = $queue[$i]; // Copy of the currently iterated array used for hard references detection
- foreach ($step as $k => $v) {
+ $fromObjCast = array_keys($queue[$i]);
+ $fromObjCast = array_keys(array_flip($fromObjCast)) !== $fromObjCast;
+ $refs = $vals = $fromObjCast ? array_values($queue[$i]) : $queue[$i];
+ foreach ($queue[$i] as $k => $v) {
// $k is the original key
// $v is the original value or a stub object in case of hard references
- if ($indexed && $k !== ++$j) {
+ if ($k !== ++$j) {
$indexed = false;
}
+ if ($fromObjCast) {
+ $k = $j;
+ }
if ($useExt) {
- $zval = symfony_zval_info($k, $step);
+ $zval = symfony_zval_info($k, $refs);
} else {
- $step[$k] = $cookie;
- if ($zval['zval_isref'] = $queue[$i][$k] === $cookie) {
+ $refs[$k] = $cookie;
+ if ($zval['zval_isref'] = $vals[$k] === $cookie) {
$zval['zval_hash'] = $v instanceof Stub ? spl_object_hash($v) : null;
}
$zval['type'] = gettype($v);
}
if ($zval['zval_isref']) {
- $queue[$i][$k] = &$stub; // Break hard references to make $queue completely
+ $vals[$k] = &$stub; // Break hard references to make $queue completely
unset($stub); // independent from the original structure
if (isset($hardRefs[$zval['zval_hash']])) {
- $queue[$i][$k] = $useExt ? ($v = $hardRefs[$zval['zval_hash']]) : ($step[$k] = $v);
+ $vals[$k] = $useExt ? ($v = $hardRefs[$zval['zval_hash']]) : ($refs[$k] = $v);
if ($v->value instanceof Stub && (Stub::TYPE_OBJECT === $v->value->type || Stub::TYPE_RESOURCE === $v->value->type)) {
++$v->value->refCount;
}
@@ -102,12 +106,12 @@ class VarCloner extends AbstractCloner
} else {
$stub->value = $v;
}
- } elseif (0 <= $maxString && isset($v[1 + ($maxString >> 2)]) && 0 < $cut = iconv_strlen($v, 'UTF-8') - $maxString) {
+ } elseif (0 <= $maxString && isset($v[1 + ($maxString >> 2)]) && 0 < $cut = mb_strlen($v, 'UTF-8') - $maxString) {
$stub = new Stub();
$stub->type = Stub::TYPE_STRING;
$stub->class = Stub::STRING_UTF8;
$stub->cut = $cut;
- $stub->value = iconv_substr($v, 0, $maxString, 'UTF-8');
+ $stub->value = mb_substr($v, 0, $maxString, 'UTF-8');
}
break;
@@ -178,10 +182,13 @@ class VarCloner extends AbstractCloner
case 'resource':
case 'unknown type':
+ case 'resource (closed)':
if (empty($resRefs[$h = (int) $v])) {
$stub = new Stub();
$stub->type = Stub::TYPE_RESOURCE;
- $stub->class = $zval['resource_type'] ?: get_resource_type($v);
+ if ('Unknown' === $stub->class = $zval['resource_type'] ?: @get_resource_type($v)) {
+ $stub->class = 'Closed';
+ }
$stub->value = $v;
$stub->handle = $h;
$a = $this->castResource($stub, 0 < $i);
@@ -204,18 +211,18 @@ class VarCloner extends AbstractCloner
if (isset($stub)) {
if ($zval['zval_isref']) {
if ($useExt) {
- $queue[$i][$k] = $hardRefs[$zval['zval_hash']] = $v = new Stub();
+ $vals[$k] = $hardRefs[$zval['zval_hash']] = $v = new Stub();
$v->value = $stub;
} else {
- $step[$k] = new Stub();
- $step[$k]->value = $stub;
- $h = spl_object_hash($step[$k]);
- $queue[$i][$k] = $hardRefs[$h] = &$step[$k];
+ $refs[$k] = new Stub();
+ $refs[$k]->value = $stub;
+ $h = spl_object_hash($refs[$k]);
+ $vals[$k] = $hardRefs[$h] = &$refs[$k];
$values[$h] = $v;
}
- $queue[$i][$k]->handle = ++$refs;
+ $vals[$k]->handle = ++$refsCounter;
} else {
- $queue[$i][$k] = $stub;
+ $vals[$k] = $stub;
}
if ($a) {
@@ -243,19 +250,38 @@ class VarCloner extends AbstractCloner
$stub = $a = null;
} elseif ($zval['zval_isref']) {
if ($useExt) {
- $queue[$i][$k] = $hardRefs[$zval['zval_hash']] = new Stub();
- $queue[$i][$k]->value = $v;
+ $vals[$k] = $hardRefs[$zval['zval_hash']] = new Stub();
+ $vals[$k]->value = $v;
} else {
- $step[$k] = $queue[$i][$k] = new Stub();
- $step[$k]->value = $v;
- $h = spl_object_hash($step[$k]);
- $hardRefs[$h] = &$step[$k];
+ $refs[$k] = $vals[$k] = new Stub();
+ $refs[$k]->value = $v;
+ $h = spl_object_hash($refs[$k]);
+ $hardRefs[$h] = &$refs[$k];
$values[$h] = $v;
}
- $queue[$i][$k]->handle = ++$refs;
+ $vals[$k]->handle = ++$refsCounter;
}
}
+ if ($fromObjCast) {
+ $refs = $vals;
+ $vals = array();
+ $j = -1;
+ foreach ($queue[$i] as $k => $v) {
+ foreach (array($k => $v) as $a => $v) {
+ }
+ if ($a !== $k) {
+ $vals = (object) $vals;
+ $vals->{$k} = $refs[++$j];
+ $vals = (array) $vals;
+ } else {
+ $vals[$k] = $refs[++$j];
+ }
+ }
+ }
+
+ $queue[$i] = $vals;
+
if (isset($arrayRefs[$i])) {
if ($indexed) {
$arrayRefs[$i]->class = Stub::ARRAY_INDEXED;
@@ -291,7 +317,7 @@ class VarCloner extends AbstractCloner
if (!empty($frame['line'])) {
ob_start();
debug_zval_dump($obj);
- self::$hashMask = strlen(substr(ob_get_clean(), 17));
+ self::$hashMask = (int) substr(ob_get_clean(), 17);
}
}
diff --git a/htdocs/includes/symfony/var-dumper/Dumper/AbstractDumper.php b/htdocs/includes/symfony/var-dumper/Dumper/AbstractDumper.php
index f8b9c107779..12f835b1ffa 100644
--- a/htdocs/includes/symfony/var-dumper/Dumper/AbstractDumper.php
+++ b/htdocs/includes/symfony/var-dumper/Dumper/AbstractDumper.php
@@ -21,6 +21,9 @@ use Symfony\Component\VarDumper\Cloner\DumperInterface;
*/
abstract class AbstractDumper implements DataDumperInterface, DumperInterface
{
+ const DUMP_LIGHT_ARRAY = 1;
+ const DUMP_STRING_LENGTH = 2;
+
public static $defaultOutput = 'php://output';
protected $line = '';
@@ -28,18 +31,21 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
protected $outputStream;
protected $decimalPoint; // This is locale dependent
protected $indentPad = ' ';
+ protected $flags;
private $charset;
/**
- * @param callable|resource|string|null $output A line dumper callable, an opened stream or an output path, defaults to static::$defaultOutput.
- * @param string $charset The default character encoding to use for non-UTF8 strings.
+ * @param callable|resource|string|null $output A line dumper callable, an opened stream or an output path, defaults to static::$defaultOutput
+ * @param string $charset The default character encoding to use for non-UTF8 strings
+ * @param int $flags A bit field of static::DUMP_* constants to fine tune dumps representation
*/
- public function __construct($output = null, $charset = null)
+ public function __construct($output = null, $charset = null, $flags = 0)
{
+ $this->flags = (int) $flags;
$this->setCharset($charset ?: ini_get('php.output_encoding') ?: ini_get('default_charset') ?: 'UTF-8');
- $this->decimalPoint = (string) 0.5;
- $this->decimalPoint = $this->decimalPoint[1];
+ $this->decimalPoint = localeconv();
+ $this->decimalPoint = $this->decimalPoint['decimal_point'];
$this->setOutput($output ?: static::$defaultOutput);
if (!$output && is_string(static::$defaultOutput)) {
static::$defaultOutput = $this->outputStream;
@@ -49,9 +55,9 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
/**
* Sets the output destination of the dumps.
*
- * @param callable|resource|string $output A line dumper callable, an opened stream or an output path.
+ * @param callable|resource|string $output A line dumper callable, an opened stream or an output path
*
- * @return callable|resource|string The previous output destination.
+ * @return callable|resource|string The previous output destination
*/
public function setOutput($output)
{
@@ -74,9 +80,9 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
/**
* Sets the default character encoding to use for non-UTF8 strings.
*
- * @param string $charset The default character encoding to use for non-UTF8 strings.
+ * @param string $charset The default character encoding to use for non-UTF8 strings
*
- * @return string The previous charset.
+ * @return string The previous charset
*/
public function setCharset($charset)
{
@@ -93,9 +99,9 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
/**
* Sets the indentation pad string.
*
- * @param string $pad A string the will be prepended to dumped lines, repeated by nesting level.
+ * @param string $pad A string the will be prepended to dumped lines, repeated by nesting level
*
- * @return string The indent pad.
+ * @return string The indent pad
*/
public function setIndentPad($pad)
{
@@ -108,33 +114,43 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
/**
* Dumps a Data object.
*
- * @param Data $data A Data object.
- * @param callable|resource|string|null $output A line dumper callable, an opened stream or an output path.
+ * @param Data $data A Data object
+ * @param callable|resource|string|true|null $output A line dumper callable, an opened stream, an output path or true to return the dump
+ *
+ * @return string|null The dump as string when $output is true
*/
public function dump(Data $data, $output = null)
{
- $exception = null;
+ $this->decimalPoint = localeconv();
+ $this->decimalPoint = $this->decimalPoint['decimal_point'];
+
+ if ($returnDump = true === $output) {
+ $output = fopen('php://memory', 'r+b');
+ }
if ($output) {
$prevOutput = $this->setOutput($output);
}
try {
$data->dump($this);
$this->dumpLine(-1);
- } catch (\Exception $exception) {
- // Re-thrown below
- }
- if ($output) {
- $this->setOutput($prevOutput);
- }
- if (null !== $exception) {
- throw $exception;
+
+ if ($returnDump) {
+ $result = stream_get_contents($output, -1, 0);
+ fclose($output);
+
+ return $result;
+ }
+ } finally {
+ if ($output) {
+ $this->setOutput($prevOutput);
+ }
}
}
/**
* Dumps the current line.
*
- * @param int $depth The recursive depth in the dumped structure for the line being dumped.
+ * @param int $depth The recursive depth in the dumped structure for the line being dumped
*/
protected function dumpLine($depth)
{
@@ -145,8 +161,9 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
/**
* Generic line dumper callback.
*
- * @param string $line The line to write.
- * @param int $depth The recursive depth in the dumped structure.
+ * @param string $line The line to write
+ * @param int $depth The recursive depth in the dumped structure
+ * @param string $indentPad The line indent pad
*/
protected function echoLine($line, $depth, $indentPad)
{
@@ -158,12 +175,20 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
/**
* Converts a non-UTF-8 string to UTF-8.
*
- * @param string $s The non-UTF-8 string to convert.
+ * @param string $s The non-UTF-8 string to convert
*
- * @return string The string converted to UTF-8.
+ * @return string The string converted to UTF-8
*/
protected function utf8Encode($s)
{
+ if (preg_match('//u', $s)) {
+ return $s;
+ }
+
+ if (!function_exists('iconv')) {
+ throw new \RuntimeException('Unable to convert a non-UTF-8 string to UTF-8: required function iconv() does not exist. You should install ext-iconv or symfony/polyfill-iconv.');
+ }
+
if (false !== $c = @iconv($this->charset, 'UTF-8', $s)) {
return $c;
}
diff --git a/htdocs/includes/symfony/var-dumper/Dumper/CliDumper.php b/htdocs/includes/symfony/var-dumper/Dumper/CliDumper.php
index bca2abcb3d0..540f9245fdf 100644
--- a/htdocs/includes/symfony/var-dumper/Dumper/CliDumper.php
+++ b/htdocs/includes/symfony/var-dumper/Dumper/CliDumper.php
@@ -54,12 +54,12 @@ class CliDumper extends AbstractDumper
/**
* {@inheritdoc}
*/
- public function __construct($output = null, $charset = null)
+ public function __construct($output = null, $charset = null, $flags = 0)
{
- parent::__construct($output, $charset);
+ parent::__construct($output, $charset, $flags);
- if ('\\' === DIRECTORY_SEPARATOR && false !== @getenv('ANSICON')) {
- // Use only the base 16 xterm colors when using ANSICON
+ if ('\\' === DIRECTORY_SEPARATOR && 'ON' !== @getenv('ConEmuANSI') && 'xterm' !== @getenv('TERM')) {
+ // Use only the base 16 xterm colors when using ANSICON or standard Windows 10 CLI
$this->setStyles(array(
'default' => '31',
'num' => '1;34',
@@ -97,7 +97,7 @@ class CliDumper extends AbstractDumper
/**
* Configures styles.
*
- * @param array $styles A map of style names to style definitions.
+ * @param array $styles A map of style names to style definitions
*/
public function setStyles(array $styles)
{
@@ -112,9 +112,13 @@ class CliDumper extends AbstractDumper
$this->dumpKey($cursor);
$style = 'const';
- $attr = array();
+ $attr = $cursor->attr;
switch ($type) {
+ case 'default':
+ $style = 'default';
+ break;
+
case 'integer':
$style = 'num';
break;
@@ -123,9 +127,9 @@ class CliDumper extends AbstractDumper
$style = 'num';
switch (true) {
- case INF === $value: $value = 'INF'; break;
+ case INF === $value: $value = 'INF'; break;
case -INF === $value: $value = '-INF'; break;
- case is_nan($value): $value = 'NAN'; break;
+ case is_nan($value): $value = 'NAN'; break;
default:
$value = (string) $value;
if (false === strpos($value, $this->decimalPoint)) {
@@ -144,8 +148,8 @@ class CliDumper extends AbstractDumper
break;
default:
- $attr['value'] = isset($value[0]) && !preg_match('//u', $value) ? $this->utf8Encode($value) : $value;
- $value = isset($type[0]) && !preg_match('//u', $type) ? $this->utf8Encode($type) : $type;
+ $attr += array('value' => $this->utf8Encode($value));
+ $value = $this->utf8Encode($type);
break;
}
@@ -160,6 +164,7 @@ class CliDumper extends AbstractDumper
public function dumpString(Cursor $cursor, $str, $bin, $cut)
{
$this->dumpKey($cursor);
+ $attr = $cursor->attr;
if ($bin) {
$str = $this->utf8Encode($str);
@@ -168,8 +173,8 @@ class CliDumper extends AbstractDumper
$this->line .= '""';
$this->dumpLine($cursor->depth, true);
} else {
- $attr = array(
- 'length' => 0 <= $cut ? iconv_strlen($str, 'UTF-8') + $cut : 0,
+ $attr += array(
+ 'length' => 0 <= $cut ? mb_strlen($str, 'UTF-8') + $cut : 0,
'binary' => $bin,
);
$str = explode("\n", $str);
@@ -180,6 +185,9 @@ class CliDumper extends AbstractDumper
$m = count($str) - 1;
$i = $lineCut = 0;
+ if (self::DUMP_STRING_LENGTH & $this->flags) {
+ $this->line .= '('.$attr['length'].') ';
+ }
if ($bin) {
$this->line .= 'b';
}
@@ -195,8 +203,8 @@ class CliDumper extends AbstractDumper
if ($i < $m) {
$str .= "\n";
}
- if (0 < $this->maxStringWidth && $this->maxStringWidth < $len = iconv_strlen($str, 'UTF-8')) {
- $str = iconv_substr($str, 0, $this->maxStringWidth, 'UTF-8');
+ if (0 < $this->maxStringWidth && $this->maxStringWidth < $len = mb_strlen($str, 'UTF-8')) {
+ $str = mb_substr($str, 0, $this->maxStringWidth, 'UTF-8');
$lineCut = $len - $this->maxStringWidth;
}
if ($m && 0 < $cursor->depth) {
@@ -241,15 +249,13 @@ class CliDumper extends AbstractDumper
{
$this->dumpKey($cursor);
- if (!preg_match('//u', $class)) {
- $class = $this->utf8Encode($class);
- }
+ $class = $this->utf8Encode($class);
if (Cursor::HASH_OBJECT === $type) {
$prefix = $class && 'stdClass' !== $class ? $this->style('note', $class).' {' : '{';
} elseif (Cursor::HASH_RESOURCE === $type) {
$prefix = $this->style('note', $class.' resource').($hasChild ? ' {' : ' ');
} else {
- $prefix = $class ? $this->style('note', 'array:'.$class).' [' : '[';
+ $prefix = $class && !(self::DUMP_LIGHT_ARRAY & $this->flags) ? $this->style('note', 'array:'.$class).' [' : '[';
}
if ($cursor->softRefCount || 0 < $cursor->softRefHandle) {
@@ -280,9 +286,9 @@ class CliDumper extends AbstractDumper
/**
* Dumps an ellipsis for cut children.
*
- * @param Cursor $cursor The Cursor position in the dump.
- * @param bool $hasChild When the dump of the hash has child item.
- * @param int $cut The number of items the hash has been cut by.
+ * @param Cursor $cursor The Cursor position in the dump
+ * @param bool $hasChild When the dump of the hash has child item
+ * @param int $cut The number of items the hash has been cut by
*/
protected function dumpEllipsis(Cursor $cursor, $hasChild, $cut)
{
@@ -300,7 +306,7 @@ class CliDumper extends AbstractDumper
/**
* Dumps a key in a hash structure.
*
- * @param Cursor $cursor The Cursor position in the dump.
+ * @param Cursor $cursor The Cursor position in the dump
*/
protected function dumpKey(Cursor $cursor)
{
@@ -314,6 +320,9 @@ class CliDumper extends AbstractDumper
switch ($cursor->hashType) {
default:
case Cursor::HASH_INDEXED:
+ if (self::DUMP_LIGHT_ARRAY & $this->flags) {
+ break;
+ }
$style = 'index';
case Cursor::HASH_ASSOC:
if (is_int($key)) {
@@ -332,13 +341,17 @@ class CliDumper extends AbstractDumper
} elseif (0 < strpos($key, "\0", 1)) {
$key = explode("\0", substr($key, 1), 2);
- switch ($key[0]) {
+ switch ($key[0][0]) {
case '+': // User inserted keys
$attr['dynamic'] = true;
$this->line .= '+'.$bin.'"'.$this->style('public', $key[1], $attr).'": ';
break 2;
case '~':
$style = 'meta';
+ if (isset($key[0][1])) {
+ parse_str(substr($key[0], 1), $attr);
+ $attr += array('binary' => $cursor->hashKeyIsBinary);
+ }
break;
case '*':
$style = 'protected';
@@ -368,11 +381,11 @@ class CliDumper extends AbstractDumper
/**
* Decorates a value with some style.
*
- * @param string $style The type of style being applied.
- * @param string $value The value being styled.
- * @param array $attr Optional context information.
+ * @param string $style The type of style being applied
+ * @param string $value The value being styled
+ * @param array $attr Optional context information
*
- * @return string The value with style decoration.
+ * @return string The value with style decoration
*/
protected function style($style, $value, $attr = array())
{
@@ -412,7 +425,7 @@ class CliDumper extends AbstractDumper
}
/**
- * @return bool Tells if the current output stream supports ANSI colors or not.
+ * @return bool Tells if the current output stream supports ANSI colors or not
*/
protected function supportsColors()
{
@@ -446,7 +459,12 @@ class CliDumper extends AbstractDumper
}
if ('\\' === DIRECTORY_SEPARATOR) {
- static::$defaultColors = @(false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM'));
+ static::$defaultColors = @(
+ '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
+ || false !== getenv('ANSICON')
+ || 'ON' === getenv('ConEmuANSI')
+ || 'xterm' === getenv('TERM')
+ );
} elseif (function_exists('posix_isatty')) {
$h = stream_get_meta_data($this->outputStream) + array('wrapper_type' => null);
$h = 'Output' === $h['stream_type'] && 'PHP' === $h['wrapper_type'] ? fopen('php://stdout', 'wb') : $this->outputStream;
diff --git a/htdocs/includes/symfony/var-dumper/Dumper/DataDumperInterface.php b/htdocs/includes/symfony/var-dumper/Dumper/DataDumperInterface.php
index ee6060cebf6..2c3d9db850d 100644
--- a/htdocs/includes/symfony/var-dumper/Dumper/DataDumperInterface.php
+++ b/htdocs/includes/symfony/var-dumper/Dumper/DataDumperInterface.php
@@ -23,7 +23,7 @@ interface DataDumperInterface
/**
* Dumps a Data object.
*
- * @param Data $data A Data object.
+ * @param Data $data A Data object
*/
public function dump(Data $data);
}
diff --git a/htdocs/includes/symfony/var-dumper/Dumper/HtmlDumper.php b/htdocs/includes/symfony/var-dumper/Dumper/HtmlDumper.php
index 28af8e4cb22..cc0b1ce179c 100644
--- a/htdocs/includes/symfony/var-dumper/Dumper/HtmlDumper.php
+++ b/htdocs/includes/symfony/var-dumper/Dumper/HtmlDumper.php
@@ -25,13 +25,13 @@ class HtmlDumper extends CliDumper
protected $dumpHeader;
protected $dumpPrefix = '
';
- protected $dumpSuffix = ' ';
+ protected $dumpSuffix = '';
protected $dumpId = 'sf-dump';
protected $colors = true;
protected $headerIsDumped = false;
protected $lastDepth = -1;
protected $styles = array(
- 'default' => 'background-color:#18171B; color:#FF8400; line-height:1.2em; font:12px Menlo, Monaco, Consolas, monospace; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:100000; word-break: normal',
+ 'default' => 'background-color:#18171B; color:#FF8400; line-height:1.2em; font:12px Menlo, Monaco, Consolas, monospace; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:99999; word-break: normal',
'num' => 'font-weight:bold; color:#1299DA',
'const' => 'font-weight:bold',
'str' => 'font-weight:bold; color:#56DB3A',
@@ -43,27 +43,24 @@ class HtmlDumper extends CliDumper
'meta' => 'color:#B729D9',
'key' => 'color:#56DB3A',
'index' => 'color:#1299DA',
+ 'ellipsis' => 'color:#FF8400',
);
+ private $displayOptions = array(
+ 'maxDepth' => 1,
+ 'maxStringLength' => 160,
+ 'fileLinkFormat' => null,
+ );
+ private $extraDisplayOptions = array();
+
/**
* {@inheritdoc}
*/
- public function __construct($output = null, $charset = null)
+ public function __construct($output = null, $charset = null, $flags = 0)
{
- AbstractDumper::__construct($output, $charset);
+ AbstractDumper::__construct($output, $charset, $flags);
$this->dumpId = 'sf-dump-'.mt_rand();
- }
-
- /**
- * {@inheritdoc}
- */
- public function setOutput($output)
- {
- if ($output !== $prev = parent::setOutput($output)) {
- $this->headerIsDumped = false;
- }
-
- return $prev;
+ $this->displayOptions['fileLinkFormat'] = ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
}
/**
@@ -75,10 +72,21 @@ class HtmlDumper extends CliDumper
$this->styles = $styles + $this->styles;
}
+ /**
+ * Configures display options.
+ *
+ * @param array $displayOptions A map of display options to customize the behavior
+ */
+ public function setDisplayOptions(array $displayOptions)
+ {
+ $this->headerIsDumped = false;
+ $this->displayOptions = $displayOptions + $this->displayOptions;
+ }
+
/**
* Sets an HTML header that will be dumped once in the output stream.
*
- * @param string $header An HTML string.
+ * @param string $header An HTML string
*/
public function setDumpHeader($header)
{
@@ -88,8 +96,8 @@ class HtmlDumper extends CliDumper
/**
* Sets an HTML prefix and suffix that will encapse every single dump.
*
- * @param string $prefix The prepended HTML string.
- * @param string $suffix The appended HTML string.
+ * @param string $prefix The prepended HTML string
+ * @param string $suffix The appended HTML string
*/
public function setDumpBoundaries($prefix, $suffix)
{
@@ -100,10 +108,13 @@ class HtmlDumper extends CliDumper
/**
* {@inheritdoc}
*/
- public function dump(Data $data, $output = null)
+ public function dump(Data $data, $output = null, array $extraDisplayOptions = array())
{
- parent::dump($data, $output);
+ $this->extraDisplayOptions = $extraDisplayOptions;
+ $result = parent::dump($data, $output);
$this->dumpId = 'sf-dump-'.mt_rand();
+
+ return $result;
}
/**
@@ -111,13 +122,13 @@ class HtmlDumper extends CliDumper
*/
protected function getDumpHeader()
{
- $this->headerIsDumped = true;
+ $this->headerIsDumped = null !== $this->outputStream ? $this->outputStream : $this->lineDumper;
if (null !== $this->dumpHeader) {
return $this->dumpHeader;
}
- $line = <<<'EOHTML'
+ $line = str_replace('{$options}', json_encode($this->displayOptions, JSON_FORCE_OBJECT), <<<'EOHTML'
-'.$this->dumpHeader;
@@ -374,7 +448,7 @@ EOHTML;
return '';
}
- $v = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
+ $v = esc($value);
if ('ref' === $style) {
if (empty($attr['count'])) {
@@ -385,41 +459,47 @@ EOHTML;
return sprintf('%s ', $this->dumpId, $r, 1 + $attr['count'], $v);
}
- if ('const' === $style && array_key_exists('value', $attr)) {
- $style .= sprintf(' title="%s"', htmlspecialchars(json_encode($attr['value']), ENT_QUOTES, 'UTF-8'));
+ if ('const' === $style && isset($attr['value'])) {
+ $style .= sprintf(' title="%s"', esc(is_scalar($attr['value']) ? $attr['value'] : json_encode($attr['value'])));
} elseif ('public' === $style) {
$style .= sprintf(' title="%s"', empty($attr['dynamic']) ? 'Public property' : 'Runtime added dynamic property');
} elseif ('str' === $style && 1 < $attr['length']) {
- $style .= sprintf(' title="%s%s characters"', $attr['length'], $attr['binary'] ? ' binary or non-UTF-8' : '');
+ $style .= sprintf(' title="%d%s characters"', $attr['length'], $attr['binary'] ? ' binary or non-UTF-8' : '');
} elseif ('note' === $style && false !== $c = strrpos($v, '\\')) {
return sprintf('%s ', $v, $style, substr($v, $c + 1));
} elseif ('protected' === $style) {
$style .= ' title="Protected property"';
+ } elseif ('meta' === $style && isset($attr['title'])) {
+ $style .= sprintf(' title="%s"', esc($this->utf8Encode($attr['title'])));
} elseif ('private' === $style) {
- $style .= sprintf(' title="Private property defined in class:
`%s`"', $attr['class']);
+ $style .= sprintf(' title="Private property defined in class:
`%s`"', esc($this->utf8Encode($attr['class'])));
+ }
+ $map = static::$controlCharsMap;
+
+ if (isset($attr['ellipsis'])) {
+ $label = esc(substr($value, -$attr['ellipsis']));
+ $style = str_replace(' title="', " title=\"$v\n", $style);
+ $v = sprintf('%s %s', substr($v, 0, -strlen($label)), $label);
}
- $map = static::$controlCharsMap;
- $style = "";
- $v = preg_replace_callback(static::$controlCharsRx, function ($c) use ($map, $style) {
- $s = ' ';
+ $v = "".preg_replace_callback(static::$controlCharsRx, function ($c) use ($map) {
+ $s = '';
$c = $c[$i = 0];
do {
$s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', ord($c[$i]));
} while (isset($c[++$i]));
- return $s.$style;
- }, $v, -1, $cchrCount);
+ return $s.' ';
+ }, $v).' ';
- if ($cchrCount && '<' === $v[0]) {
- $v = substr($v, 7);
- } else {
- $v = $style.$v;
+ if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], isset($attr['line']) ? $attr['line'] : 0)) {
+ $attr['href'] = $href;
}
- if ($cchrCount && '>' === substr($v, -1)) {
- $v = substr($v, 0, -strlen($style));
- } else {
- $v .= '';
+ if (isset($attr['href'])) {
+ $v = sprintf('%s ', esc($this->utf8Encode($attr['href'])), $v);
+ }
+ if (isset($attr['lang'])) {
+ $v = sprintf('%s', esc($attr['lang']), $v);
}
return $v;
@@ -433,12 +513,17 @@ EOHTML;
if (-1 === $this->lastDepth) {
$this->line = sprintf($this->dumpPrefix, $this->dumpId, $this->indentPad).$this->line;
}
- if (!$this->headerIsDumped) {
+ if ($this->headerIsDumped !== (null !== $this->outputStream ? $this->outputStream : $this->lineDumper)) {
$this->line = $this->getDumpHeader().$this->line;
}
if (-1 === $depth) {
- $this->line .= sprintf($this->dumpSuffix, $this->dumpId);
+ $args = array('"'.$this->dumpId.'"');
+ if ($this->extraDisplayOptions) {
+ $args[] = json_encode($this->extraDisplayOptions, JSON_FORCE_OBJECT);
+ }
+ // Replace is for BC
+ $this->line .= sprintf(str_replace('"%s"', '%s', $this->dumpSuffix), implode(', ', $args));
}
$this->lastDepth = $depth;
@@ -449,4 +534,20 @@ EOHTML;
}
AbstractDumper::dumpLine($depth);
}
+
+ private function getSourceLink($file, $line)
+ {
+ $options = $this->extraDisplayOptions + $this->displayOptions;
+
+ if ($fmt = $options['fileLinkFormat']) {
+ return is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line);
+ }
+
+ return false;
+ }
+}
+
+function esc($str)
+{
+ return htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
}
diff --git a/htdocs/includes/symfony/var-dumper/LICENSE b/htdocs/includes/symfony/var-dumper/LICENSE
index ef1cde91a61..207646a052d 100644
--- a/htdocs/includes/symfony/var-dumper/LICENSE
+++ b/htdocs/includes/symfony/var-dumper/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2014-2015 Fabien Potencier
+Copyright (c) 2014-2017 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/htdocs/includes/symfony/var-dumper/README.md b/htdocs/includes/symfony/var-dumper/README.md
index 71bff335a70..3b5d55f5f5b 100644
--- a/htdocs/includes/symfony/var-dumper/README.md
+++ b/htdocs/includes/symfony/var-dumper/README.md
@@ -1,14 +1,15 @@
-Symfony mechanism for exploring and dumping PHP variables
-=========================================================
+VarDumper Component
+===================
-This component provides a mechanism that allows exploring then dumping
-any PHP variable.
+The VarDumper component provides mechanisms for walking through any arbitrary
+PHP variable. Built on top, it provides a better `dump()` function that you
+can use instead of `var_dump`.
-It handles scalars, objects and resources properly, taking hard and soft
-references into account. More than being immune to infinite recursion
-problems, it allows dumping where references link to each other.
-It explores recursive structures using a breadth-first algorithm.
+Resources
+---------
-The component exposes all the parts involved in the different steps of
-cloning then dumping a PHP variable, while applying size limits and having
-specialized output formats and methods.
+ * [Documentation](https://symfony.com/doc/current/components/var_dumper/introduction.html)
+ * [Contributing](https://symfony.com/doc/current/contributing/index.html)
+ * [Report issues](https://github.com/symfony/symfony/issues) and
+ [send Pull Requests](https://github.com/symfony/symfony/pulls)
+ in the [main Symfony repository](https://github.com/symfony/symfony)
diff --git a/htdocs/includes/symfony/var-dumper/Test/VarDumperTestTrait.php b/htdocs/includes/symfony/var-dumper/Test/VarDumperTestTrait.php
index e5f6bf5b98e..40ec83d1322 100644
--- a/htdocs/includes/symfony/var-dumper/Test/VarDumperTestTrait.php
+++ b/htdocs/includes/symfony/var-dumper/Test/VarDumperTestTrait.php
@@ -29,17 +29,20 @@ trait VarDumperTestTrait
$this->assertStringMatchesFormat(rtrim($dump), $this->getDump($data), $message);
}
- protected function getDump($data)
+ protected function getDump($data, $key = null)
{
- $h = fopen('php://memory', 'r+b');
+ $flags = getenv('DUMP_LIGHT_ARRAY') ? CliDumper::DUMP_LIGHT_ARRAY : 0;
+ $flags |= getenv('DUMP_STRING_LENGTH') ? CliDumper::DUMP_STRING_LENGTH : 0;
+
$cloner = new VarCloner();
$cloner->setMaxItems(-1);
- $dumper = new CliDumper($h);
+ $dumper = new CliDumper(null, null, $flags);
$dumper->setColors(false);
- $dumper->dump($cloner->cloneVar($data)->withRefHandles(false));
- $data = stream_get_contents($h, -1, 0);
- fclose($h);
+ $data = $cloner->cloneVar($data)->withRefHandles(false);
+ if (null !== $key && null === $data = $data->seek($key)) {
+ return;
+ }
- return rtrim($data);
+ return rtrim($dumper->dump($data, true));
}
}
diff --git a/htdocs/includes/symfony/var-dumper/Tests/Caster/CasterTest.php b/htdocs/includes/symfony/var-dumper/Tests/Caster/CasterTest.php
index 43d389ce1c0..105d5638ee1 100644
--- a/htdocs/includes/symfony/var-dumper/Tests/Caster/CasterTest.php
+++ b/htdocs/includes/symfony/var-dumper/Tests/Caster/CasterTest.php
@@ -11,13 +11,14 @@
namespace Symfony\Component\VarDumper\Tests\Caster;
+use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Caster\Caster;
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
/**
* @author Nicolas Grekas
*/
-class CasterTest extends \PHPUnit_Framework_TestCase
+class CasterTest extends TestCase
{
use VarDumperTestTrait;
diff --git a/htdocs/includes/symfony/var-dumper/Tests/Caster/ExceptionCasterTest.php b/htdocs/includes/symfony/var-dumper/Tests/Caster/ExceptionCasterTest.php
new file mode 100644
index 00000000000..e0fb177b4bb
--- /dev/null
+++ b/htdocs/includes/symfony/var-dumper/Tests/Caster/ExceptionCasterTest.php
@@ -0,0 +1,225 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\VarDumper\Tests\Caster;
+
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\VarDumper\Caster\ExceptionCaster;
+use Symfony\Component\VarDumper\Caster\FrameStub;
+use Symfony\Component\VarDumper\Cloner\VarCloner;
+use Symfony\Component\VarDumper\Dumper\HtmlDumper;
+use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
+
+class ExceptionCasterTest extends TestCase
+{
+ use VarDumperTestTrait;
+
+ private function getTestException($msg, &$ref = null)
+ {
+ return new \Exception(''.$msg);
+ }
+
+ protected function tearDown()
+ {
+ ExceptionCaster::$srcContext = 1;
+ ExceptionCaster::$traceArgs = true;
+ }
+
+ public function testDefaultSettings()
+ {
+ $ref = array('foo');
+ $e = $this->getTestException('foo', $ref);
+
+ $expectedDump = <<<'EODUMP'
+Exception {
+ #message: "foo"
+ #code: 0
+ #file: "%sExceptionCasterTest.php"
+ #line: 27
+ -trace: {
+ %sExceptionCasterTest.php:27: {
+ : {
+ : return new \Exception(''.$msg);
+ : }
+ }
+ %sExceptionCasterTest.php:%d: {
+ : $ref = array('foo');
+ : $e = $this->getTestException('foo', $ref);
+ :
+ arguments: {
+ $msg: "foo"
+ &$ref: array:1 [ …1]
+ }
+ }
+%A
+EODUMP;
+
+ $this->assertDumpMatchesFormat($expectedDump, $e);
+ $this->assertSame(array('foo'), $ref);
+ }
+
+ public function testSeek()
+ {
+ $e = $this->getTestException(2);
+
+ $expectedDump = <<<'EODUMP'
+{
+ %sExceptionCasterTest.php:27: {
+ : {
+ : return new \Exception(''.$msg);
+ : }
+ }
+ %sExceptionCasterTest.php:%d: {
+ : {
+ : $e = $this->getTestException(2);
+ :
+ arguments: {
+ $msg: 2
+ }
+ }
+%A
+EODUMP;
+
+ $this->assertStringMatchesFormat($expectedDump, $this->getDump($e, 'trace'));
+ }
+
+ public function testNoArgs()
+ {
+ $e = $this->getTestException(1);
+ ExceptionCaster::$traceArgs = false;
+
+ $expectedDump = <<<'EODUMP'
+Exception {
+ #message: "1"
+ #code: 0
+ #file: "%sExceptionCasterTest.php"
+ #line: 27
+ -trace: {
+ %sExceptionCasterTest.php:27: {
+ : {
+ : return new \Exception(''.$msg);
+ : }
+ }
+ %sExceptionCasterTest.php:%d: {
+ : {
+ : $e = $this->getTestException(1);
+ : ExceptionCaster::$traceArgs = false;
+ }
+%A
+EODUMP;
+
+ $this->assertDumpMatchesFormat($expectedDump, $e);
+ }
+
+ public function testNoSrcContext()
+ {
+ $e = $this->getTestException(1);
+ ExceptionCaster::$srcContext = -1;
+
+ $expectedDump = <<<'EODUMP'
+Exception {
+ #message: "1"
+ #code: 0
+ #file: "%sExceptionCasterTest.php"
+ #line: 27
+ -trace: {
+ %sExceptionCasterTest.php: 27
+ %sExceptionCasterTest.php: %d
+%A
+EODUMP;
+
+ $this->assertDumpMatchesFormat($expectedDump, $e);
+ }
+
+ public function testHtmlDump()
+ {
+ $e = $this->getTestException(1);
+ ExceptionCaster::$srcContext = -1;
+
+ $cloner = new VarCloner();
+ $cloner->setMaxItems(1);
+ $dumper = new HtmlDumper();
+ $dumper->setDumpHeader(' ');
+ $dumper->setDumpBoundaries('', ' ');
+ $dump = $dumper->dump($cloner->cloneVar($e)->withRefHandles(false), true);
+
+ $expectedDump = <<<'EODUMP'
+Exception {
+ #message : "1 "
+ #code : 0
+ #file : "%sTests %eCaster%eExceptionCasterTest.php "
+ #line : 27
+ -trace : {
+ %sVarDumper%eTests %eCaster%eExceptionCasterTest.php : 27
+ …%d
+ }
+ }
+
+EODUMP;
+
+ $this->assertStringMatchesFormat($expectedDump, $dump);
+ }
+
+ /**
+ * @requires function Twig\Template::getSourceContext
+ */
+ public function testFrameWithTwig()
+ {
+ require_once dirname(__DIR__).'/Fixtures/Twig.php';
+
+ $f = array(
+ new FrameStub(array(
+ 'file' => dirname(__DIR__).'/Fixtures/Twig.php',
+ 'line' => 20,
+ 'class' => '__TwigTemplate_VarDumperFixture_u75a09',
+ )),
+ new FrameStub(array(
+ 'file' => dirname(__DIR__).'/Fixtures/Twig.php',
+ 'line' => 21,
+ 'class' => '__TwigTemplate_VarDumperFixture_u75a09',
+ 'object' => new \__TwigTemplate_VarDumperFixture_u75a09(null, __FILE__),
+ )),
+ );
+
+ $expectedDump = <<<'EODUMP'
+array:2 [
+ 0 => {
+ class: "__TwigTemplate_VarDumperFixture_u75a09"
+ src: {
+ %sTwig.php:1: {
+ :
+ : foo bar
+ : twig source
+ }
+ }
+ }
+ 1 => {
+ class: "__TwigTemplate_VarDumperFixture_u75a09"
+ object: __TwigTemplate_VarDumperFixture_u75a09 {
+ %A
+ }
+ src: {
+ %sExceptionCasterTest.php:2: {
+ : foo bar
+ : twig source
+ :
+ }
+ }
+ }
+]
+
+EODUMP;
+
+ $this->assertDumpMatchesFormat($expectedDump, $f);
+ }
+}
diff --git a/htdocs/includes/symfony/var-dumper/Tests/Caster/PdoCasterTest.php b/htdocs/includes/symfony/var-dumper/Tests/Caster/PdoCasterTest.php
index faa65341170..000e5feeb12 100644
--- a/htdocs/includes/symfony/var-dumper/Tests/Caster/PdoCasterTest.php
+++ b/htdocs/includes/symfony/var-dumper/Tests/Caster/PdoCasterTest.php
@@ -11,14 +11,18 @@
namespace Symfony\Component\VarDumper\Tests\Caster;
+use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Caster\PdoCaster;
use Symfony\Component\VarDumper\Cloner\Stub;
+use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
/**
* @author Nicolas Grekas
*/
-class PdoCasterTest extends \PHPUnit_Framework_TestCase
+class PdoCasterTest extends TestCase
{
+ use VarDumperTestTrait;
+
/**
* @requires extension pdo_sqlite
*/
@@ -36,22 +40,25 @@ class PdoCasterTest extends \PHPUnit_Framework_TestCase
$this->assertSame('NATURAL', $attr['CASE']->class);
$this->assertSame('BOTH', $attr['DEFAULT_FETCH_MODE']->class);
- $xCast = array(
- "\0~\0inTransaction" => $pdo->inTransaction(),
- "\0~\0attributes" => array(
- 'CASE' => $attr['CASE'],
- 'ERRMODE' => $attr['ERRMODE'],
- 'PERSISTENT' => false,
- 'DRIVER_NAME' => 'sqlite',
- 'ORACLE_NULLS' => $attr['ORACLE_NULLS'],
- 'CLIENT_VERSION' => $pdo->getAttribute(\PDO::ATTR_CLIENT_VERSION),
- 'SERVER_VERSION' => $pdo->getAttribute(\PDO::ATTR_SERVER_VERSION),
- 'STATEMENT_CLASS' => array('PDOStatement'),
- 'DEFAULT_FETCH_MODE' => $attr['DEFAULT_FETCH_MODE'],
- ),
- );
- unset($cast["\0~\0attributes"]['STATEMENT_CLASS'][1]);
+ $xDump = <<<'EODUMP'
+array:2 [
+ "\x00~\x00inTransaction" => false
+ "\x00~\x00attributes" => array:9 [
+ "CASE" => NATURAL
+ "ERRMODE" => SILENT
+ "PERSISTENT" => false
+ "DRIVER_NAME" => "sqlite"
+ "ORACLE_NULLS" => NATURAL
+ "CLIENT_VERSION" => "%s"
+ "SERVER_VERSION" => "%s"
+ "STATEMENT_CLASS" => array:%d [
+ 0 => "PDOStatement"%A
+ ]
+ "DEFAULT_FETCH_MODE" => BOTH
+ ]
+]
+EODUMP;
- $this->assertSame($xCast, $cast);
+ $this->assertDumpMatchesFormat($xDump, $cast);
}
}
diff --git a/htdocs/includes/symfony/var-dumper/Tests/Caster/RedisCasterTest.php b/htdocs/includes/symfony/var-dumper/Tests/Caster/RedisCasterTest.php
new file mode 100644
index 00000000000..af038192f5c
--- /dev/null
+++ b/htdocs/includes/symfony/var-dumper/Tests/Caster/RedisCasterTest.php
@@ -0,0 +1,85 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\VarDumper\Tests\Caster;
+
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
+
+/**
+ * @author Nicolas Grekas
+ * @requires extension redis
+ */
+class RedisCasterTest extends TestCase
+{
+ use VarDumperTestTrait;
+
+ public function testNotConnected()
+ {
+ $redis = new \Redis();
+
+ if (defined('HHVM_VERSION_ID')) {
+ $xCast = <<<'EODUMP'
+Redis {
+ #host: ""
+%A
+}
+EODUMP;
+ } else {
+ $xCast = <<<'EODUMP'
+Redis {
+ isConnected: false
+}
+EODUMP;
+ }
+
+ $this->assertDumpMatchesFormat($xCast, $redis);
+ }
+
+ public function testConnected()
+ {
+ $redis = new \Redis();
+ if (!@$redis->connect('127.0.0.1')) {
+ $e = error_get_last();
+ self::markTestSkipped($e['message']);
+ }
+
+ if (defined('HHVM_VERSION_ID')) {
+ $xCast = <<<'EODUMP'
+Redis {
+ #host: "127.0.0.1"
+%A
+}
+EODUMP;
+ } else {
+ $xCast = <<<'EODUMP'
+Redis {
+ +"socket": Redis Socket Buffer resource
+ isConnected: true
+ host: "127.0.0.1"
+ port: 6379
+ auth: null
+ dbNum: 0
+ timeout: 0.0
+ persistentId: null
+ options: {
+ READ_TIMEOUT: 0.0
+ SERIALIZER: NONE
+ PREFIX: null
+ SCAN: NORETRY
+ }
+}
+EODUMP;
+ }
+
+ $this->assertDumpMatchesFormat($xCast, $redis);
+ }
+}
diff --git a/htdocs/includes/symfony/var-dumper/Tests/Caster/ReflectionCasterTest.php b/htdocs/includes/symfony/var-dumper/Tests/Caster/ReflectionCasterTest.php
index 0d7147fbcd2..5495a78e40f 100644
--- a/htdocs/includes/symfony/var-dumper/Tests/Caster/ReflectionCasterTest.php
+++ b/htdocs/includes/symfony/var-dumper/Tests/Caster/ReflectionCasterTest.php
@@ -11,13 +11,15 @@
namespace Symfony\Component\VarDumper\Tests\Caster;
+use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
use Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo;
+use Symfony\Component\VarDumper\Tests\Fixtures\NotLoadableClass;
/**
* @author Nicolas Grekas
*/
-class ReflectionCasterTest extends \PHPUnit_Framework_TestCase
+class ReflectionCasterTest extends TestCase
{
use VarDumperTestTrait;
@@ -49,7 +51,7 @@ ReflectionClass {
"export" => ReflectionMethod {
+name: "export"
+class: "ReflectionClass"
- parameters: {
+%A parameters: {
$%s: ReflectionParameter {
%A position: 0
%A
@@ -75,7 +77,7 @@ Closure {
\$b: & 123
}
file: "%sReflectionCasterTest.php"
- line: "65 to 65"
+ line: "67 to 67"
}
EOTXT
, $var
@@ -91,7 +93,7 @@ EOTXT
ReflectionParameter {
+name: "arg1"
position: 0
- typeHint: "Symfony\Component\VarDumper\Tests\Caster\NotExistingClass"
+ typeHint: "Symfony\Component\VarDumper\Tests\Fixtures\NotLoadableClass"
default: null
}
EOTXT
@@ -146,83 +148,88 @@ EOTXT
*/
public function testGenerator()
{
- $g = new GeneratorDemo();
- $g = $g->baz();
- $r = new \ReflectionGenerator($g);
+ if (extension_loaded('xdebug')) {
+ $this->markTestSkipped('xdebug is active');
+ }
- $xDump = <<<'EODUMP'
+ $generator = new GeneratorDemo();
+ $generator = $generator->baz();
+
+ $expectedDump = <<<'EODUMP'
Generator {
this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …}
executing: {
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz(): {
- %sGeneratorDemo.php:14: """
- {\n
- yield from bar();\n
- }\n
- """
+ %sGeneratorDemo.php:14: {
+ : {
+ : yield from bar();
+ : }
+ }
}
}
+ closed: false
}
EODUMP;
- $this->assertDumpMatchesFormat($xDump, $g);
+ $this->assertDumpMatchesFormat($expectedDump, $generator);
- foreach ($g as $v) {
+ foreach ($generator as $v) {
break;
}
- $xDump = <<<'EODUMP'
+ $expectedDump = <<<'EODUMP'
array:2 [
0 => ReflectionGenerator {
this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …}
trace: {
- 3. Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo() ==> yield(): {
- src: {
- %sGeneratorDemo.php:9: """
- {\n
- yield 1;\n
- }\n
- """
- }
+ %sGeneratorDemo.php:9: {
+ : {
+ : yield 1;
+ : }
}
- 2. Symfony\Component\VarDumper\Tests\Fixtures\bar() ==> Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo(): {
- src: {
- %sGeneratorDemo.php:20: """
- {\n
- yield from GeneratorDemo::foo();\n
- }\n
- """
- }
+ %sGeneratorDemo.php:20: {
+ : {
+ : yield from GeneratorDemo::foo();
+ : }
}
- 1. Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz() ==> Symfony\Component\VarDumper\Tests\Fixtures\bar(): {
- src: {
- %sGeneratorDemo.php:14: """
- {\n
- yield from bar();\n
- }\n
- """
- }
+ %sGeneratorDemo.php:14: {
+ : {
+ : yield from bar();
+ : }
}
}
+ closed: false
}
1 => Generator {
executing: {
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo(): {
- %sGeneratorDemo.php:10: """
- yield 1;\n
- }\n
- \n
- """
+ %sGeneratorDemo.php:10: {
+ : yield 1;
+ : }
+ :
+ }
}
}
+ closed: false
}
]
EODUMP;
- $this->assertDumpMatchesFormat($xDump, array($r, $r->getExecutingGenerator()));
+ $r = new \ReflectionGenerator($generator);
+ $this->assertDumpMatchesFormat($expectedDump, array($r, $r->getExecutingGenerator()));
+
+ foreach ($generator as $v) {
+ }
+
+ $expectedDump = <<<'EODUMP'
+Generator {
+ closed: true
+}
+EODUMP;
+ $this->assertDumpMatchesFormat($expectedDump, $generator);
}
}
-function reflectionParameterFixture(NotExistingClass $arg1 = null, $arg2)
+function reflectionParameterFixture(NotLoadableClass $arg1 = null, $arg2)
{
}
diff --git a/htdocs/includes/symfony/var-dumper/Tests/Caster/SplCasterTest.php b/htdocs/includes/symfony/var-dumper/Tests/Caster/SplCasterTest.php
index 5d71e8d379d..e2181d90b5b 100644
--- a/htdocs/includes/symfony/var-dumper/Tests/Caster/SplCasterTest.php
+++ b/htdocs/includes/symfony/var-dumper/Tests/Caster/SplCasterTest.php
@@ -11,12 +11,13 @@
namespace Symfony\Component\VarDumper\Tests\Caster;
+use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
/**
* @author Grégoire Pineau
*/
-class SplCasterTest extends \PHPUnit_Framework_TestCase
+class SplCasterTest extends TestCase
{
use VarDumperTestTrait;
@@ -57,12 +58,6 @@ SplFileInfo {
pathname: "https://google.com/about"
extension: ""
realPath: false
- writable: false
- readable: false
- executable: false
- file: false
- dir: false
- link: false
%A}
EOTXT
),
@@ -102,10 +97,10 @@ SplFileObject {
file: true
dir: false
link: false
-%AcsvControl: array:2 [
+%AcsvControl: array:%d [
0 => ","
1 => """
- ]
+%A]
flags: DROP_NEW_LINE|SKIP_EMPTY
maxLineLen: 0
fstat: array:26 [
@@ -123,4 +118,30 @@ SplFileObject {
EOTXT;
$this->assertDumpMatchesFormat($dump, $var);
}
+
+ /**
+ * @dataProvider provideCastSplDoublyLinkedList
+ */
+ public function testCastSplDoublyLinkedList($modeValue, $modeDump)
+ {
+ $var = new \SplDoublyLinkedList();
+ $var->setIteratorMode($modeValue);
+ $dump = <<assertDumpMatchesFormat($dump, $var);
+ }
+
+ public function provideCastSplDoublyLinkedList()
+ {
+ return array(
+ array(\SplDoublyLinkedList::IT_MODE_FIFO, 'IT_MODE_FIFO | IT_MODE_KEEP'),
+ array(\SplDoublyLinkedList::IT_MODE_LIFO, 'IT_MODE_LIFO | IT_MODE_KEEP'),
+ array(\SplDoublyLinkedList::IT_MODE_FIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_FIFO | IT_MODE_DELETE'),
+ array(\SplDoublyLinkedList::IT_MODE_LIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_LIFO | IT_MODE_DELETE'),
+ );
+ }
}
diff --git a/htdocs/includes/symfony/var-dumper/Tests/Caster/StubCasterTest.php b/htdocs/includes/symfony/var-dumper/Tests/Caster/StubCasterTest.php
new file mode 100644
index 00000000000..c626b595f83
--- /dev/null
+++ b/htdocs/includes/symfony/var-dumper/Tests/Caster/StubCasterTest.php
@@ -0,0 +1,171 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\VarDumper\Tests\Caster;
+
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\VarDumper\Caster\ArgsStub;
+use Symfony\Component\VarDumper\Caster\ClassStub;
+use Symfony\Component\VarDumper\Caster\LinkStub;
+use Symfony\Component\VarDumper\Cloner\VarCloner;
+use Symfony\Component\VarDumper\Dumper\HtmlDumper;
+use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
+use Symfony\Component\VarDumper\Tests\Fixtures\FooInterface;
+
+class StubCasterTest extends TestCase
+{
+ use VarDumperTestTrait;
+
+ public function testArgsStubWithDefaults($foo = 234, $bar = 456)
+ {
+ $args = array(new ArgsStub(array(123), __FUNCTION__, __CLASS__));
+
+ $expectedDump = <<<'EODUMP'
+array:1 [
+ 0 => {
+ $foo: 123
+ }
+]
+EODUMP;
+
+ $this->assertDumpMatchesFormat($expectedDump, $args);
+ }
+
+ public function testArgsStubWithExtraArgs($foo = 234)
+ {
+ $args = array(new ArgsStub(array(123, 456), __FUNCTION__, __CLASS__));
+
+ $expectedDump = <<<'EODUMP'
+array:1 [
+ 0 => {
+ $foo: 123
+ ...: {
+ 456
+ }
+ }
+]
+EODUMP;
+
+ $this->assertDumpMatchesFormat($expectedDump, $args);
+ }
+
+ public function testArgsStubNoParamWithExtraArgs()
+ {
+ $args = array(new ArgsStub(array(123), __FUNCTION__, __CLASS__));
+
+ $expectedDump = <<<'EODUMP'
+array:1 [
+ 0 => {
+ 123
+ }
+]
+EODUMP;
+
+ $this->assertDumpMatchesFormat($expectedDump, $args);
+ }
+
+ public function testArgsStubWithClosure()
+ {
+ $args = array(new ArgsStub(array(123), '{closure}', null));
+
+ $expectedDump = <<<'EODUMP'
+array:1 [
+ 0 => {
+ 123
+ }
+]
+EODUMP;
+
+ $this->assertDumpMatchesFormat($expectedDump, $args);
+ }
+
+ public function testLinkStub()
+ {
+ $var = array(new LinkStub(__CLASS__, 0, __FILE__));
+
+ $cloner = new VarCloner();
+ $dumper = new HtmlDumper();
+ $dumper->setDumpHeader(' ');
+ $dumper->setDumpBoundaries('', ' ');
+ $dumper->setDisplayOptions(array('fileLinkFormat' => '%f:%l'));
+ $dump = $dumper->dump($cloner->cloneVar($var), true);
+
+ $expectedDump = <<<'EODUMP'
+array:1 [
+ 0 => "Symfony\Component\VarDumper\Tests\Caster\StubCasterTest "
+ ]
+
+EODUMP;
+
+ $this->assertStringMatchesFormat($expectedDump, $dump);
+ }
+
+ public function testClassStub()
+ {
+ $var = array(new ClassStub('hello', array(FooInterface::class, 'foo')));
+
+ $cloner = new VarCloner();
+ $dumper = new HtmlDumper();
+ $dumper->setDumpHeader(' ');
+ $dumper->setDumpBoundaries('', ' ');
+ $dump = $dumper->dump($cloner->cloneVar($var), true, array('fileLinkFormat' => '%f:%l'));
+
+ $expectedDump = <<<'EODUMP'
+array:1 [
+ 0 => "hello "
+ ]
+
+EODUMP;
+
+ $this->assertStringMatchesFormat($expectedDump, $dump);
+ }
+
+ public function testClassStubWithNotExistingClass()
+ {
+ $var = array(new ClassStub(NotExisting::class));
+
+ $cloner = new VarCloner();
+ $dumper = new HtmlDumper();
+ $dumper->setDumpHeader(' ');
+ $dumper->setDumpBoundaries('', ' ');
+ $dump = $dumper->dump($cloner->cloneVar($var), true);
+
+ $expectedDump = <<<'EODUMP'
+array:1 [
+ 0 => "Symfony\Component\VarDumper\Tests\Caster \NotExisting "
+ ]
+
+EODUMP;
+
+ $this->assertStringMatchesFormat($expectedDump, $dump);
+ }
+
+ public function testClassStubWithNotExistingMethod()
+ {
+ $var = array(new ClassStub('hello', array(FooInterface::class, 'missing')));
+
+ $cloner = new VarCloner();
+ $dumper = new HtmlDumper();
+ $dumper->setDumpHeader(' ');
+ $dumper->setDumpBoundaries('', ' ');
+ $dump = $dumper->dump($cloner->cloneVar($var), true, array('fileLinkFormat' => '%f:%l'));
+
+ $expectedDump = <<<'EODUMP'
+array:1 [
+ 0 => "hello "
+ ]
+
+EODUMP;
+
+ $this->assertStringMatchesFormat($expectedDump, $dump);
+ }
+}
diff --git a/htdocs/includes/symfony/var-dumper/Tests/Caster/XmlReaderCasterTest.php b/htdocs/includes/symfony/var-dumper/Tests/Caster/XmlReaderCasterTest.php
new file mode 100644
index 00000000000..374d298af16
--- /dev/null
+++ b/htdocs/includes/symfony/var-dumper/Tests/Caster/XmlReaderCasterTest.php
@@ -0,0 +1,248 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\VarDumper\Tests\Caster;
+
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
+
+/**
+ * @author Baptiste Clavié
+ */
+class XmlReaderCasterTest extends TestCase
+{
+ use VarDumperTestTrait;
+
+ /** @var \XmlReader */
+ private $reader;
+
+ protected function setUp()
+ {
+ $this->reader = new \XmlReader();
+ $this->reader->open(__DIR__.'/../Fixtures/xml_reader.xml');
+ }
+
+ protected function tearDown()
+ {
+ $this->reader->close();
+ }
+
+ public function testParserProperty()
+ {
+ $this->reader->setParserProperty(\XMLReader::SUBST_ENTITIES, true);
+
+ $expectedDump = <<<'EODUMP'
+XMLReader {
+ +nodeType: NONE
+ parserProperties: {
+ SUBST_ENTITIES: true
+ …3
+ }
+ …12
+}
+EODUMP;
+
+ $this->assertDumpMatchesFormat($expectedDump, $this->reader);
+ }
+
+ /**
+ * @dataProvider provideNodes
+ */
+ public function testNodes($seek, $expectedDump)
+ {
+ while ($seek--) {
+ $this->reader->read();
+ }
+ $this->assertDumpMatchesFormat($expectedDump, $this->reader);
+ }
+
+ public function provideNodes()
+ {
+ return array(
+ array(0, <<<'EODUMP'
+XMLReader {
+ +nodeType: NONE
+ …13
+}
+EODUMP
+ ),
+ array(1, <<<'EODUMP'
+XMLReader {
+ +localName: "foo"
+ +nodeType: ELEMENT
+ +baseURI: "%sxml_reader.xml"
+ …11
+}
+EODUMP
+ ),
+ array(2, <<<'EODUMP'
+XMLReader {
+ +localName: "#text"
+ +nodeType: SIGNIFICANT_WHITESPACE
+ +depth: 1
+ +value: """
+ \n
+
+ """
+ +baseURI: "%sxml_reader.xml"
+ …9
+}
+EODUMP
+ ),
+ array(3, <<<'EODUMP'
+XMLReader {
+ +localName: "bar"
+ +nodeType: ELEMENT
+ +depth: 1
+ +baseURI: "%sxml_reader.xml"
+ …10
+}
+EODUMP
+ ),
+ array(4, <<<'EODUMP'
+XMLReader {
+ +localName: "bar"
+ +nodeType: END_ELEMENT
+ +depth: 1
+ +baseURI: "%sxml_reader.xml"
+ …10
+}
+EODUMP
+ ),
+ array(6, <<<'EODUMP'
+XMLReader {
+ +localName: "bar"
+ +nodeType: ELEMENT
+ +depth: 1
+ +isEmptyElement: true
+ +baseURI: "%sxml_reader.xml"
+ …9
+}
+EODUMP
+ ),
+ array(9, <<<'EODUMP'
+XMLReader {
+ +localName: "#text"
+ +nodeType: TEXT
+ +depth: 2
+ +value: "With text"
+ +baseURI: "%sxml_reader.xml"
+ …9
+}
+EODUMP
+ ),
+ array(12, <<<'EODUMP'
+XMLReader {
+ +localName: "bar"
+ +nodeType: ELEMENT
+ +depth: 1
+ +attributeCount: 2
+ +baseURI: "%sxml_reader.xml"
+ …9
+}
+EODUMP
+ ),
+ array(13, <<<'EODUMP'
+XMLReader {
+ +localName: "bar"
+ +nodeType: END_ELEMENT
+ +depth: 1
+ +baseURI: "%sxml_reader.xml"
+ …10
+}
+EODUMP
+ ),
+ array(15, <<<'EODUMP'
+XMLReader {
+ +localName: "bar"
+ +nodeType: ELEMENT
+ +depth: 1
+ +attributeCount: 1
+ +baseURI: "%sxml_reader.xml"
+ …9
+}
+EODUMP
+ ),
+ array(16, <<<'EODUMP'
+XMLReader {
+ +localName: "#text"
+ +nodeType: SIGNIFICANT_WHITESPACE
+ +depth: 2
+ +value: """
+ \n
+
+ """
+ +baseURI: "%sxml_reader.xml"
+ …9
+}
+EODUMP
+ ),
+ array(17, <<<'EODUMP'
+XMLReader {
+ +localName: "baz"
+ +prefix: "baz"
+ +nodeType: ELEMENT
+ +depth: 2
+ +namespaceURI: "http://symfony.com"
+ +baseURI: "%sxml_reader.xml"
+ …8
+}
+EODUMP
+ ),
+ array(18, <<<'EODUMP'
+XMLReader {
+ +localName: "baz"
+ +prefix: "baz"
+ +nodeType: END_ELEMENT
+ +depth: 2
+ +namespaceURI: "http://symfony.com"
+ +baseURI: "%sxml_reader.xml"
+ …8
+}
+EODUMP
+ ),
+ array(19, <<<'EODUMP'
+XMLReader {
+ +localName: "#text"
+ +nodeType: SIGNIFICANT_WHITESPACE
+ +depth: 2
+ +value: """
+ \n
+
+ """
+ +baseURI: "%sxml_reader.xml"
+ …9
+}
+EODUMP
+ ),
+ array(21, <<<'EODUMP'
+XMLReader {
+ +localName: "#text"
+ +nodeType: SIGNIFICANT_WHITESPACE
+ +depth: 1
+ +value: "\n"
+ +baseURI: "%sxml_reader.xml"
+ …9
+}
+EODUMP
+ ),
+ array(22, <<<'EODUMP'
+XMLReader {
+ +localName: "foo"
+ +nodeType: END_ELEMENT
+ +baseURI: "%sxml_reader.xml"
+ …11
+}
+EODUMP
+ ),
+ );
+ }
+}
diff --git a/htdocs/includes/symfony/var-dumper/Tests/CliDumperTest.php b/htdocs/includes/symfony/var-dumper/Tests/CliDumperTest.php
index cd6d64d1c03..1e0809c1fbd 100644
--- a/htdocs/includes/symfony/var-dumper/Tests/CliDumperTest.php
+++ b/htdocs/includes/symfony/var-dumper/Tests/CliDumperTest.php
@@ -11,14 +11,17 @@
namespace Symfony\Component\VarDumper\Tests;
+use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Cloner\VarCloner;
use Symfony\Component\VarDumper\Dumper\CliDumper;
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
+use Twig\Environment;
+use Twig\Loader\FilesystemLoader;
/**
* @author Nicolas Grekas
*/
-class CliDumperTest extends \PHPUnit_Framework_TestCase
+class CliDumperTest extends TestCase
{
use VarDumperTestTrait;
@@ -62,15 +65,12 @@ array:24 [
7 => b"é\\x00"
"[]" => []
"res" => stream resource {@{$res}
- wrapper_type: "plainfile"
+%A wrapper_type: "plainfile"
stream_type: "STDIO"
mode: "r"
unread_bytes: 0
seekable: true
- timed_out: false
- blocked: true
- eof: false
- options: []
+%A options: []
}
"obj" => Symfony\Component\VarDumper\Tests\Fixture\DumbFoo {#%d
+foo: "foo"
@@ -118,7 +118,7 @@ EOTXT
$var = xml_parser_create();
$this->assertDumpMatchesFormat(
- <<= 70200) {
+ $this->assertDumpMatchesFormat(
+ <<<'EOTXT'
+array:4 [
+ 0 => {}
+ 1 => &1 null
+ 2 => &1 null
+ "" => 2
+]
+EOTXT
+ ,
+ $var
+ );
+ } else {
+ $this->assertDumpMatchesFormat(
+ <<<'EOTXT'
+array:4 [
+ "0" => {}
+ "1" => &1 null
+ 0 => &1 null
+ "" => 2
+]
+EOTXT
+ ,
+ $var
+ );
+ }
+ }
+
+ public function testObjectCast()
+ {
+ $var = (object) array(1 => 1);
+ $var->{1} = 2;
+
+ if (\PHP_VERSION_ID >= 70200) {
+ $this->assertDumpMatchesFormat(
+ <<<'EOTXT'
+{
+ +"1": 2
+}
+EOTXT
+ ,
+ $var
+ );
+ } else {
+ $this->assertDumpMatchesFormat(
+ <<<'EOTXT'
+{
+ +1: 1
+ +"1": 2
+}
+EOTXT
+ ,
+ $var
+ );
+ }
+ }
+
public function testClosedResource()
{
if (defined('HHVM_VERSION') && HHVM_VERSION_ID < 30600) {
@@ -152,7 +218,7 @@ EOTXT
$this->assertStringMatchesFormat(
<< 'bar'),
+ );
+
+ $this->assertDumpEquals(
+ << (3) "foo"
+ 2 => (3) "bar"
+ ]
+]
+EOTXT
+ ,
+ $var
+ );
+
+ putenv('DUMP_LIGHT_ARRAY=');
+ putenv('DUMP_STRING_LENGTH=');
+ }
+
+ /**
+ * @requires function Twig\Template::getSourceContext
+ */
public function testThrowingCaster()
{
$out = fopen('php://memory', 'r+b');
require_once __DIR__.'/Fixtures/Twig.php';
- $twig = new \__TwigTemplate_VarDumperFixture_u75a09(new \Twig_Environment(new \Twig_Loader_Filesystem()));
+ $twig = new \__TwigTemplate_VarDumperFixture_u75a09(new Environment(new FilesystemLoader()));
$dumper = new CliDumper();
$dumper->setColors(false);
@@ -181,96 +282,56 @@ EOTXT
':stream' => eval('return function () use ($twig) {
try {
$twig->render(array());
- } catch (\Twig_Error_Runtime $e) {
+ } catch (\Twig\Error\RuntimeError $e) {
throw $e->getPrevious();
}
};'),
));
- $line = __LINE__ - 2;
$ref = (int) $out;
$data = $cloner->cloneVar($out);
$dumper->dump($data, $out);
- rewind($out);
- $out = stream_get_contents($out);
-
- if (method_exists($twig, 'getSource')) {
- $twig = <<assertStringMatchesFormat(
<<doDisplay(\$context, \$blocks);
+ : } catch (Twig%sError \$e) {
+ }
+ %sTemplate.php:%d: {
+ : {
+ : \$this->displayWithErrorHandling(\$this->env->mergeGlobals(\$context), array_merge(\$this->blocks, \$blocks));
+ : }
+ }
+ %sTemplate.php:%d: {
+ : try {
+ : \$this->display(\$context);
+ : } catch (%s \$e) {
+ }
+ %sCliDumperTest.php:%d: {
+%A
+ }
+ }
+ }
+%Awrapper_type: "PHP"
stream_type: "MEMORY"
mode: "%s+b"
unread_bytes: 0
seekable: true
uri: "php://memory"
- timed_out: false
- blocked: true
- eof: false
- options: []
- ⚠: Symfony\Component\VarDumper\Exception\ThrowingCasterException {{$r}
- #message: "Unexpected Exception thrown from a caster: Foobar"
- -trace: {
- %d. __TwigTemplate_VarDumperFixture_u75a09->doDisplay() ==> new Exception(): {
- src: {
- %sTwig.php:19: """
- // line 2\\n
- throw new \Exception('Foobar');\\n
- }\\n
- """
-{$twig} }
- }
- %d. Twig_Template->displayWithErrorHandling() ==> __TwigTemplate_VarDumperFixture_u75a09->doDisplay(): {
- src: {
- %sTemplate.php:%d: """
- try {\\n
- \$this->doDisplay(\$context, \$blocks);\\n
- } catch (Twig_Error \$e) {\\n
- """
- }
- }
- %d. Twig_Template->display() ==> Twig_Template->displayWithErrorHandling(): {
- src: {
- %sTemplate.php:%d: """
- {\\n
- \$this->displayWithErrorHandling(\$this->env->mergeGlobals(\$context), array_merge(\$this->blocks, \$blocks));\\n
- }\\n
- """
- }
- }
- %d. Twig_Template->render() ==> Twig_Template->display(): {
- src: {
- %sTemplate.php:%d: """
- try {\\n
- \$this->display(\$context);\\n
- } catch (Exception \$e) {\\n
- """
- }
- }
- %d. %slosure%s() ==> Twig_Template->render(): {
- src: {
- %sCliDumperTest.php:{$line}: """
- }\\n
- };'),\\n
- ));\\n
- """
- }
- }
- }
- }
+%Aoptions: []
}
EOTXT
@@ -288,11 +349,8 @@ EOTXT
$dumper->setColors(false);
$cloner = new VarCloner();
- $out = fopen('php://memory', 'r+b');
$data = $cloner->cloneVar($var);
- $dumper->dump($data, $out);
- rewind($out);
- $out = stream_get_contents($out);
+ $out = $dumper->dump($data, true);
$r = defined('HHVM_VERSION') ? '' : '#%d';
$this->assertStringMatchesFormat(
@@ -318,7 +376,7 @@ EOTXT
$var = $this->getSpecialVars();
$this->assertDumpEquals(
- << array:1 [
0 => &1 array:1 [
@@ -364,7 +422,7 @@ EOTXT
$dumper->dump($data);
$this->assertSame(
- << array:1 [
"GLOBALS" => &1 array:1 [
@@ -386,7 +444,7 @@ EOTXT
*/
public function testBuggyRefs()
{
- if (PHP_VERSION_ID >= 50600) {
+ if (\PHP_VERSION_ID >= 50600) {
$this->markTestSkipped('PHP 5.6 fixed refs counting');
}
@@ -406,7 +464,7 @@ EOTXT
});
$this->assertSame(
- << array:1 [
0 => array:1 [
@@ -421,6 +479,21 @@ EOTXT
);
}
+ public function testIncompleteClass()
+ {
+ $unserializeCallbackHandler = ini_set('unserialize_callback_func', null);
+ $var = unserialize('O:8:"Foo\Buzz":0:{}');
+ ini_set('unserialize_callback_func', $unserializeCallbackHandler);
+
+ $this->assertDumpMatchesFormat(
+ <<parent = false;
-
- $this->blocks = array(
- );
+ $this->blocks = array();
+ $this->path = $path;
}
protected function doDisplay(array $context, array $blocks = array())
@@ -26,9 +28,11 @@ class __TwigTemplate_VarDumperFixture_u75a09 extends Twig_Template
public function getDebugInfo()
{
- return array (19 => 2);
+ return array(20 => 1, 21 => 2);
+ }
+
+ public function getSourceContext()
+ {
+ return new Twig\Source(" foo bar\n twig source\n\n", 'foo.twig', $this->path ?: __FILE__);
}
}
-/* foo bar*/
-/* twig source*/
-/* */
diff --git a/htdocs/includes/symfony/var-dumper/Tests/Fixtures/xml_reader.xml b/htdocs/includes/symfony/var-dumper/Tests/Fixtures/xml_reader.xml
new file mode 100644
index 00000000000..740c399fc44
--- /dev/null
+++ b/htdocs/includes/symfony/var-dumper/Tests/Fixtures/xml_reader.xml
@@ -0,0 +1,10 @@
+
+
+
+
+ With text
+
+
+
+
+
diff --git a/htdocs/includes/symfony/var-dumper/Tests/HtmlDumperTest.php b/htdocs/includes/symfony/var-dumper/Tests/HtmlDumperTest.php
index 3090435c5d4..24b4bf6d283 100644
--- a/htdocs/includes/symfony/var-dumper/Tests/HtmlDumperTest.php
+++ b/htdocs/includes/symfony/var-dumper/Tests/HtmlDumperTest.php
@@ -11,13 +11,14 @@
namespace Symfony\Component\VarDumper\Tests;
+use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Cloner\VarCloner;
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
/**
* @author Nicolas Grekas
*/
-class HtmlDumperTest extends \PHPUnit_Framework_TestCase
+class HtmlDumperTest extends TestCase
{
public function testGet()
{
@@ -59,26 +60,24 @@ class HtmlDumperTest extends \PHPUnit_Framework_TestCase
4 => INF
5 => -INF
6 => {$intMax}
- "str " => "d&%s;j&%s; \\n"
- 7 => b"&%s; \\x00"
+ "str " => "d&%s;j&%s;\\n "
+ 7 => b"&%s;\\x00 "
"[] " => []
"res " => stream resource @{$res}
- wrapper_type : "plainfile "
+%A wrapper_type : "plainfile "
stream_type : "STDIO "
mode : "r "
unread_bytes : 0
seekable : true
- timed_out : false
- blocked : true
- eof : false
- options : []
+%A options : []
}
"obj " => DumbFoo {#%d
+foo : "foo "
+"bar ": "bar "
}
"closure " => Closure {{$r}
- class : "Symfony\Component\VarDumper\Tests\HtmlDumperTest "
+ class : "Symfony\Component\VarDumper\Tests \HtmlDumperTest "
this : HtmlDumperTest {{$r} &%s;}
parameters : {
\$a : {}
@@ -87,7 +86,8 @@ class HtmlDumperTest extends \PHPUnit_Framework_TestCase
default : null
}
}
- file : "{$var['file']} "
+ file : "%sTests %eFixtures%edumb-var.php "
line : "{$var['line']} to {$var['line']} "
}
"line " => {$var['line']}
@@ -123,19 +123,41 @@ EOTXT
$cloner = new VarCloner();
$data = $cloner->cloneVar($var);
- $out = fopen('php://memory', 'r+b');
- $dumper->dump($data, $out);
- rewind($out);
- $out = stream_get_contents($out);
+ $out = $dumper->dump($data, true);
$this->assertStringMatchesFormat(
- <<b"Словарь "
EOTXT
,
+ $out
+ );
+ }
+ public function testAppend()
+ {
+ $out = fopen('php://memory', 'r+b');
+
+ $dumper = new HtmlDumper();
+ $dumper->setDumpHeader(' ');
+ $dumper->setDumpBoundaries('', ' ');
+ $cloner = new VarCloner();
+
+ $dumper->dump($cloner->cloneVar(123), $out);
+ $dumper->dump($cloner->cloneVar(456), $out);
+
+ $out = stream_get_contents($out, -1, 0);
+
+ $this->assertSame(<<<'EOTXT'
+123
+
+456
+
+
+EOTXT
+ ,
$out
);
}
diff --git a/htdocs/includes/symfony/var-dumper/Tests/Test/VarDumperTestTraitTest.php b/htdocs/includes/symfony/var-dumper/Tests/Test/VarDumperTestTraitTest.php
index 3295797179c..464d67f6cec 100644
--- a/htdocs/includes/symfony/var-dumper/Tests/Test/VarDumperTestTraitTest.php
+++ b/htdocs/includes/symfony/var-dumper/Tests/Test/VarDumperTestTraitTest.php
@@ -11,9 +11,10 @@
namespace Symfony\Component\VarDumper\Tests\Test;
+use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
-class VarDumperTestTraitTest extends \PHPUnit_Framework_TestCase
+class VarDumperTestTraitTest extends TestCase
{
use VarDumperTestTrait;
diff --git a/htdocs/includes/symfony/var-dumper/Tests/VarClonerTest.php b/htdocs/includes/symfony/var-dumper/Tests/VarClonerTest.php
index 31e3a40ae04..2181905e4a3 100644
--- a/htdocs/includes/symfony/var-dumper/Tests/VarClonerTest.php
+++ b/htdocs/includes/symfony/var-dumper/Tests/VarClonerTest.php
@@ -11,12 +11,13 @@
namespace Symfony\Component\VarDumper\Tests;
+use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Cloner\VarCloner;
/**
* @author Nicolas Grekas
*/
-class VarClonerTest extends \PHPUnit_Framework_TestCase
+class VarClonerTest extends TestCase
{
public function testMaxIntBoundary()
{
@@ -41,6 +42,10 @@ Symfony\Component\VarDumper\Cloner\Data Object
[handle] => 0
[refCount] => 0
[position] => 1
+ [attr] => Array
+ (
+ )
+
)
)
@@ -52,6 +57,8 @@ Symfony\Component\VarDumper\Cloner\Data Object
)
+ [position:Symfony\Component\VarDumper\Cloner\Data:private] => 0
+ [key:Symfony\Component\VarDumper\Cloner\Data:private] => 0
[maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20
[maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1
[useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1
@@ -84,6 +91,10 @@ Symfony\Component\VarDumper\Cloner\Data Object
[handle] => %i
[refCount] => 0
[position] => 1
+ [attr] => Array
+ (
+ )
+
)
)
@@ -99,6 +110,10 @@ Symfony\Component\VarDumper\Cloner\Data Object
[handle] => %i
[refCount] => 0
[position] => 2
+ [attr] => Array
+ (
+ )
+
)
[\000+\0002] => Symfony\Component\VarDumper\Cloner\Stub Object
@@ -110,6 +125,10 @@ Symfony\Component\VarDumper\Cloner\Data Object
[handle] => %i
[refCount] => 0
[position] => 3
+ [attr] => Array
+ (
+ )
+
)
)
@@ -126,6 +145,8 @@ Symfony\Component\VarDumper\Cloner\Data Object
)
+ [position:Symfony\Component\VarDumper\Cloner\Data:private] => 0
+ [key:Symfony\Component\VarDumper\Cloner\Data:private] => 0
[maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20
[maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1
[useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1
@@ -135,6 +156,86 @@ EOTXT;
$this->assertStringMatchesFormat($expected, print_r($clone, true));
}
+ public function testJsonCast()
+ {
+ if (ini_get('xdebug.overload_var_dump') == 2) {
+ $this->markTestSkipped('xdebug is active');
+ }
+
+ $data = (array) json_decode('{"1":{}}');
+
+ $cloner = new VarCloner();
+ $clone = $cloner->cloneVar($data);
+
+ $expected = <<<'EOTXT'
+object(Symfony\Component\VarDumper\Cloner\Data)#%i (6) {
+ ["data":"Symfony\Component\VarDumper\Cloner\Data":private]=>
+ array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ object(Symfony\Component\VarDumper\Cloner\Stub)#%i (8) {
+ ["type"]=>
+ string(5) "array"
+ ["class"]=>
+ string(5) "assoc"
+ ["value"]=>
+ int(1)
+ ["cut"]=>
+ int(0)
+ ["handle"]=>
+ int(0)
+ ["refCount"]=>
+ int(0)
+ ["position"]=>
+ int(1)
+ ["attr"]=>
+ array(0) {
+ }
+ }
+ }
+ [1]=>
+ array(1) {
+ ["1"]=>
+ object(Symfony\Component\VarDumper\Cloner\Stub)#%i (8) {
+ ["type"]=>
+ string(6) "object"
+ ["class"]=>
+ string(8) "stdClass"
+ ["value"]=>
+ NULL
+ ["cut"]=>
+ int(0)
+ ["handle"]=>
+ int(%i)
+ ["refCount"]=>
+ int(0)
+ ["position"]=>
+ int(0)
+ ["attr"]=>
+ array(0) {
+ }
+ }
+ }
+ }
+ ["position":"Symfony\Component\VarDumper\Cloner\Data":private]=>
+ int(0)
+ ["key":"Symfony\Component\VarDumper\Cloner\Data":private]=>
+ int(0)
+ ["maxDepth":"Symfony\Component\VarDumper\Cloner\Data":private]=>
+ int(20)
+ ["maxItemsPerDepth":"Symfony\Component\VarDumper\Cloner\Data":private]=>
+ int(-1)
+ ["useRefHandles":"Symfony\Component\VarDumper\Cloner\Data":private]=>
+ int(-1)
+}
+
+EOTXT;
+ ob_start();
+ var_dump($clone);
+ $this->assertStringMatchesFormat(\PHP_VERSION_ID >= 70200 ? str_replace('"1"', '1', $expected) : $expected, ob_get_clean());
+ }
+
public function testCaster()
{
$cloner = new VarCloner(array(
@@ -165,6 +266,10 @@ Symfony\Component\VarDumper\Cloner\Data Object
[handle] => %i
[refCount] => 0
[position] => 1
+ [attr] => Array
+ (
+ )
+
)
)
@@ -176,6 +281,8 @@ Symfony\Component\VarDumper\Cloner\Data Object
)
+ [position:Symfony\Component\VarDumper\Cloner\Data:private] => 0
+ [key:Symfony\Component\VarDumper\Cloner\Data:private] => 0
[maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20
[maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1
[useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1
diff --git a/htdocs/includes/symfony/var-dumper/composer.json b/htdocs/includes/symfony/var-dumper/composer.json
index 05955f69430..44dbdebcce2 100644
--- a/htdocs/includes/symfony/var-dumper/composer.json
+++ b/htdocs/includes/symfony/var-dumper/composer.json
@@ -20,9 +20,14 @@
"symfony/polyfill-mbstring": "~1.0"
},
"require-dev": {
- "twig/twig": "~1.20|~2.0"
+ "ext-iconv": "*",
+ "twig/twig": "~1.34|~2.4"
+ },
+ "conflict": {
+ "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0"
},
"suggest": {
+ "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).",
"ext-symfony_debug": ""
},
"autoload": {
@@ -35,7 +40,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "3.0-dev"
+ "dev-master": "3.2-dev"
}
}
}
diff --git a/htdocs/includes/symfony/var-dumper/phpunit.xml.dist b/htdocs/includes/symfony/var-dumper/phpunit.xml.dist
index bb16a3a4ec0..4a25f42db82 100644
--- a/htdocs/includes/symfony/var-dumper/phpunit.xml.dist
+++ b/htdocs/includes/symfony/var-dumper/phpunit.xml.dist
@@ -5,9 +5,13 @@
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
+ failOnRisky="true"
+ failOnWarning="true"
>
+
+
From 52a255e0cb9a9ed95e8781849b2aff827d4986d8 Mon Sep 17 00:00:00 2001
From: Anthony Berton <34568357+bb2a@users.noreply.github.com>
Date: Thu, 12 Aug 2021 10:10:57 +0200
Subject: [PATCH 011/449] move at bottom of pdf_other.php page
---
htdocs/admin/pdf.php | 5 ----
htdocs/admin/pdf_other.php | 59 +++++++++++++++++++++-----------------
2 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php
index 256038d356c..540d8318dd1 100644
--- a/htdocs/admin/pdf.php
+++ b/htdocs/admin/pdf.php
@@ -330,11 +330,6 @@ print ''.$langs->trans("MAIN_DOCUMENTS_LOGO_HEIGHT").'
print ' ';
print ' ';
-// Width of picture product lign
-print ''.$langs->trans("MAIN_DOCUMENTS_WITH_PICTURE_WIDTH").' ';
-print ' ';
-print ' ';
-
// Show project
if (!empty($conf->projet->enabled)) {
diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php
index 8a757a7d34c..3d0ff2ad23a 100644
--- a/htdocs/admin/pdf_other.php
+++ b/htdocs/admin/pdf_other.php
@@ -80,38 +80,43 @@ print dol_get_fiche_head($head, 'other', $langs->trans("other"), -1, 'pdf');
print ''.$form->textwithpicto($langs->trans("PDFOtherDesc"), $s)." \n";
print " \n";
+if (!empty($conf->propal->enabled)) {
+ print load_fiche_titre($langs->trans("Proposal"), '', '');
-print load_fiche_titre($langs->trans("Proposal"), '', '');
+ print '
';
+
+print ' ';
print '';
$coldisplay++;
echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang
index 2414a92cefb..8aaf345feed 100644
--- a/htdocs/langs/en_US/mrp.lang
+++ b/htdocs/langs/en_US/mrp.lang
@@ -101,3 +101,4 @@ HumanMachine=Human / Machine
WorkstationArea=Workstation area
Machines=Machines
THMEstimatedHelp=This rate makes it possible to define a forecast cost of the item
+BOM=Nomenclature
diff --git a/htdocs/langs/fr_FR/mrp.lang b/htdocs/langs/fr_FR/mrp.lang
index e0a2e73365e..2db57d53bfb 100644
--- a/htdocs/langs/fr_FR/mrp.lang
+++ b/htdocs/langs/fr_FR/mrp.lang
@@ -101,3 +101,4 @@ HumanMachine=Humain/machine
WorkstationArea=Espace Poste de travail
Machines=Machines
THMEstimatedHelp=Ce taux permet de définir un coût prévisionnel de l'article
+BOM=Nomenclature
From 6de7d9b0af679fd56f68cebd8d604bbb31e598f3 Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Fri, 20 Aug 2021 13:37:28 +0200
Subject: [PATCH 017/449] NEW : Add sub-BOM lines on BOM card
---
htdocs/bom/bom_card.php | 11 ++++-
htdocs/bom/class/bom.class.php | 6 +++
htdocs/bom/tpl/objectline_view.tpl.php | 56 +++++++++++++++++++++++++-
3 files changed, 71 insertions(+), 2 deletions(-)
diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php
index 7bcbcc19e46..1126e04785e 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -140,6 +140,7 @@ if (empty($reshook)) {
// Set if we used free entry or predefined product
$idprod = (int) GETPOST('idprod', 'int');
+ $bom_child = (int) GETPOST('bom_select', 'int');
$qty = price2num(GETPOST('qty', 'alpha'), 'MS');
$qty_frozen = price2num(GETPOST('qty_frozen', 'alpha'), 'MS');
$disable_stock_change = GETPOST('disable_stock_change', 'int');
@@ -163,6 +164,7 @@ if (empty($reshook)) {
$bomline = new BOMLine($db);
$bomline->fk_bom = $id;
$bomline->fk_product = $idprod;
+ $bomline->fk_bom_child = $bom_child;
$bomline->qty = $qty;
$bomline->qty_frozen = (int) $qty_frozen;
$bomline->disable_stock_change = (int) $disable_stock_change;
@@ -574,18 +576,25 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
+
+ ';
*/
$coldisplay++;
+// For BOM
+print ' ';
print '';
if (($line->info_bits & 2) != 2) {
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index 623fdab1474..c869a617b2a 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -81,9 +81,9 @@ $coldisplay++;
$tmpproduct = new Product($object->db);
$tmpproduct->fetch($line->fk_product);
$tmpbom = new BOM($object->db);
-$res = $tmpbom->fetch($line->fk_bom_child);
+$tmpbom->fetch($line->fk_bom_child);
if (!empty($tmpbom->id)){
- print '' . (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? '(+)' : '(-)') . ' ';
+ print '' . (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? '(+)' : '(-)') . ' ';
}
print $tmpproduct->getNomUrl(1);
print ' - '.$tmpproduct->label;
@@ -193,15 +193,15 @@ if ($resql){
$sub_bom_line = new BOMLine($object->db);
$sub_bom_line->fetch($obj->rowid);
- print ' ';
+ print ' ';
- print ''.$sub_bom_product->getNomUrl(1).' ';
+ print ' '.$sub_bom_product->getNomUrl(1).' ';
if ($sub_bom_line->fk_bom_child > 0) {
print ''.$sub_bom->getNomUrl(1).' ';
} else {
print ' ';
}
- print ''.price($sub_bom_line->qty, 0, '', 0, 0).' ';
+ print ''.price($sub_bom_line->qty * $line->qty, 0, '', 0, 0).' ';
if ($sub_bom_line->qty_frozen > 0) {
print ''.$sub_bom_line->qty_frozen.' ';
} else {
@@ -215,7 +215,7 @@ if ($resql){
}
print ''.$sub_bom_line->efficiency.' ';
- print ''.price($sub_bom_line->total_cost).' ';
+ print ''.price($sub_bom_line->total_cost * $line->qty).' ';
print ' ';
print ' ';
print ' ';
From 2343ff2ed4a06690230c95204cf0ca7d307870f7 Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Mon, 23 Aug 2021 11:58:15 +0200
Subject: [PATCH 019/449] NEW : ShowAll/HideAll Options
---
htdocs/bom/bom_card.php | 9 ++++-----
htdocs/bom/tpl/objectline_title.tpl.php | 2 ++
htdocs/bom/tpl/objectline_view.tpl.php | 2 +-
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php
index 2df4278ecbe..71c64087419 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -615,7 +615,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$(".collapse_bom").click(function() {
var id_bom_line = $(this).attr('id').replace('collapse-', '');
- console.log('tr [parentid="'+ id_bom_line +'"]')
if($(this).text().indexOf('+') > 0) {
$('[parentid="'+ id_bom_line +'"]').show();
$(this).html('(-) ');
@@ -630,14 +629,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
//TODO : SHOW ALL / COLLAPSE ALL
$("#show_all").click(function() {
- $("[class^=batch_warehouse]").show();
- $("[class^=collapse_batch]").html('(-) ');
+ $("[class^=sub_bom_lines]").show();
+ $("[class^=collapse_bom]").html('(-) ');
return false;
});
$("#hide_all").click(function() {
- $("[class^=batch_warehouse]").hide();
- $("[class^=collapse_batch]").html('(+) ');
+ $("[class^=sub_bom_lines]").hide();
+ $("[class^=collapse_bom]").html('(+) ');
return false;
});
diff --git a/htdocs/bom/tpl/objectline_title.tpl.php b/htdocs/bom/tpl/objectline_title.tpl.php
index 6b7f04b58f0..0656f23aed9 100644
--- a/htdocs/bom/tpl/objectline_title.tpl.php
+++ b/htdocs/bom/tpl/objectline_title.tpl.php
@@ -43,6 +43,8 @@ print "\n";
print "\n";
print '';
+print ''.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").' ';
+print ''.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").' ';
// Adds a line numbering column
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index c869a617b2a..87013582fac 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -193,7 +193,7 @@ if ($resql){
$sub_bom_line = new BOMLine($object->db);
$sub_bom_line->fetch($obj->rowid);
- print ' ';
+ print ' ';
print ' '.$sub_bom_product->getNomUrl(1).' ';
if ($sub_bom_line->fk_bom_child > 0) {
From 6cd92ca82971b3cbf5654a3b8eb35651b0fe9ad5 Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Mon, 23 Aug 2021 12:15:09 +0200
Subject: [PATCH 020/449] NEW : Trad + Comments + Adding tooltips for conf
---
htdocs/bom/bom_card.php | 4 ++--
htdocs/bom/tpl/objectline_title.tpl.php | 2 ++
htdocs/langs/en_US/mrp.lang | 4 +++-
htdocs/langs/fr_FR/mrp.lang | 1 +
4 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php
index 71c64087419..85ce0a0366d 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -627,13 +627,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
return false;
});
- //TODO : SHOW ALL / COLLAPSE ALL
+ //To Show all the sub bom lines
$("#show_all").click(function() {
$("[class^=sub_bom_lines]").show();
$("[class^=collapse_bom]").html('(-) ');
return false;
});
-
+ //To Hide all the sub bom lines
$("#hide_all").click(function() {
$("[class^=sub_bom_lines]").hide();
$("[class^=collapse_bom]").html('(+) ');
diff --git a/htdocs/bom/tpl/objectline_title.tpl.php b/htdocs/bom/tpl/objectline_title.tpl.php
index 0656f23aed9..ce811096d33 100644
--- a/htdocs/bom/tpl/objectline_title.tpl.php
+++ b/htdocs/bom/tpl/objectline_title.tpl.php
@@ -45,6 +45,8 @@ print "\n";
print '';
print ''.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").' ';
print ''.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").' ';
+$form = new Form($object->db);
+print $form->textwithpicto('', $langs->trans('CollapseBOMHelp'), 1, 'help', '');
// Adds a line numbering column
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang
index 8aaf345feed..c414a219894 100644
--- a/htdocs/langs/en_US/mrp.lang
+++ b/htdocs/langs/en_US/mrp.lang
@@ -101,4 +101,6 @@ HumanMachine=Human / Machine
WorkstationArea=Workstation area
Machines=Machines
THMEstimatedHelp=This rate makes it possible to define a forecast cost of the item
-BOM=Nomenclature
+BOM=Bill Of Materials
+CollapseBOMHelp=You can define the default display of the details of the nomenclature in the configuration of the BOM module
+
diff --git a/htdocs/langs/fr_FR/mrp.lang b/htdocs/langs/fr_FR/mrp.lang
index 2db57d53bfb..12873fd5093 100644
--- a/htdocs/langs/fr_FR/mrp.lang
+++ b/htdocs/langs/fr_FR/mrp.lang
@@ -102,3 +102,4 @@ WorkstationArea=Espace Poste de travail
Machines=Machines
THMEstimatedHelp=Ce taux permet de définir un coût prévisionnel de l'article
BOM=Nomenclature
+CollapseBOMHelp=Vous pouvez définir l'affichage par défaut du détail des nomenclature dans la configuration du module "Nomenclature Produits"
From e282feb3970ef6f99b89b9ed1ced4364e91bd331 Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Mon, 23 Aug 2021 14:43:17 +0200
Subject: [PATCH 021/449] NEW : Delete conf
---
htdocs/bom/tpl/objectline_title.tpl.php | 2 --
htdocs/bom/tpl/objectline_view.tpl.php | 8 ++++++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/htdocs/bom/tpl/objectline_title.tpl.php b/htdocs/bom/tpl/objectline_title.tpl.php
index ce811096d33..0656f23aed9 100644
--- a/htdocs/bom/tpl/objectline_title.tpl.php
+++ b/htdocs/bom/tpl/objectline_title.tpl.php
@@ -45,8 +45,6 @@ print "\n";
print '';
print ''.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").' ';
print ''.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").' ';
-$form = new Form($object->db);
-print $form->textwithpicto('', $langs->trans('CollapseBOMHelp'), 1, 'help', '');
// Adds a line numbering column
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index 87013582fac..fbfb02576df 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -81,7 +81,7 @@ $coldisplay++;
$tmpproduct = new Product($object->db);
$tmpproduct->fetch($line->fk_product);
$tmpbom = new BOM($object->db);
-$tmpbom->fetch($line->fk_bom_child);
+$res = $tmpbom->fetch($line->fk_bom_child);
if (!empty($tmpbom->id)){
print '' . (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? '(+)' : '(-)') . ' ';
}
@@ -193,7 +193,11 @@ if ($resql){
$sub_bom_line = new BOMLine($object->db);
$sub_bom_line->fetch($obj->rowid);
- print ' ';
+ if (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT)){
+ print ' ';
+ } else {
+ print ' ';
+ }
print ' '.$sub_bom_product->getNomUrl(1).' ';
if ($sub_bom_line->fk_bom_child > 0) {
From 7474d2eef57aaec32713309ece7f84f7b85d8d88 Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Mon, 23 Aug 2021 15:08:32 +0200
Subject: [PATCH 022/449] FIX : Add BOM column for create view
---
htdocs/bom/tpl/objectline_create.tpl.php | 2 ++
1 file changed, 2 insertions(+)
diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php
index 5835849e9ff..1a60029c439 100644
--- a/htdocs/bom/tpl/objectline_create.tpl.php
+++ b/htdocs/bom/tpl/objectline_create.tpl.php
@@ -61,6 +61,8 @@ if ($nolinesbefore) {
print '';
print '
'.$langs->trans('AddNewLine').' ';
print ' ';
+ // Linked BOM
+ print ''.$langs->trans('BOM').' ';
print ''.$langs->trans('Qty').' ';
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
print '';
From 2ecc448bc032e626436544c5eb6c7d95598fd480 Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Wed, 25 Aug 2021 11:21:54 +0200
Subject: [PATCH 023/449] FIX : Set total_cost for parent line by additionning
total_cost of the children lines
---
htdocs/bom/tpl/objectline_view.tpl.php | 33 +++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index fbfb02576df..0d83754dd60 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -123,7 +123,8 @@ $coldisplay++;
echo $line->efficiency;
print ' ';
-print '';
+$total_cost = 0;
+print ' ';
$coldisplay++;
echo price($line->total_cost);
print ' ';
@@ -199,7 +200,7 @@ if ($resql){
print '';
}
- print ' '.$sub_bom_product->getNomUrl(1).' ';
+ print ''.$sub_bom_product->getNomUrl(1).' ';
if ($sub_bom_line->fk_bom_child > 0) {
print ''.$sub_bom->getNomUrl(1).' ';
} else {
@@ -219,13 +220,39 @@ if ($resql){
}
print ''.$sub_bom_line->efficiency.' ';
- print ''.price($sub_bom_line->total_cost * $line->qty).' ';
+ if ($sub_bom_product->cost_price > 0) {
+ print ''.price($sub_bom_product->cost_price * $line->qty).' ';
+ $total_cost.= $sub_bom_product->cost_price * $line->qty;
+ } else if ($sub_bom_product->pmp > 0) {
+ print ''.price($sub_bom_product->pmp * $line->qty).' ';
+ $total_cost.= $sub_bom_product->pmp * $line->qty;
+ } else {
+ $sql_supplier_price = 'SELECT MIN(price) AS min_price FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
+ $sql_supplier_price.= ' WHERE fk_product = '.$sub_bom_product->id;
+ $resql_supplier_price = $object->db->query($sql_supplier_price);
+ if ($resql_supplier_price) {
+ $obj = $object->db->fetch_object($resql_supplier_price);
+ print ''.price($obj->min_price * $line->qty).' ';
+ $total_cost+= $obj->min_price * $line->qty;
+ }
+ }
+
print ' ';
print ' ';
print ' ';
}
}
+if ($total_cost > 0) {
+ $line->total_cost = price($total_cost);
+ ?>
+
+ showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"', 'colspan'=>$coldisplay), '', '', 1, 'line');
From 5bf8685f72182994c38bde5dd35cabe75d516763 Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Wed, 25 Aug 2021 16:58:22 +0200
Subject: [PATCH 024/449] NEW : Add comments
---
htdocs/bom/tpl/objectline_view.tpl.php | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index 0d83754dd60..26f4d070876 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -89,6 +89,7 @@ print $tmpproduct->getNomUrl(1);
print ' - '.$tmpproduct->label;
print '';
+// To show BOM links in the list
if ($res > 0) {
print ''.$tmpbom->getNomUrl(1).' ';
} else {
@@ -179,11 +180,13 @@ if ($action == 'selectlines') {
print ' ';
+// Select of all the sub-BOM lines
$sql = 'SELECT rowid, fk_bom_child, fk_product FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl';
$sql.= ' WHERE fk_bom = '.$tmpbom->id;
$resql = $object->db->query($sql);
if ($resql){
+ // Loop on all the sub-BOM lines if they exist
while ($obj = $object->db->fetch_object($resql)){
$sub_bom_product = new Product($object->db);
$sub_bom_product->fetch($obj->fk_product);
@@ -194,18 +197,24 @@ if ($resql){
$sub_bom_line = new BOMLine($object->db);
$sub_bom_line->fetch($obj->rowid);
+ //If hidden conf is set, we show directly all the sub-BOM lines
if (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT)){
print '';
} else {
print ' ';
}
+ // Product
print ''.$sub_bom_product->getNomUrl(1).' ';
+
+ // Sub-BOM
if ($sub_bom_line->fk_bom_child > 0) {
print ''.$sub_bom->getNomUrl(1).' ';
} else {
print ' ';
}
+
+ // Qty
print ''.price($sub_bom_line->qty * $line->qty, 0, '', 0, 0).' ';
if ($sub_bom_line->qty_frozen > 0) {
print ''.$sub_bom_line->qty_frozen.' ';
@@ -213,20 +222,28 @@ if ($resql){
print ' ';
}
+ // Disable stock change
if ($sub_bom_line->disable_stock_change > 0) {
print ''.$sub_bom_line->disable_stock_change.' ';
} else {
print ' ';
}
+ // Efficiency
print ''.$sub_bom_line->efficiency.' ';
+
+ // Cost price if it's defined
if ($sub_bom_product->cost_price > 0) {
print ''.price($sub_bom_product->cost_price * $line->qty).' ';
$total_cost.= $sub_bom_product->cost_price * $line->qty;
- } else if ($sub_bom_product->pmp > 0) {
+ }
+ // PMP if cost price isn't defined
+ else if ($sub_bom_product->pmp > 0) {
print ''.price($sub_bom_product->pmp * $line->qty).' ';
$total_cost.= $sub_bom_product->pmp * $line->qty;
- } else {
+ }
+ // Minimum purchase price if cost price and PMP aren't defined
+ else {
$sql_supplier_price = 'SELECT MIN(price) AS min_price FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
$sql_supplier_price.= ' WHERE fk_product = '.$sub_bom_product->id;
$resql_supplier_price = $object->db->query($sql_supplier_price);
@@ -243,6 +260,7 @@ if ($resql){
}
}
+// Replace of the total_cost value by the sum of all sub-BOM lines total_cost
if ($total_cost > 0) {
$line->total_cost = price($total_cost);
?>
From 3a7d062d7deee5461391351bdb1cbbe6b60c863b Mon Sep 17 00:00:00 2001
From: stickler-ci
Date: Wed, 25 Aug 2021 15:24:03 +0000
Subject: [PATCH 025/449] Fixing style errors.
---
htdocs/bom/script/interface.php | 5 ++---
htdocs/bom/tpl/objectline_view.tpl.php | 10 +++++-----
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/htdocs/bom/script/interface.php b/htdocs/bom/script/interface.php
index d5811db0414..c93b54fdc33 100644
--- a/htdocs/bom/script/interface.php
+++ b/htdocs/bom/script/interface.php
@@ -7,7 +7,7 @@ $current_bom_id = GETPOST('current_bom_id', 'alphanohtml');
global $db;
-switch ($action){
+switch ($action) {
case 'select_BOM':
//Selection of nomenclatures corresponding to the selected product
$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product, p.label AS product_label FROM '.MAIN_DB_PREFIX.'bom_bom AS b ';
@@ -17,8 +17,7 @@ switch ($action){
if ($resql && $db->num_rows($resql) > 0) {
$options = array();
$cpt=0;
- while ($obj = $db->fetch_object($resql)){
-
+ while ($obj = $db->fetch_object($resql)) {
$options[$obj->rowid] = $obj->ref.' - '.$obj->label;
$cpt++;
}
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index 26f4d070876..a25cdeb87ec 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -82,7 +82,7 @@ $tmpproduct = new Product($object->db);
$tmpproduct->fetch($line->fk_product);
$tmpbom = new BOM($object->db);
$res = $tmpbom->fetch($line->fk_bom_child);
-if (!empty($tmpbom->id)){
+if (!empty($tmpbom->id)) {
print '' . (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? '(+)' : '(-)') . ' ';
}
print $tmpproduct->getNomUrl(1);
@@ -185,9 +185,9 @@ $sql = 'SELECT rowid, fk_bom_child, fk_product FROM '.MAIN_DB_PREFIX.'bom_bomlin
$sql.= ' WHERE fk_bom = '.$tmpbom->id;
$resql = $object->db->query($sql);
-if ($resql){
+if ($resql) {
// Loop on all the sub-BOM lines if they exist
- while ($obj = $object->db->fetch_object($resql)){
+ while ($obj = $object->db->fetch_object($resql)) {
$sub_bom_product = new Product($object->db);
$sub_bom_product->fetch($obj->fk_product);
@@ -198,7 +198,7 @@ if ($resql){
$sub_bom_line->fetch($obj->rowid);
//If hidden conf is set, we show directly all the sub-BOM lines
- if (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT)){
+ if (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT)) {
print '';
} else {
print ' ';
@@ -238,7 +238,7 @@ if ($resql){
$total_cost.= $sub_bom_product->cost_price * $line->qty;
}
// PMP if cost price isn't defined
- else if ($sub_bom_product->pmp > 0) {
+ elseif ($sub_bom_product->pmp > 0) {
print ''.price($sub_bom_product->pmp * $line->qty).' ';
$total_cost.= $sub_bom_product->pmp * $line->qty;
}
From a79abfd4e01e70850c8893c1c5b645bd5fdb962c Mon Sep 17 00:00:00 2001
From: henrynopo
Date: Thu, 26 Aug 2021 10:37:03 +0800
Subject: [PATCH 026/449] Update card.php
---
htdocs/compta/facture/card.php | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 31de2bbd4ff..4658c10873d 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -4052,6 +4052,8 @@ if ($action == 'create') {
$i++;
$close[$i]['code'] = 'badcustomer';
$i++;
+ $close[$i]['code'] = 'bankcharge';
+ $i++;
$close[$i]['code'] = 'other';
$i++;
// Help
@@ -4060,6 +4062,8 @@ if ($action == 'create') {
$i++;
$close[$i]['label'] = $langs->trans("ConfirmClassifyPaidPartiallyReasonBadCustomerDesc");
$i++;
+ $close[$i]['label'] = $langs->trans("ConfirmClassifyPaidPartiallyReasonBankChargeDesc");
+ $i++;
$close[$i]['label'] = $langs->trans("Other");
$i++;
// Texte
@@ -4068,6 +4072,8 @@ if ($action == 'create') {
$i++;
$close[$i]['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonBadCustomer", $resteapayer, $langs->trans("Currency".$conf->currency)), $close[$i]['label'], 1);
$i++;
+ $close[$i]['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonBankCharge", $resteapayer, $langs->trans("Currency".$conf->currency)), $close[$i]['label'], 1);
+ $i++;
$close[$i]['reason'] = $form->textwithpicto($langs->transnoentities("Other"), $close[$i]['label'], 1);
$i++;
// arrayreasons[code]=reason
From a25580f97cfeda3e314926264063d85e0d251a18 Mon Sep 17 00:00:00 2001
From: henrynopo
Date: Thu, 26 Aug 2021 10:38:53 +0800
Subject: [PATCH 027/449] Update bills.lang
---
htdocs/langs/en_US/bills.lang | 2 ++
1 file changed, 2 insertions(+)
diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang
index a921aac9e48..6a88f2599dd 100644
--- a/htdocs/langs/en_US/bills.lang
+++ b/htdocs/langs/en_US/bills.lang
@@ -192,6 +192,7 @@ ConfirmClassifyPaidPartiallyReasonDiscount=Remaining unpaid (%s %s) is a
ConfirmClassifyPaidPartiallyReasonDiscountNoVat=Remaining unpaid (%s %s) is a discount granted because payment was made before term. I accept to lose the VAT on this discount.
ConfirmClassifyPaidPartiallyReasonDiscountVat=Remaining unpaid (%s %s) is a discount granted because payment was made before term. I recover the VAT on this discount without a credit note.
ConfirmClassifyPaidPartiallyReasonBadCustomer=Bad customer
+ConfirmClassifyPaidPartiallyReasonBankCharge=Deduction by bank (intermediary bank fees)
ConfirmClassifyPaidPartiallyReasonProductReturned=Products partially returned
ConfirmClassifyPaidPartiallyReasonOther=Amount abandoned for other reason
ConfirmClassifyPaidPartiallyReasonDiscountNoVatDesc=This choice is possible if your invoice has been provided with suitable comments. (Example «Only the tax corresponding to the price that has been actually paid gives rights to deduction»)
@@ -199,6 +200,7 @@ ConfirmClassifyPaidPartiallyReasonDiscountVatDesc=In some countries, this choice
ConfirmClassifyPaidPartiallyReasonAvoirDesc=Use this choice if all other does not suit
ConfirmClassifyPaidPartiallyReasonBadCustomerDesc=A bad customer is a customer that refuses to pay his debt.
ConfirmClassifyPaidPartiallyReasonProductReturnedDesc=This choice is used when payment is not complete because some of products were returned
+ConfirmClassifyPaidPartiallyReasonBankChargeDesc=The unpaid amount is intermediary bank fees , deducted directly from the correct amount paid by the Customer.
ConfirmClassifyPaidPartiallyReasonOtherDesc=Use this choice if all others are not suitable, for example in following situation: - payment not complete because some products were shipped back - amount claimed too important because a discount was forgotten In all cases, amount over-claimed must be corrected in accountancy system by creating a credit note.
ConfirmClassifyAbandonReasonOther=Other
ConfirmClassifyAbandonReasonOtherDesc=This choice will be used in all other cases. For example because you plan to create a replacing invoice.
From 0463846df1c65a23e128e51bb96a5f7a06bc333b Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Thu, 26 Aug 2021 09:27:03 +0200
Subject: [PATCH 028/449] FIX : Stickler
---
htdocs/bom/tpl/objectline_view.tpl.php | 2 ++
1 file changed, 2 insertions(+)
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index 26f4d070876..3e1922db7fc 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -237,11 +237,13 @@ if ($resql){
print ''.price($sub_bom_product->cost_price * $line->qty).' ';
$total_cost.= $sub_bom_product->cost_price * $line->qty;
}
+
// PMP if cost price isn't defined
else if ($sub_bom_product->pmp > 0) {
print ''.price($sub_bom_product->pmp * $line->qty).' ';
$total_cost.= $sub_bom_product->pmp * $line->qty;
}
+
// Minimum purchase price if cost price and PMP aren't defined
else {
$sql_supplier_price = 'SELECT MIN(price) AS min_price FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
From 578de93dc4e98e3360223ca2053829605e73b676 Mon Sep 17 00:00:00 2001
From: stickler-ci
Date: Thu, 26 Aug 2021 07:30:36 +0000
Subject: [PATCH 029/449] Fixing style errors.
---
htdocs/bom/tpl/objectline_view.tpl.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index 1ee64890384..6aa00e79835 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -243,7 +243,7 @@ if ($resql) {
print ''.price($sub_bom_product->pmp * $line->qty).' ';
$total_cost.= $sub_bom_product->pmp * $line->qty;
}
-
+
// Minimum purchase price if cost price and PMP aren't defined
else {
$sql_supplier_price = 'SELECT MIN(price) AS min_price FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
From 0222df7ecc65c0589a32fb911102d9c18facf991 Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Thu, 26 Aug 2021 09:34:30 +0200
Subject: [PATCH 030/449] FIX : Expected 1 space after closing brace; newline
found
---
htdocs/bom/tpl/objectline_view.tpl.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index 1ee64890384..b8d054d9ecc 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -236,14 +236,14 @@ if ($resql) {
if ($sub_bom_product->cost_price > 0) {
print ''.price($sub_bom_product->cost_price * $line->qty).' ';
$total_cost.= $sub_bom_product->cost_price * $line->qty;
- }
+ }
// PMP if cost price isn't defined
elseif ($sub_bom_product->pmp > 0) {
print ''.price($sub_bom_product->pmp * $line->qty).' ';
$total_cost.= $sub_bom_product->pmp * $line->qty;
}
-
+
// Minimum purchase price if cost price and PMP aren't defined
else {
$sql_supplier_price = 'SELECT MIN(price) AS min_price FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
From bdcddebb5fdc47084a5279b68ec65957cae47e54 Mon Sep 17 00:00:00 2001
From: stickler-ci
Date: Thu, 26 Aug 2021 07:37:39 +0000
Subject: [PATCH 031/449] Fixing style errors.
---
htdocs/bom/tpl/objectline_view.tpl.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index b8d054d9ecc..6aa00e79835 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -236,7 +236,7 @@ if ($resql) {
if ($sub_bom_product->cost_price > 0) {
print ''.price($sub_bom_product->cost_price * $line->qty).' ';
$total_cost.= $sub_bom_product->cost_price * $line->qty;
- }
+ }
// PMP if cost price isn't defined
elseif ($sub_bom_product->pmp > 0) {
From 05444078bdffd9fd880fd9b9a7cd537c3d34a58b Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Thu, 26 Aug 2021 09:43:50 +0200
Subject: [PATCH 032/449] FIX : stickler
---
htdocs/bom/tpl/objectline_view.tpl.php | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index b8d054d9ecc..41ff84b4d13 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -236,16 +236,10 @@ if ($resql) {
if ($sub_bom_product->cost_price > 0) {
print ''.price($sub_bom_product->cost_price * $line->qty).' ';
$total_cost.= $sub_bom_product->cost_price * $line->qty;
- }
-
- // PMP if cost price isn't defined
- elseif ($sub_bom_product->pmp > 0) {
+ } elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined
print ''.price($sub_bom_product->pmp * $line->qty).' ';
$total_cost.= $sub_bom_product->pmp * $line->qty;
- }
-
- // Minimum purchase price if cost price and PMP aren't defined
- else {
+ } else { // Minimum purchase price if cost price and PMP aren't defined
$sql_supplier_price = 'SELECT MIN(price) AS min_price FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
$sql_supplier_price.= ' WHERE fk_product = '.$sub_bom_product->id;
$resql_supplier_price = $object->db->query($sql_supplier_price);
From e74043d48e8cec111fb052506bc9621f107b8f1d Mon Sep 17 00:00:00 2001
From: javieralapps4up
Date: Wed, 22 Sep 2021 17:56:31 +0200
Subject: [PATCH 033/449] Close: #18801 Jan-30 + 1m IS NOT Mar-2
Close: #18801 related to avoid this behaviour https://bugs.php.net/bug.php?id=74013
---
htdocs/core/lib/date.lib.php | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php
index fe21071901a..21a8835a229 100644
--- a/htdocs/core/lib/date.lib.php
+++ b/htdocs/core/lib/date.lib.php
@@ -166,7 +166,33 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit)
} else {
$date->add($interval);
}
-
+ //Change the behavior of PHP over data-interval when the result of this function is Feb 29 (non-leap years), 30 or Feb 31 (php returns March 1, 2 or 3 respectively)
+ if ($conf->global->MAIN_DATE_CHANGE_PHP_DATEINTERVAL_RESULT_FEBRUARY && $duration_unit == 'm') {
+
+ $timeyear = dol_print_date($time, '%Y');
+ $timemonth = dol_print_date($time, '%m');
+ $timetotalmonths = (($timeyear * 12) + $timemonth);
+
+ $monthsexpected = ($timetotalmonths + $duration_value);
+
+ $newtime = $date->getTimestamp();
+
+ $newtimeyear = dol_print_date($newtime, '%Y');
+ $newtimemonth = dol_print_date($newtime, '%m');
+ $newtimetotalmonths = (($newtimeyear * 12) + $newtimemonth);
+
+ if ($monthsexpected < $newtimetotalmonths) {
+
+ $newtimehours = dol_print_date($newtime, '%m');
+ $newtimemins = dol_print_date($newtime, '%m');
+ $newtimesecs = dol_print_date($newtime, '%m');
+
+ $datelim = dol_mktime($newtimehours, $newtimemins, $newtimesecs, $newtimemonth, 1, $newtimeyear);
+ $datelim -= (3600 * 24);
+
+ $date->setTimestamp($datelim);
+ }
+ }
return $date->getTimestamp();
}
From e5cff0ede117553c11b269a2a529fbac41eee8fb Mon Sep 17 00:00:00 2001
From: stickler-ci
Date: Wed, 22 Sep 2021 16:07:36 +0000
Subject: [PATCH 034/449] Fixing style errors.
---
htdocs/core/lib/date.lib.php | 46 +++++++++++++++++-------------------
1 file changed, 22 insertions(+), 24 deletions(-)
diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php
index 21a8835a229..cff6d22518f 100644
--- a/htdocs/core/lib/date.lib.php
+++ b/htdocs/core/lib/date.lib.php
@@ -168,30 +168,28 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit)
}
//Change the behavior of PHP over data-interval when the result of this function is Feb 29 (non-leap years), 30 or Feb 31 (php returns March 1, 2 or 3 respectively)
if ($conf->global->MAIN_DATE_CHANGE_PHP_DATEINTERVAL_RESULT_FEBRUARY && $duration_unit == 'm') {
-
- $timeyear = dol_print_date($time, '%Y');
- $timemonth = dol_print_date($time, '%m');
- $timetotalmonths = (($timeyear * 12) + $timemonth);
-
- $monthsexpected = ($timetotalmonths + $duration_value);
-
- $newtime = $date->getTimestamp();
-
- $newtimeyear = dol_print_date($newtime, '%Y');
- $newtimemonth = dol_print_date($newtime, '%m');
- $newtimetotalmonths = (($newtimeyear * 12) + $newtimemonth);
-
- if ($monthsexpected < $newtimetotalmonths) {
-
- $newtimehours = dol_print_date($newtime, '%m');
- $newtimemins = dol_print_date($newtime, '%m');
- $newtimesecs = dol_print_date($newtime, '%m');
-
- $datelim = dol_mktime($newtimehours, $newtimemins, $newtimesecs, $newtimemonth, 1, $newtimeyear);
- $datelim -= (3600 * 24);
-
- $date->setTimestamp($datelim);
- }
+ $timeyear = dol_print_date($time, '%Y');
+ $timemonth = dol_print_date($time, '%m');
+ $timetotalmonths = (($timeyear * 12) + $timemonth);
+
+ $monthsexpected = ($timetotalmonths + $duration_value);
+
+ $newtime = $date->getTimestamp();
+
+ $newtimeyear = dol_print_date($newtime, '%Y');
+ $newtimemonth = dol_print_date($newtime, '%m');
+ $newtimetotalmonths = (($newtimeyear * 12) + $newtimemonth);
+
+ if ($monthsexpected < $newtimetotalmonths) {
+ $newtimehours = dol_print_date($newtime, '%m');
+ $newtimemins = dol_print_date($newtime, '%m');
+ $newtimesecs = dol_print_date($newtime, '%m');
+
+ $datelim = dol_mktime($newtimehours, $newtimemins, $newtimesecs, $newtimemonth, 1, $newtimeyear);
+ $datelim -= (3600 * 24);
+
+ $date->setTimestamp($datelim);
+ }
}
return $date->getTimestamp();
}
From c4f1eb0c46fdaa81cc335e906177d752e8bb829e Mon Sep 17 00:00:00 2001
From: javieralapps4up
Date: Mon, 27 Sep 2021 14:32:03 +0200
Subject: [PATCH 035/449] Update date.lib.php
Fix my error
---
htdocs/core/lib/date.lib.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php
index cff6d22518f..b17c0c9d56d 100644
--- a/htdocs/core/lib/date.lib.php
+++ b/htdocs/core/lib/date.lib.php
@@ -181,9 +181,9 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit)
$newtimetotalmonths = (($newtimeyear * 12) + $newtimemonth);
if ($monthsexpected < $newtimetotalmonths) {
- $newtimehours = dol_print_date($newtime, '%m');
- $newtimemins = dol_print_date($newtime, '%m');
- $newtimesecs = dol_print_date($newtime, '%m');
+ $newtimehours = dol_print_date($newtime, '%h');
+ $newtimemins = dol_print_date($newtime, '%i');
+ $newtimesecs = dol_print_date($newtime, '%s');
$datelim = dol_mktime($newtimehours, $newtimemins, $newtimesecs, $newtimemonth, 1, $newtimeyear);
$datelim -= (3600 * 24);
From 11723c2cd08fb15ffac8a51e8526fb9fec5c287a Mon Sep 17 00:00:00 2001
From: javieralapps4up
Date: Mon, 27 Sep 2021 14:49:22 +0200
Subject: [PATCH 036/449] Update date.lib.php
Without words, sorry
---
htdocs/core/lib/date.lib.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php
index b17c0c9d56d..613533a443a 100644
--- a/htdocs/core/lib/date.lib.php
+++ b/htdocs/core/lib/date.lib.php
@@ -181,9 +181,9 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit)
$newtimetotalmonths = (($newtimeyear * 12) + $newtimemonth);
if ($monthsexpected < $newtimetotalmonths) {
- $newtimehours = dol_print_date($newtime, '%h');
- $newtimemins = dol_print_date($newtime, '%i');
- $newtimesecs = dol_print_date($newtime, '%s');
+ $newtimehours = dol_print_date($newtime, '%H');
+ $newtimemins = dol_print_date($newtime, '%M');
+ $newtimesecs = dol_print_date($newtime, '%S');
$datelim = dol_mktime($newtimehours, $newtimemins, $newtimesecs, $newtimemonth, 1, $newtimeyear);
$datelim -= (3600 * 24);
From 68ac62d09c8a01dc09f2d0e947094757dff871d0 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Thu, 7 Oct 2021 11:05:06 +0200
Subject: [PATCH 037/449] Fix phpcs
---
htdocs/fourn/facture/card.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index e4aeae07581..985c9a4cc62 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -984,7 +984,7 @@ if (empty($reshook))
if (!in_array($lines[$i]->id, $selectedLines)) {
continue; // Skip unselected lines
}
-
+
$desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
From 1efc2eda694479940fd143cc8a5e6207c82a60be Mon Sep 17 00:00:00 2001
From: lvessiller
Date: Fri, 8 Oct 2021 11:54:38 +0200
Subject: [PATCH 038/449] FIX reload user lang
---
scripts/cron/cron_run_jobs.php | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php
index 80f586a6788..7e6fb991478 100755
--- a/scripts/cron/cron_run_jobs.php
+++ b/scripts/cron/cron_run_jobs.php
@@ -125,7 +125,7 @@ if ($userlogin == 'firstadmin') {
// Check user login
$user = new User($db);
-$result = $user->fetch('', $userlogin);
+$result = $user->fetch('', $userlogin, '', 1);
if ($result < 0) {
echo "User Error: ".$user->error;
dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR);
@@ -137,6 +137,16 @@ if ($result < 0) {
exit(-1);
}
}
+
+// Reload langs
+$langcode = (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT);
+if (!empty($user->conf->MAIN_LANG_DEFAULT)) {
+ $langcode = $user->conf->MAIN_LANG_DEFAULT;
+}
+if ($langs->getDefaultLang() != $langcode) {
+ $langs->setDefaultLang($langcode);
+}
+
$user->getrights();
if (isset($argv[3]) && $argv[3]) {
@@ -195,8 +205,8 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) {
$mysoc->setMysoc($conf);
// Force recheck that user is ok for the entity to process and reload permission for entity
- if ($conf->entity != $user->entity && $user->entity != 0) {
- $result = $user->fetch('', $userlogin, '', 0, $conf->entity);
+ if ($conf->entity != $user->entity) {
+ $result = $user->fetch('', $userlogin, '', 1);
if ($result < 0) {
echo "\nUser Error: ".$user->error."\n";
dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR);
From be4a00213c6765d239bac5a861ed7f0d8ed8b141 Mon Sep 17 00:00:00 2001
From: lvessiller
Date: Fri, 8 Oct 2021 15:58:08 +0200
Subject: [PATCH 039/449] FIX optional visibility on create card
---
htdocs/asset/type.php | 2 +-
htdocs/categories/card.php | 2 +-
htdocs/comm/action/card.php | 2 +-
htdocs/comm/mailing/card.php | 2 +-
htdocs/commande/card.php | 2 +-
htdocs/compta/bank/card.php | 2 +-
htdocs/compta/facture/card.php | 2 +-
htdocs/don/card.php | 2 +-
htdocs/expensereport/card.php | 2 +-
htdocs/fichinter/card.php | 2 +-
htdocs/fourn/commande/card.php | 2 +-
htdocs/fourn/facture/card.php | 2 +-
htdocs/product/card.php | 2 +-
htdocs/reception/card.php | 2 +-
htdocs/salaries/card.php | 2 +-
htdocs/supplier_proposal/card.php | 2 +-
16 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/htdocs/asset/type.php b/htdocs/asset/type.php
index 6103b963e21..b09b56ffbcf 100644
--- a/htdocs/asset/type.php
+++ b/htdocs/asset/type.php
@@ -389,7 +389,7 @@ if ($action == 'create') {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
- print $object->showOptionals($extrafields, 'edit', $parameters);
+ print $object->showOptionals($extrafields, 'create', $parameters);
}
print '';
print "\n";
diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php
index 141e061ac20..a11d9f843a5 100644
--- a/htdocs/categories/card.php
+++ b/htdocs/categories/card.php
@@ -266,7 +266,7 @@ if ($user->rights->categorie->creer) {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
- print $object->showOptionals($extrafields, 'edit', $parameters);
+ print $object->showOptionals($extrafields, 'create', $parameters);
}
print '';
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index bc9b77cc881..53b6e329c90 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -1262,7 +1262,7 @@ if ($action == 'create') {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
- print $object->showOptionals($extrafields, 'edit', $parameters);
+ print $object->showOptionals($extrafields, 'create', $parameters);
}
print '';
diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php
index e03d13c29e8..b91bc866d9a 100644
--- a/htdocs/comm/mailing/card.php
+++ b/htdocs/comm/mailing/card.php
@@ -726,7 +726,7 @@ if ($action == 'create') {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
- print $object->showOptionals($extrafields, 'edit');
+ print $object->showOptionals($extrafields, 'create');
}
print '';
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index c40a64032c0..1c0ae369be6 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -1721,7 +1721,7 @@ if ($action == 'create' && $usercancreate) {
}
};
- print $object->showOptionals($extrafields, 'edit', $parameters);
+ print $object->showOptionals($extrafields, 'create', $parameters);
}
// Template to use by default
diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php
index d1cc0413bfd..c6b852be444 100644
--- a/htdocs/compta/bank/card.php
+++ b/htdocs/compta/bank/card.php
@@ -444,7 +444,7 @@ if ($action == 'create') {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
- print $object->showOptionals($extrafields, 'edit', $parameters);
+ print $object->showOptionals($extrafields, 'create', $parameters);
}
print '';
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 6ea03d8bd23..83c8ec8d718 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -3636,7 +3636,7 @@ if ($action == 'create') {
}
};
- print $object->showOptionals($extrafields, 'edit', $parameters);
+ print $object->showOptionals($extrafields, 'create', $parameters);
}
// Template to use by default
diff --git a/htdocs/don/card.php b/htdocs/don/card.php
index 1b3c72906b4..9579497411f 100644
--- a/htdocs/don/card.php
+++ b/htdocs/don/card.php
@@ -492,7 +492,7 @@ if ($action == 'create') {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
- print $object->showOptionals($extrafields, 'edit', $parameters);
+ print $object->showOptionals($extrafields, 'create', $parameters);
}
print ' ';
diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php
index 81995792dbb..eec14c85a99 100644
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -1421,7 +1421,7 @@ if ($action == 'create') {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
print $hookmanager->resPrint;
if (empty($reshook)) {
- print $object->showOptionals($extrafields, 'edit', $parameters);
+ print $object->showOptionals($extrafields, 'create', $parameters);
}
print '';
diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php
index e138c8ed6fe..225f9ebacb8 100644
--- a/htdocs/fichinter/card.php
+++ b/htdocs/fichinter/card.php
@@ -930,7 +930,7 @@ if ($action == 'create') {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
- print $object->showOptionals($extrafields, 'edit');
+ print $object->showOptionals($extrafields, 'create');
}
// Show link to origin object
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index f02ffb99d77..cdeeeff9d17 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -1760,7 +1760,7 @@ if ($action == 'create') {
print $hookmanager->resPrint;
if (empty($reshook)) {
- print $object->showOptionals($extrafields, 'edit');
+ print $object->showOptionals($extrafields, 'create');
}
// Bouton "Create Draft"
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index 6241a0cee15..80f868f3484 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -2270,7 +2270,7 @@ if ($action == 'create') {
}
if (empty($reshook)) {
- print $object->showOptionals($extrafields, 'edit');
+ print $object->showOptionals($extrafields, 'create');
}
// Public note
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index b7aba2ec398..9aa2c1a1a09 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -1334,7 +1334,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
- print $object->showOptionals($extrafields, 'edit', $parameters);
+ print $object->showOptionals($extrafields, 'create', $parameters);
}
// Note (private, no output on invoices, propales...)
diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php
index 40b605bbe17..111d65e8c7f 100644
--- a/htdocs/reception/card.php
+++ b/htdocs/reception/card.php
@@ -869,7 +869,7 @@ if ($action == 'create') {
if ($objectsrc->fetch_optionals() > 0) {
$recept->array_options = array_merge($recept->array_options, $objectsrc->array_options);
}
- print $object->showOptionals($extrafields, 'edit', $parameters);
+ print $object->showOptionals($extrafields, 'create', $parameters);
}
// Incoterms
diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php
index b6f8dd91f14..486b4fd70ea 100755
--- a/htdocs/salaries/card.php
+++ b/htdocs/salaries/card.php
@@ -576,7 +576,7 @@ if ($action == 'create') {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
- print $object->showOptionals($extrafields, 'edit');
+ print $object->showOptionals($extrafields, 'create');
}
print '';
diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php
index 6f1d0824b0b..1500f00ba91 100644
--- a/htdocs/supplier_proposal/card.php
+++ b/htdocs/supplier_proposal/card.php
@@ -1233,7 +1233,7 @@ if ($action == 'create') {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
- print $object->showOptionals($extrafields, 'edit', $parameters);
+ print $object->showOptionals($extrafields, 'create', $parameters);
}
From 90be175c500d57f60118764b7a2110e118a7c07b Mon Sep 17 00:00:00 2001
From: lvessiller
Date: Fri, 8 Oct 2021 16:20:51 +0200
Subject: [PATCH 040/449] FIX load tranlate array after setting lang
---
scripts/cron/cron_run_jobs.php | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php
index 7e6fb991478..8aa996f9c17 100755
--- a/scripts/cron/cron_run_jobs.php
+++ b/scripts/cron/cron_run_jobs.php
@@ -76,9 +76,6 @@ $userlogin = $argv[2];
$version = DOL_VERSION;
$error = 0;
-// Language Management
-$langs->loadLangs(array('main', 'admin', 'cron', 'dict'));
-
/*
* Main
@@ -145,7 +142,10 @@ if (!empty($user->conf->MAIN_LANG_DEFAULT)) {
}
if ($langs->getDefaultLang() != $langcode) {
$langs->setDefaultLang($langcode);
+ $langs->tab_translate = array();
}
+// Language Management
+$langs->loadLangs(array('main', 'admin', 'cron', 'dict'));
$user->getrights();
@@ -228,6 +228,8 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) {
}
if ($langs->getDefaultLang() != $langcode) {
$langs->setDefaultLang($langcode);
+ $langs->tab_translate = array();
+ $langs->loadLangs(array('main', 'admin', 'cron', 'dict'));
}
}
From 2da16ade6c722e1464a6c8f571beaba150f194d9 Mon Sep 17 00:00:00 2001
From: atm-florian
Date: Fri, 8 Oct 2021 17:24:52 +0200
Subject: [PATCH 041/449] FIX: consistent UX when calling a tab from the
invoice card with empty ref / id
---
htdocs/compta/facture/card.php | 11 +++++++++++
htdocs/compta/facture/contact.php | 11 +++++++++++
htdocs/compta/facture/document.php | 11 +++++++++++
htdocs/compta/facture/info.php | 11 +++++++++++
htdocs/compta/facture/note.php | 11 +++++++++++
5 files changed, 55 insertions(+)
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index e15b2722800..ab568332dd8 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -2756,6 +2756,17 @@ if (empty($reshook))
* View
*/
+if (empty($object->id)) {
+ llxHeader();
+ $head = facture_prepare_head($object);
+ $langs->load('errors');
+ echo dol_get_fiche_head($head, 'compta', $langs->trans("InvoiceCustomer"), -1, 'bill'),
+ '' . $langs->trans("ErrorRecordNotFound") . '
';
+ llxFooter();
+ dol_shutdown();
+ exit;
+}
+
$form = new Form($db);
$formother = new FormOther($db);
$formfile = new FormFile($db);
diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php
index c340d68242e..c0e0a40c2c5 100644
--- a/htdocs/compta/facture/contact.php
+++ b/htdocs/compta/facture/contact.php
@@ -118,6 +118,17 @@ elseif ($action == 'deletecontact' && $user->rights->facture->creer)
* View
*/
+if (empty($object->id)) {
+ llxHeader();
+ $head = facture_prepare_head($object);
+ $langs->load('errors');
+ echo dol_get_fiche_head($head, 'contact', $langs->trans("InvoiceCustomer"), -1, 'bill'),
+ '' . $langs->trans("ErrorRecordNotFound") . '
';
+ llxFooter();
+ dol_shutdown();
+ exit;
+}
+
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('ContactsAddresses');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl);
diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php
index e880d77db74..64ebed251d3 100644
--- a/htdocs/compta/facture/document.php
+++ b/htdocs/compta/facture/document.php
@@ -85,6 +85,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
* View
*/
+if (empty($object->id)) {
+ llxHeader();
+ $head = facture_prepare_head($object);
+ $langs->load('errors');
+ echo dol_get_fiche_head($head, 'documents', $langs->trans("InvoiceCustomer"), -1, 'bill'),
+ '' . $langs->trans("ErrorRecordNotFound") . '
';
+ llxFooter();
+ dol_shutdown();
+ exit;
+}
+
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Documents');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl);
diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php
index bad63cf1f61..9e40fd8b5a8 100644
--- a/htdocs/compta/facture/info.php
+++ b/htdocs/compta/facture/info.php
@@ -43,6 +43,17 @@ $ref = GETPOST("ref", 'alpha');
* View
*/
+if (empty($object->id)) {
+ llxHeader();
+ $head = facture_prepare_head($object);
+ $langs->load('errors');
+ echo dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill'),
+ '' . $langs->trans("ErrorRecordNotFound") . '
';
+ llxFooter();
+ dol_shutdown();
+ exit;
+}
+
$form = new Form($db);
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Info');
diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php
index 07084a0cf2c..428383b4907 100644
--- a/htdocs/compta/facture/note.php
+++ b/htdocs/compta/facture/note.php
@@ -64,6 +64,17 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
* View
*/
+if (empty($object->id)) {
+ llxHeader();
+ $head = facture_prepare_head($object);
+ $langs->load('errors');
+ echo dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill'),
+ '' . $langs->trans("ErrorRecordNotFound") . '
';
+ llxFooter();
+ dol_shutdown();
+ exit;
+}
+
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Notes');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl);
From cdf1d37a1d50f57bec4a6a5140cafde5ef82a818 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Fri, 8 Oct 2021 18:52:01 +0200
Subject: [PATCH 042/449] Fix changelog
---
ChangeLog | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 4625e7bc077..f202acb2403 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,48 @@
English Dolibarr ChangeLog
--------------------------------------------------------------
+***** ChangeLog for 14.0.3 compared to 14.0.2 *****
+
+FIX: #18698 Supplier invoice list - "alert" checkbox not working
+FIX: #18735
+FIX: #18767 : Member delete
+FIX: #18854
+FIX: #18910 : MRP List SQL query syntax error with more than one extrafileds.
+FIX: Accountancy - Format Quadra export - Missing line type C to create automaticly a subledger account with label
+FIX: Accountancy - Missing specific filename for export on format FEC2, Ciel & repare it
+FIX: Accountancy - Option of export popup are inverted
+FIX: Accountancy - Some correction on export name
+FIX: Accountancy - Trunc code_journal to 2 in format XIMPORT (Ciel, Sage50)
+FIX: add warehouse in projects' overview count
+FIX: autocalculation of the supplier price in main currency.
+FIX: avoid warning if $categories is an id
+FIX: Bad use of a forced contact of another company on PDF/ODT documents
+FIX: Button text on proposal card to create a invoice
+FIX: calculateCosts of BOM must not be included into fetch
+FIX: check if greater 0
+FIX: default language defined for IN country
+FIX: fetch of product with modulebuilder load too much data
+FIX: Filter on categories
+FIX: indentation
+FIX: init hookmanager after loading $conf values
+FIX: legal issue on expense report pdf (must also show price without tax)
+FIX: missing filter status=1 on rss feeds
+FIX: move fetch_optionnal into $ac_static->fetch()
+FIX: payment using wrong type in takepos when too many payment mode
+FIX: Product accountancy affectation with product_perentity activated (PR #18620)
+FIX: products/services card: hidden extrafields were overridden
+FIX: Propal list - Problem of pagination on date
+FIX: selected lines on supplier invoice create
+FIX: Selection of type "people" for membership must hide the company
+FIX: select list of orders not complete when field type of company is on
+FIX: support of localtax on expense report
+FIX: task time: can't filter by user with pgsql + show error message
+FIX: task time: keep on using natural_search
+FIX: Test when date of invoie is in future (pb with TZ and offset)
+FIX: translation into email for member at membership validation.
+FIX: unprivileged user can see task associated with a not allowed project
+FIX: user without permission can set ticket subject
+
***** ChangeLog for 14.0.2 compared to 14.0.1 *****
FIX: #18353 Invoice list translation issue
From de17b367c8e873d12c86ed004f7521097f5e5927 Mon Sep 17 00:00:00 2001
From: Benjamin Chantalat <74144396+PyroShape@users.noreply.github.com>
Date: Sat, 9 Oct 2021 20:14:16 +0200
Subject: [PATCH 043/449] FIX #18875 in v14
---
htdocs/reception/list.php | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php
index 624748ded8f..2d6600dcc45 100644
--- a/htdocs/reception/list.php
+++ b/htdocs/reception/list.php
@@ -612,11 +612,13 @@ if ($search_ref_supplier) {
$param .= "&search_ref_supplier=".urlencode($search_ref_supplier);
}
// Add $param from extra fields
-foreach ($search_array_options as $key => $val) {
- $crit = $val;
- $tmpkey = preg_replace('/search_options_/', '', $key);
- if ($val != '') {
- $param .= '&search_options_'.$tmpkey.'='.urlencode($val);
+if ($search_array_options) {
+ foreach ($search_array_options as $key => $val) {
+ $crit = $val;
+ $tmpkey = preg_replace('/search_options_/', '', $key);
+ if ($val != '') {
+ $param .= '&search_options_'.$tmpkey.'='.urlencode($val);
+ }
}
}
From 6e60e1f45308c4bcf5b08636ad6bda6cc601b1fe Mon Sep 17 00:00:00 2001
From: Benjamin Chantalat <74144396+PyroShape@users.noreply.github.com>
Date: Sat, 9 Oct 2021 20:38:46 +0200
Subject: [PATCH 044/449] Fix date format into supplier order info tab
---
htdocs/fourn/class/fournisseur.commande.class.php | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index 3facc342f08..2e9727de83c 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -2927,11 +2927,11 @@ class CommandeFournisseur extends CommonOrder
$this->user_approve_id2 = $obj->fk_user_approve2;
}
- $this->date_creation = $this->db->idate($obj->datec);
- $this->date_modification = $this->db->idate($obj->datem);
- $this->date_approve = $this->db->idate($obj->datea);
- $this->date_approve2 = $this->db->idate($obj->datea2);
- $this->date_validation = $this->db->idate($obj->date_validation);
+ $this->date_creation = $obj->datec;
+ $this->date_modification = $obj->datem;
+ $this->date_approve = $obj->datea;
+ $this->date_approve2 = $obj->datea2;
+ $this->date_validation = $obj->date_validation;
}
$this->db->free($result);
} else {
From ff5f3714280979bc3899ac74c760f2e09f35f448 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Sun, 10 Oct 2021 20:46:06 +0200
Subject: [PATCH 045/449] Fix add protection to avoid deletion of page when
deleting a file
---
htdocs/website/index.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/website/index.php b/htdocs/website/index.php
index 6aab64736e3..f40c21778f5 100644
--- a/htdocs/website/index.php
+++ b/htdocs/website/index.php
@@ -1231,7 +1231,7 @@ if ($action == 'confirm_deletesite' && $confirm == 'yes' && $permissiontodelete)
}
// Delete page (from website page menu)
-if (GETPOSTISSET('pageid') && $action == 'delete' && $permissiontodelete) {
+if (GETPOSTISSET('pageid') && $action == 'delete' && $permissiontodelete && !GETPOST('file_manager')) {
$error = 0;
$db->begin();
From 754b13a83fbada80e28ff7be2146740ea299b87b Mon Sep 17 00:00:00 2001
From: Alexandre SPANGARO
Date: Mon, 11 Oct 2021 08:58:00 +0200
Subject: [PATCH 046/449] NEW Add sortorder on units list
---
htdocs/admin/dict.php | 12 ++++++------
htdocs/core/class/cunits.class.php | 8 +++++++-
htdocs/core/class/html.form.class.php | 1 +
htdocs/install/mysql/migration/14.0.0-15.0.0.sql | 2 ++
htdocs/install/mysql/tables/llx_c_units.sql | 15 ++++++++-------
5 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index d0a699ef979..ea7f0c92b37 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -8,7 +8,7 @@
* Copyright (C) 2011 Remy Younes
* Copyright (C) 2012-2015 Marcos García
* Copyright (C) 2012 Christophe Battarel
- * Copyright (C) 2011-2020 Alexandre Spangaro
+ * Copyright (C) 2011-2021 Alexandre Spangaro
* Copyright (C) 2015 Ferran Marcet
* Copyright (C) 2016 Raphaël Doursenaud
* Copyright (C) 2019-2020 Frédéric France
@@ -232,7 +232,7 @@ $tabsql[33] = "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_h
$tabsql[34] = "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
$tabsql[35] = "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c";
$tabsql[36] = "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
-$tabsql[37] = "SELECT r.rowid, r.code, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
+$tabsql[37] = "SELECT r.rowid, r.code, r.sortorder, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
$tabsql[38] = "SELECT rowid, entity, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
$tabsql[39] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel";
$tabsql[40] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcommcontact";
@@ -278,7 +278,7 @@ $tabsqlsort[33] = "code ASC";
$tabsqlsort[34] = "code ASC";
$tabsqlsort[35] = "c.label ASC";
$tabsqlsort[36] = "r.fk_c_exp_tax_cat ASC, r.range_ik ASC";
-$tabsqlsort[37] = "r.unit_type ASC, r.scale ASC, r.code ASC";
+$tabsqlsort[37] = "sortorder ASC";
$tabsqlsort[38] = "rowid, code ASC";
$tabsqlsort[39] = "sortorder ASC";
$tabsqlsort[40] = "code ASC";
@@ -324,7 +324,7 @@ $tabfield[33] = "code,label";
$tabfield[34] = "code,label";
$tabfield[35] = "label";
$tabfield[36] = "range_ik,fk_c_exp_tax_cat";
-$tabfield[37] = "code,label,short_label,unit_type,scale";
+$tabfield[37] = "code,label,short_label,unit_type,scale,sortorder";
$tabfield[38] = "code,label,url,icon,entity";
$tabfield[39] = "code,libelle,sortorder";
$tabfield[40] = "code,libelle,picto";
@@ -370,7 +370,7 @@ $tabfieldvalue[33] = "code,label";
$tabfieldvalue[34] = "code,label";
$tabfieldvalue[35] = "label";
$tabfieldvalue[36] = "range_ik,fk_c_exp_tax_cat";
-$tabfieldvalue[37] = "code,label,short_label,unit_type,scale";
+$tabfieldvalue[37] = "code,label,short_label,unit_type,scale,sortorder";
$tabfieldvalue[38] = "code,label,url,icon";
$tabfieldvalue[39] = "code,libelle,sortorder";
$tabfieldvalue[40] = "code,libelle,picto";
@@ -417,7 +417,7 @@ $tabfieldinsert[33] = "code,label";
$tabfieldinsert[34] = "code,label";
$tabfieldinsert[35] = "label";
$tabfieldinsert[36] = "range_ik,fk_c_exp_tax_cat";
-$tabfieldinsert[37] = "code,label,short_label,unit_type,scale";
+$tabfieldinsert[37] = "code,label,short_label,unit_type,scale,sortorder";
$tabfieldinsert[38] = "code,label,url,icon,entity";
$tabfieldinsert[39] = "code,label,sortorder";
$tabfieldinsert[40] = "code,libelle,picto";
diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php
index f2a672ec1a7..7219f901c9f 100644
--- a/htdocs/core/class/cunits.class.php
+++ b/htdocs/core/class/cunits.class.php
@@ -240,6 +240,7 @@ class CUnits // extends CommonObject
$sql = 'SELECT';
$sql .= " t.rowid,";
$sql .= " t.code,";
+ $sql .= " t.sortorder,";
$sql .= " t.label,";
$sql .= " t.short_label,";
$sql .= " t.unit_type,";
@@ -280,8 +281,9 @@ class CUnits // extends CommonObject
while ($obj = $this->db->fetch_object($resql)) {
$record = new self($this->db);
- $record->id = $obj->rowid;
+ $record->id = $obj->rowid;
$record->code = $obj->code;
+ $record->sortorder = $obj->sortorder;
$record->label = $obj->label;
$record->short_label = $obj->short_label;
$record->unit_type = $obj->unit_type;
@@ -318,6 +320,9 @@ class CUnits // extends CommonObject
if (isset($this->code)) {
$this->code = trim($this->code);
}
+ if (isset($this->sortorder)) {
+ $this->sortorder = trim($this->sortorder);
+ }
if (isset($this->label)) {
$this->libelle = trim($this->label);
}
@@ -340,6 +345,7 @@ class CUnits // extends CommonObject
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."c_units SET";
$sql .= " code=".(isset($this->code) ? "'".$this->db->escape($this->code)."'" : "null").",";
+ $sql .= " sortorder=".(isset($this->sortorder) ? "'".$this->db->escape($this->sortorder)."'" : "null").",";
$sql .= " label=".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").",";
$sql .= " short_label=".(isset($this->short_label) ? "'".$this->db->escape($this->short_label)."'" : "null").",";
$sql .= " unit_type=".(isset($this->unit_type) ? "'".$this->db->escape($this->unit_type)."'" : "null").",";
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index c69b794a011..da6b60218e2 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -4353,6 +4353,7 @@ class Form
if (!empty($unit_type)) {
$sql .= " AND unit_type = '".$this->db->escape($unit_type)."'";
}
+ $sql .= " ORDER BY sortorder";
$resql = $this->db->query($sql);
if ($resql && $this->db->num_rows($resql) > 0) {
diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
index 82a6bdec3dc..e99bbae7a10 100644
--- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
+++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
@@ -370,3 +370,5 @@ ALTER TABLE llx_hrm_skillrank ADD INDEX idx_hrm_skillrank_fk_skill (fk_skill);
ALTER TABLE llx_hrm_skillrank ADD CONSTRAINT llx_hrm_skillrank_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
--END GRH/HRM MODULE
+
+ALTER TABLE llx_c_units ADD COLUMN sortorder smallint AFTER code;
diff --git a/htdocs/install/mysql/tables/llx_c_units.sql b/htdocs/install/mysql/tables/llx_c_units.sql
index d4ff78b79f1..ef77703ae6e 100644
--- a/htdocs/install/mysql/tables/llx_c_units.sql
+++ b/htdocs/install/mysql/tables/llx_c_units.sql
@@ -19,11 +19,12 @@
-- ========================================================================
create table llx_c_units(
- rowid integer AUTO_INCREMENT PRIMARY KEY,
- code varchar(3),
- scale integer,
- label varchar(50),
- short_label varchar(5),
- unit_type varchar(10),
- active tinyint DEFAULT 1 NOT NULL
+ rowid integer AUTO_INCREMENT PRIMARY KEY,
+ code varchar(3),
+ sortorder smallint,
+ scale integer,
+ label varchar(50),
+ short_label varchar(5),
+ unit_type varchar(10),
+ active tinyint DEFAULT 1 NOT NULL
) ENGINE=innodb;
From b43dcb24f0b0c2819b30fed0bde5d76f8a6523d7 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Mon, 11 Oct 2021 11:04:21 +0200
Subject: [PATCH 047/449] Update fournisseur.commande.class.php
---
htdocs/fourn/class/fournisseur.commande.class.php | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index 2e9727de83c..02ffc77918a 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -2927,11 +2927,11 @@ class CommandeFournisseur extends CommonOrder
$this->user_approve_id2 = $obj->fk_user_approve2;
}
- $this->date_creation = $obj->datec;
- $this->date_modification = $obj->datem;
- $this->date_approve = $obj->datea;
- $this->date_approve2 = $obj->datea2;
- $this->date_validation = $obj->date_validation;
+ $this->date_creation = $this->db->jdate($obj->datec);
+ $this->date_modification = $this->db->jdate($obj->datem);
+ $this->date_approve = $this->db->jdate($obj->datea);
+ $this->date_approve2 = $this->db->jdate($obj->datea2);
+ $this->date_validation = $this->db->jdate($obj->date_validation);
}
$this->db->free($result);
} else {
From 57052e2fbabffa16b25a25fe02a1966e117d09db Mon Sep 17 00:00:00 2001
From: atm-florian
Date: Mon, 11 Oct 2021 11:10:14 +0200
Subject: [PATCH 048/449] FIX PR#18931 Remove useless explicit call to
dol_shutdown
---
htdocs/compta/facture/card.php | 1 -
htdocs/compta/facture/contact.php | 1 -
htdocs/compta/facture/document.php | 1 -
htdocs/compta/facture/info.php | 1 -
htdocs/compta/facture/note.php | 1 -
5 files changed, 5 deletions(-)
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index ab568332dd8..c772fd0ad7b 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -2763,7 +2763,6 @@ if (empty($object->id)) {
echo dol_get_fiche_head($head, 'compta', $langs->trans("InvoiceCustomer"), -1, 'bill'),
'' . $langs->trans("ErrorRecordNotFound") . '
';
llxFooter();
- dol_shutdown();
exit;
}
diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php
index c0e0a40c2c5..7177463c30e 100644
--- a/htdocs/compta/facture/contact.php
+++ b/htdocs/compta/facture/contact.php
@@ -125,7 +125,6 @@ if (empty($object->id)) {
echo dol_get_fiche_head($head, 'contact', $langs->trans("InvoiceCustomer"), -1, 'bill'),
'' . $langs->trans("ErrorRecordNotFound") . '
';
llxFooter();
- dol_shutdown();
exit;
}
diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php
index 64ebed251d3..0818b944705 100644
--- a/htdocs/compta/facture/document.php
+++ b/htdocs/compta/facture/document.php
@@ -92,7 +92,6 @@ if (empty($object->id)) {
echo dol_get_fiche_head($head, 'documents', $langs->trans("InvoiceCustomer"), -1, 'bill'),
'' . $langs->trans("ErrorRecordNotFound") . '
';
llxFooter();
- dol_shutdown();
exit;
}
diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php
index 9e40fd8b5a8..955c41693c0 100644
--- a/htdocs/compta/facture/info.php
+++ b/htdocs/compta/facture/info.php
@@ -50,7 +50,6 @@ if (empty($object->id)) {
echo dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill'),
'' . $langs->trans("ErrorRecordNotFound") . '
';
llxFooter();
- dol_shutdown();
exit;
}
diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php
index 428383b4907..dadb61b551d 100644
--- a/htdocs/compta/facture/note.php
+++ b/htdocs/compta/facture/note.php
@@ -71,7 +71,6 @@ if (empty($object->id)) {
echo dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill'),
'' . $langs->trans("ErrorRecordNotFound") . '
';
llxFooter();
- dol_shutdown();
exit;
}
From e899d94ed5c396edb5956ea7ed4011a0acd7cb42 Mon Sep 17 00:00:00 2001
From: Alexandre SPANGARO
Date: Mon, 11 Oct 2021 12:50:07 +0200
Subject: [PATCH 049/449] NEW Accountancy - rewrite bind accountancy code
finding on purchase invoice
---
htdocs/accountancy/supplier/index.php | 90 ++++++++++----
htdocs/accountancy/supplier/list.php | 161 ++++++++++----------------
2 files changed, 130 insertions(+), 121 deletions(-)
diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php
index 5e409f303ea..476ead53860 100644
--- a/htdocs/accountancy/supplier/index.php
+++ b/htdocs/accountancy/supplier/index.php
@@ -1,7 +1,7 @@
- * Copyright (C) 2013-2014 Florian Henry
- * Copyright (C) 2013-2020 Alexandre Spangaro
+ * Copyright (C) 2013-2021 Florian Henry
+ * Copyright (C) 2013-2021 Alexandre Spangaro
* Copyright (C) 2014 Juanjo Menent
*
* This program is free software; you can redistribute it and/or modify
@@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
+require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
// Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "other", "accountancy"));
@@ -44,6 +45,7 @@ if (!$user->rights->accounting->bind->write) {
accessforbidden();
}
+$accountingAccount = new AccountingAccount($db);
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
if (GETPOST("year", 'int')) {
@@ -97,6 +99,7 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid='.$conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity.')';
$sql1 .= ' AND fd.fk_facture_fourn IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_fourn WHERE entity = '.$conf->entity.')';
$sql1 .= ' AND fk_code_ventilation <> 0';
+
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
$resql1 = $db->query($sql1);
if (!$resql1) {
@@ -163,7 +166,7 @@ if ($action == 'validatehistory') {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_product_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql .= " AND l.product_type <= 2";
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
@@ -181,27 +184,74 @@ if ($action == 'validatehistory') {
$isBuyerInEEC = isInEEC($mysoc);
+ $thirdpartystatic = new Societe($db);
+ $facture_static = new FactureFournisseur($db);
+ $facture_static_det = new SupplierInvoiceLine($db);
+ $product_static = new Product($db);
+
$i = 0;
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
$objp = $db->fetch_object($result);
- $isSellerInEEC = isInEEC($objp);
+ $thirdpartystatic->id = $objp->socid;
+ $thirdpartystatic->name = $objp->name;
+ $thirdpartystatic->client = $objp->client;
+ $thirdpartystatic->fournisseur = $objp->fournisseur;
+ $thirdpartystatic->code_client = $objp->code_client;
+ $thirdpartystatic->code_compta_client = $objp->code_compta_client;
+ $thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
+ $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
+ $thirdpartystatic->email = $objp->email;
+ $thirdpartystatic->country_code = $objp->country_code;
+ $thirdpartystatic->tva_intra = $objp->tva_intra;
+ $thirdpartystatic->code_compta = $objp->company_code_sell;
- // Level 2: Search suggested account for product/service (similar code exists in page list.php to make manual binding)
- $suggestedaccountingaccountfor = '';
- if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
- $objp->code_buy_p = $objp->code_buy;
- $objp->aarowid_suggest = $objp->aarowid;
- $suggestedaccountingaccountfor = '';
+ $product_static->ref = $objp->product_ref;
+ $product_static->id = $objp->product_id;
+ $product_static->type = $objp->type;
+ $product_static->label = $objp->product_label;
+ $product_static->status = $objp->status;
+ $product_static->status_buy = $objp->status_buy;
+ $product_static->accountancy_code_sell = $objp->code_sell;
+ $product_static->accountancy_code_sell_intra = $objp->code_sell_intra;
+ $product_static->accountancy_code_sell_export = $objp->code_sell_export;
+ $product_static->accountancy_code_buy = $objp->code_buy;
+ $product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
+ $product_static->accountancy_code_buy_export = $objp->code_buy_export;
+ $product_static->tva_tx = $objp->tva_tx_prod;
+
+ $facture_static->ref = $objp->ref;
+ $facture_static->id = $objp->facid;
+ $facture_static->type = $objp->ftype;
+ $facture_static->datef = $objp->datef;
+
+ $facture_static_det->id = $objp->rowid;
+ $facture_static_det->total_ht = $objp->total_ht;
+ $facture_static_det->tva_tx = $objp->tva_tx_line;
+ $facture_static_det->vat_src_code = $objp->vat_src_code;
+ $facture_static_det->product_type = $objp->type_l;
+ $facture_static_det->desc = $objp->description;
+
+ $accoutingAccountArray = array(
+ 'dom'=>$objp->aarowid,
+ 'intra'=>$objp->aarowid_intra,
+ 'export'=>$objp->aarowid_export,
+ 'thirdparty' =>$objp->aarowid_thirdparty);
+
+ $code_buy_p_notset = '';
+ $code_buy_t_notset = '';
+
+ $return = $accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facture_static, $facture_static_det, $accoutingAccountArray);
+ if (!is_array($return) && $return<0) {
+ setEventMessage($accountingAccount->error, 'errors');
} else {
- if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
- $objp->code_buy_p = $objp->code_buy_intra;
- $objp->aarowid_suggest = $objp->aarowid_intra;
- $suggestedaccountingaccountfor = 'eec';
- } else { // Foreign sale
- $objp->code_buy_p = $objp->code_buy_export;
- $objp->aarowid_suggest = $objp->aarowid_export;
- $suggestedaccountingaccountfor = 'export';
+ $suggestedid=$return['suggestedid'];
+ $suggestedaccountingaccountfor=$return['suggestedaccountingaccountfor'];
+
+ if (!empty($suggestedid) && $suggestedaccountingaccountfor<>'') {
+ $suggestedid=$return['suggestedid'];
+ } else {
+ $suggestedid=0;
}
}
@@ -216,8 +266,8 @@ if ($action == 'validatehistory') {
if ($objp->aarowid_suggest > 0) {
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
- $sqlupdate .= " SET fk_code_ventilation = ".((int) $objp->aarowid_suggest);
- $sqlupdate .= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".((int) $objp->rowid);
+ $sqlupdate .= " SET fk_code_ventilation = ".((int) $suggestedid);
+ $sqlupdate .= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".((int) $facture_static_det->id);
$resqlupdate = $db->query($sqlupdate);
if (!$resqlupdate) {
diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php
index ffdd5b6de57..d3bb7985376 100644
--- a/htdocs/accountancy/supplier/list.php
+++ b/htdocs/accountancy/supplier/list.php
@@ -2,7 +2,7 @@
/* Copyright (C) 2013-2014 Olivier Geffroy
* Copyright (C) 2013-2021 Alexandre Spangaro
* Copyright (C) 2014-2015 Ari Elbaz (elarifr)
- * Copyright (C) 2013-2014 Florian Henry
+ * Copyright (C) 2013-2021 Florian Henry
* Copyright (C) 2014 Juanjo Menent s
* Copyright (C) 2016 Laurent Destailleur
*
@@ -46,6 +46,7 @@ $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array');
+$optioncss = GETPOST('optioncss', 'alpha');
// Select Box
$mesCasesCochees = GETPOST('toselect', 'array');
@@ -97,10 +98,7 @@ if (!$sortorder) {
$hookmanager->initHooks(array('accountancysupplierlist'));
$formaccounting = new FormAccounting($db);
-$accounting = new AccountingAccount($db);
-// TODO: we should need to check if result is a really exist accountaccount rowid.....
-$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
-$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
+$accountingAccount = new AccountingAccount($db);
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
@@ -518,9 +516,9 @@ if ($result) {
$thirdpartystatic = new Societe($db);
$facturefourn_static = new FactureFournisseur($db);
+ $facturefourn_static_det = new SupplierInvoiceLine($db);
$product_static = new Product($db);
- $isBuyerInEEC = isInEEC($mysoc);
$accountingaccount_codetotid_cache = array();
@@ -543,6 +541,8 @@ if ($result) {
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
$thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code;
+ $thirdpartystatic->tva_intra = $objp->tva_intra;
+ $thirdpartystatic->code_compta_fournisseur = $objp->company_code_buy;
$product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id;
@@ -556,95 +556,63 @@ if ($result) {
$product_static->accountancy_code_buy = $objp->code_buy;
$product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
$product_static->accountancy_code_buy_export = $objp->code_buy_export;
+ $product_static->tva_tx = $objp->tva_tx_prod;
$facturefourn_static->ref = $objp->ref;
$facturefourn_static->id = $objp->facid;
$facturefourn_static->type = $objp->ftype;
$facturefourn_static->label = $objp->invoice_label;
+ $facturefourn_static_det->id = $objp->rowid;
+ $facturefourn_static_det->total_ht = $objp->total_ht;
+ $facturefourn_static_det->tva_tx_line = $objp->tva_tx_line;
+ $facturefourn_static_det->vat_src_code = $objp->vat_src_code;
+ $facturefourn_static_det->product_type = $objp->type_l;
+ $facturefourn_static_det->desc = $objp->description;
+
$code_buy_p_notset = '';
$code_buy_t_notset = '';
$objp->aarowid_suggest = ''; // Will be set later
- $isSellerInEEC = isInEEC($objp);
+ $accoutingAccountArray = array(
+ 'dom'=>$objp->aarowid,
+ 'intra'=>$objp->aarowid_intra,
+ 'export'=>$objp->aarowid_export,
+ 'thirdparty' =>$objp->aarowid_thirdparty);
- // Level 1: Search suggested default account for product/service
- $suggestedaccountingaccountbydefaultfor = '';
- if ($objp->type_l == 1) {
- if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
- $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : '');
- $suggestedaccountingaccountbydefaultfor = '';
- } else {
- if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
- $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : '');
- $suggestedaccountingaccountbydefaultfor = 'eec';
- } else { // Foreign sale
- $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : '');
- $suggestedaccountingaccountbydefaultfor = 'export';
- }
- }
- } elseif ($objp->type_l == 0) {
- if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
- $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : '');
- $suggestedaccountingaccountbydefaultfor = '';
- } else {
- if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
- $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : '');
- $suggestedaccountingaccountbydefaultfor = 'eec';
- } else {
- $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : '');
- $suggestedaccountingaccountbydefaultfor = 'export';
- }
- }
- }
- if ($objp->code_sell_l == -1) {
- $objp->code_sell_l = '';
- }
+ $code_buy_p_notset = '';
+ $code_buy_t_notset = '';
- // Level 2: Search suggested account for product/service (similar code exists in page index.php to make automatic binding)
- $suggestedaccountingaccountfor = '';
- if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
- $objp->code_buy_p = $objp->code_buy;
- $objp->aarowid_suggest = $objp->aarowid;
- $suggestedaccountingaccountfor = '';
+ $return=$accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facture_static, $facture_static_det, $accoutinAccountArray);
+ if (!is_array($return) && $return<0) {
+ setEventMessage($accountingAccount->error, 'errors');
} else {
- if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
- $objp->code_buy_p = $objp->code_buy_intra;
- $objp->aarowid_suggest = $objp->aarowid_intra;
- $suggestedaccountingaccountfor = 'eec';
- } else { // Foreign sale
- $objp->code_buy_p = $objp->code_buy_export;
- $objp->aarowid_suggest = $objp->aarowid_export;
- $suggestedaccountingaccountfor = 'export';
- }
+ $suggestedid=$return['suggestedid'];
+ $suggestedaccountingaccountfor=$return['suggestedaccountingaccountfor'];
+ $suggestedaccountingaccountbydefaultfor=$return['suggestedaccountingaccountbydefaultfor'];
+ $code_buy_l=$return['code_buy_l'];
+ $code_buy_p=$return['code_buy_p'];
+ $code_buy_t=$return['code_buy_t'];
}
+ //var_dump($return);
- // Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
- if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
- if (!empty($objp->company_code_buy)) {
- $objp->code_buy_t = $objp->company_code_buy;
- $objp->aarowid_suggest = $objp->aarowid_thirdparty;
- $suggestedaccountingaccountfor = '';
- }
- }
-
- if (!empty($objp->code_buy_p)) {
+ if (!empty($code_buy_p)) {
// Value was defined previously
} else {
$code_buy_p_notset = 'color:orange';
}
- if (empty($objp->code_buy_l) && empty($objp->code_buy_p)) {
+ if (empty($code_buy_l) && empty($code_buy_p)) {
$code_buy_p_notset = 'color:red';
}
- // $objp->code_buy_l is now default code of product/service
- // $objp->code_buy_p is now code of product/service
- // $objp->code_buy_t is now code of thirdparty
+ // $code_buy_l is now default code of product/service
+ // $code_buy_p is now code of product/service
+ // $code_buy_t is now code of thirdparty
print '';
// Line id
- print ''.$objp->rowid.' ';
+ print ''.$facturefourn_static_det->id.' ';
// Ref Invoice
print ''.$facturefourn_static->getNomUrl(1).' ';
@@ -654,23 +622,23 @@ if ($result) {
print '';
*/
- print ''.dol_print_date($db->jdate($objp->datef), 'day').' ';
+ print ''.dol_print_date($db->jdate($facturefourn_static_det->datef), 'day').' ';
// Ref Product
print '';
if ($product_static->id > 0) {
print $product_static->getNomUrl(1);
}
- if ($objp->product_label) {
- print ''.$objp->product_label.' ';
+ if ($product_static->product_label) {
+ print ''.$product_static->product_label.' ';
}
print ' ';
// Description
print '';
- $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
+ $text = dolGetFirstLineOfText(dol_string_nohtmltag($facturefourn_static_det->desc));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
- print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
+ print $form->textwithtooltip(dol_trunc($text, $trunclength), $facturefourn_static_det->desc);
print ' ';
print '';
@@ -678,11 +646,11 @@ if ($result) {
print ' ';
// Vat rate
- if ($objp->vat_tx_l != $objp->vat_tx_p) {
+ if ($product_static->vat_tx_l != $product_static->vat_tx_p) {
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
}
print '';
- print vatrate($objp->tva_tx_line.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : ''));
+ print vatrate($facturefourn_static_det->tva_tx_line.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''));
print ' ';
// Thirdparty
@@ -699,26 +667,26 @@ if ($result) {
// Found accounts
print '';
- $s = '1. '.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
+ $s = '1. '.(($facturefourn_static_det->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
$shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') {
$shelp .= $langs->trans("SaleEEC");
} elseif ($suggestedaccountingaccountbydefaultfor == 'export') {
$shelp .= $langs->trans("SaleExport");
}
- $s .= ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : ''.$langs->trans("NotDefined").' ');
+ $s .= ($code_buy_l > 0 ? length_accountg($code_buy_l) : ''.$langs->trans("NotDefined").' ');
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
- if ($objp->product_id > 0) {
+ if ($product_static->id > 0) {
print ' ';
- $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
- $shelp = '';
+ $s = '2. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
+ $shelp = ''; $ttype = 'help';
if ($suggestedaccountingaccountfor == 'eec') {
$shelp = $langs->trans("SaleEEC");
} elseif ($suggestedaccountingaccountfor == 'export') {
$shelp = $langs->trans("SaleExport");
}
- $s .= (empty($objp->code_buy_p) ? ''.$langs->trans("NotDefined").' ' : length_accountg($objp->code_buy_p));
- print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
+ $s .= (empty($code_buy_p) ? ''.$langs->trans("NotDefined").' ' : length_accountg($code_buy_p));
+ print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
} else {
print ' ';
$s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
@@ -728,35 +696,26 @@ if ($result) {
}
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
print ' ';
- $s = '3. '.(($objp->type_l == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': ';
+ $s = '3. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': ';
$shelp = '';
- $s .= ($objp->code_buy_t > 0 ? length_accountg($objp->code_buy_t) : ''.$langs->trans("NotDefined").' ');
+ $s .= ($code_buy_t > 0 ? length_accountg($code_buy_t) : ''.$langs->trans("NotDefined").' ');
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
}
print ' ';
// Suggested accounting account
print '';
- $suggestedid = $objp->aarowid_suggest;
- if (empty($suggestedid) && empty($objp->code_buy_p) && !empty($objp->code_buy_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC)) {
- if (empty($accountingaccount_codetotid_cache[$objp->code_buy_l])) {
- $tmpaccount = new AccountingAccount($db);
- $tmpaccount->fetch(0, $objp->code_buy_l, 1);
- if ($tmpaccount->id > 0) {
- $suggestedid = $tmpaccount->id;
- }
- $accountingaccount_codetotid_cache[$objp->code_buy_l] = $tmpaccount->id;
- } else {
- $suggestedid = $accountingaccount_codetotid_cache[$objp->code_buy_l];
- }
- }
- print $formaccounting->select_account($suggestedid, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
+ print $formaccounting->select_account($suggestedid, 'codeventil'.$facturefourn_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
print ' ';
// Column with checkbox
print '';
- $ischecked = $objp->aarowid_suggest;
- print ' ';
+ if (!empty($suggestedid)) {
+ $ischecked = 1;
+ } else {
+ $ischecked = 0;
+ }
+ print ' ';
print ' ';
print ' ';
From af8e8077b163eda70c4d0ca72a14d782a6590040 Mon Sep 17 00:00:00 2001
From: Alexandre SPANGARO
Date: Mon, 11 Oct 2021 12:50:16 +0200
Subject: [PATCH 050/449] Uniformize
---
htdocs/accountancy/customer/index.php | 19 +++++++++++++++----
htdocs/accountancy/customer/list.php | 9 ++++-----
2 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php
index 7c3cc2cf0e2..795da583486 100644
--- a/htdocs/accountancy/customer/index.php
+++ b/htdocs/accountancy/customer/index.php
@@ -73,12 +73,23 @@ $action = GETPOST('action', 'aZ09');
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
+// Security check
+if (empty($conf->accounting->enabled)) {
+ accessforbidden();
+}
+if ($user->socid > 0) {
+ accessforbidden();
+}
+if (empty($user->rights->accounting->mouvements->lire)) {
+ accessforbidden();
+}
+
/*
* Actions
*/
-if ($action == 'clean' || $action == 'validatehistory') {
+if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accounting->bind->write) {
// Clean database
$db->begin();
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as fd";
@@ -165,6 +176,7 @@ if ($action == 'validatehistory') {
}
dol_syslog('htdocs/accountancy/customer/index.php');
+
$result = $db->query($sql);
if (!$result) {
$error++;
@@ -209,7 +221,6 @@ if ($action == 'validatehistory') {
$product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
$product_static->accountancy_code_buy_export = $objp->code_buy_export;
$product_static->tva_tx = $objp->tva_tx_prod;
- $product_static->tva_tx = $objp->tva_tx_prod;
$facture_static->ref = $objp->ref;
$facture_static->id = $objp->facid;
@@ -223,7 +234,7 @@ if ($action == 'validatehistory') {
$facture_static_det->product_type = $objp->type_l;
$facture_static_det->desc = $objp->description;
- $accoutinAccountArray = array(
+ $accoutingAccountArray = array(
'dom'=>$objp->aarowid,
'intra'=>$objp->aarowid_intra,
'export'=>$objp->aarowid_export,
@@ -232,7 +243,7 @@ if ($action == 'validatehistory') {
$code_sell_p_notset = '';
$code_sell_t_notset = '';
- $return=$accountingAccount->getAccountingCodeToBind($thirdpartystatic, $mysoc, $product_static, $facture_static, $facture_static_det, $accoutinAccountArray);
+ $return=$accountingAccount->getAccountingCodeToBind($thirdpartystatic, $mysoc, $product_static, $facture_static, $facture_static_det, $accoutingAccountArray);
if (!is_array($return) && $return<0) {
setEventMessage($accountingAccount->error, 'errors');
} else {
diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php
index a730a8a9af6..88e6c52be3d 100644
--- a/htdocs/accountancy/customer/list.php
+++ b/htdocs/accountancy/customer/list.php
@@ -2,7 +2,7 @@
/* Copyright (C) 2013-2014 Olivier Geffroy
* Copyright (C) 2013-2021 Alexandre Spangaro
* Copyright (C) 2014-2015 Ari Elbaz (elarifr)
- * Copyright (C) 2013-2014 Florian Henry
+ * Copyright (C) 2013-2021 Florian Henry
* Copyright (C) 2014 Juanjo Menent
* Copyright (C) 2016 Laurent Destailleur
*
@@ -192,10 +192,10 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
dol_syslog("accountancy/customer/list.php", LOG_DEBUG);
if ($db->query($sql)) {
- $msg .= ''.$langs->trans("Lineofinvoice", $monId).' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
';
+ $msg .= ''.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
';
$ok++;
} else {
- $msg .= ''.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice", $monId).' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).' '.$sql.' ';
+ $msg .= ''.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).' '.$sql.' ';
$ko++;
}
}
@@ -550,7 +550,6 @@ if ($result) {
$product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
$product_static->accountancy_code_buy_export = $objp->code_buy_export;
$product_static->tva_tx = $objp->tva_tx_prod;
- $product_static->tva_tx = $objp->tva_tx_prod;
$facture_static->ref = $objp->ref;
$facture_static->id = $objp->facid;
@@ -564,7 +563,7 @@ if ($result) {
$facture_static_det->product_type = $objp->type_l;
$facture_static_det->desc = $objp->description;
- $accoutinAccountArray = array(
+ $accoutingAccountArray = array(
'dom'=>$objp->aarowid,
'intra'=>$objp->aarowid_intra,
'export'=>$objp->aarowid_export,
From 91164951deb1f246e50183cb72ecc96bf6afe84d Mon Sep 17 00:00:00 2001
From: Benjamin Chantalat <74144396+PyroShape@users.noreply.github.com>
Date: Mon, 11 Oct 2021 15:24:56 +0200
Subject: [PATCH 051/449] Remove not complete order from virtual stock
---
htdocs/product/class/product.class.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index d746bf4a812..acb66eb1ebb 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -5271,7 +5271,7 @@ class Product extends CommonObject
$stock_sending_client = $this->stats_expedition['qty'];
}
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) {
- $filterStatus = empty($conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK) ? '2,3,4' : $conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK;
+ $filterStatus = empty($conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK) ? '3,4' : $conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK;
if (isset($includedraftpoforvirtual)) {
$filterStatus = '0,1,2,'.$filterStatus; // 1,2 may have already been inside $filterStatus but it is better to have twice than missing $filterStatus does not include them
}
From 7c8bde885bf85abf454d57444a27a80bd9da2be9 Mon Sep 17 00:00:00 2001
From: atm-lena
Date: Mon, 11 Oct 2021 16:03:56 +0200
Subject: [PATCH 052/449] hook createDictioaryFieldList : tr html tag to right
place
---
htdocs/admin/dict.php | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 897fcdf7555..ab7eaf73653 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -1238,6 +1238,10 @@ if ($id)
print $tdsoffields;
+ // Line to enter new values
+ print '';
+ print '';
+
$obj = new stdClass();
// If data was already input, we define them in obj to populate input fields.
if (GETPOST('actionadd'))
@@ -1256,9 +1260,6 @@ if ($id)
if ($id == 3) unset($fieldlist[2]); // Remove field ??? if dictionary Regions
- // Line to enter new values
- print '';
- print ' ';
if (empty($reshook))
{
From 5fc0802eb1a6462d923c04f0e3e503254012cda7 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Mon, 11 Oct 2021 16:13:55 +0200
Subject: [PATCH 053/449] Fix for backward compatibility
---
htdocs/core/lib/functions.lib.php | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 54ef73f19d6..ac019f33bc2 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -41,6 +41,30 @@
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
+/**
+ * Return dolibarr global constant string value
+ * @param string $key key to return value, return '' if not set
+ * @return string
+ */
+function getDolGlobalString($key)
+{
+ global $conf;
+ // return $conf->global->$key ?? '';
+ return (string) (empty($conf->global->$key) ? '' : $conf->global->$key);
+}
+
+/**
+ * Return dolibarr global constant int value
+ * @param string $key key to return value, return 0 if not set
+ * @return int
+ */
+function getDolGlobalInt($key)
+{
+ global $conf;
+ // return $conf->global->$key ?? 0;
+ return (int) (empty($conf->global->$key) ? 0 : $conf->global->$key);
+}
+
/**
* Return a DoliDB instance (database handler).
*
From 3a32787f150d7071210a00a6ead2aeae752a2c25 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Mon, 11 Oct 2021 16:14:34 +0200
Subject: [PATCH 054/449] Fix for backward compatibility
---
htdocs/core/lib/functions.lib.php | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 51b7442defe..01e8acf4896 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -40,6 +40,30 @@
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
+/**
+ * Return dolibarr global constant string value
+ * @param string $key key to return value, return '' if not set
+ * @return string
+ */
+function getDolGlobalString($key)
+{
+ global $conf;
+ // return $conf->global->$key ?? '';
+ return (string) (empty($conf->global->$key) ? '' : $conf->global->$key);
+}
+
+/**
+ * Return dolibarr global constant int value
+ * @param string $key key to return value, return 0 if not set
+ * @return int
+ */
+function getDolGlobalInt($key)
+{
+ global $conf;
+ // return $conf->global->$key ?? 0;
+ return (int) (empty($conf->global->$key) ? 0 : $conf->global->$key);
+}
+
/**
* Return a DoliDB instance (database handler).
*
From 4e9c7c9efb4166f79cc159615e6a19f4a661ca2c Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Mon, 11 Oct 2021 20:04:45 +0200
Subject: [PATCH 055/449] FIX Attachment of pdf into shipment when sending
email
---
htdocs/core/class/html.formmail.class.php | 2 ++
htdocs/core/lib/files.lib.php | 5 +++--
htdocs/core/tpl/massactions_pre.tpl.php | 5 +----
htdocs/expedition/card.php | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 3dc2743adf1..40496ee7fa9 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -792,6 +792,7 @@ class FormMail extends Form
if (count($listofpaths)) {
foreach ($listofpaths as $key => $val) {
$relativepathtofile = substr($val, (strlen(DOL_DATA_ROOT) - strlen($val)));
+
if ($conf->entity > 1) {
$relativepathtofile = str_replace($conf->entity.'/', '', $relativepathtofile);
}
@@ -802,6 +803,7 @@ class FormMail extends Form
$out .= '';
// Preview of attachment
$out .= img_mime($listofnames[$key]).' '.$listofnames[$key];
+
$out .= $formfile->showPreview(array(), $formfile_params[2], $formfile_params[4]);
if (!$this->withfilereadonly) {
$out .= '
';
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index 43ad95157dc..613f7f2d8a8 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -2707,13 +2707,14 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
if ($fuser->rights->expedition->{$lire} || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
- $original_file = $conf->expedition->dir_output."/sending/".$original_file;
+ $original_file = $conf->expedition->dir_output."/".(strpos('sending/', $original_file) == 0 ? '' : 'sending/').$original_file;
+ //$original_file = $conf->expedition->dir_output."/".$original_file;
} elseif (($modulepart == 'livraison' || $modulepart == 'delivery') && !empty($conf->expedition->dir_output)) {
// Delivery Note Wrapping
if ($fuser->rights->expedition->delivery->{$lire} || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
- $original_file = $conf->expedition->dir_output."/receipt/".$original_file;
+ $original_file = $conf->expedition->dir_output."/".(strpos('receipt/', $original_file) == 0 ? '' : 'receipt/').$original_file;
} elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) {
// Wrapping pour les actions
if ($fuser->rights->agenda->myactions->{$read} || preg_match('/^specimen/i', $original_file)) {
diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php
index f9c74dd7085..91fc11ac217 100644
--- a/htdocs/core/tpl/massactions_pre.tpl.php
+++ b/htdocs/core/tpl/massactions_pre.tpl.php
@@ -99,12 +99,9 @@ if ($massaction == 'presend') {
print '
';
- include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
- $formmail = new FormMail($db);
-
print dol_get_fiche_head(null, '', '');
- // Cree l'objet formulaire mail
+ // Create mail form
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$formmail->withform = -1;
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index 902914c4327..3d2b995233a 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -2552,8 +2552,8 @@ if ($action == 'create') {
// Presend form
$modelmail = 'shipping_send';
- $defaulttopic = 'SendShippingRef';
- $diroutput = $conf->expedition->dir_output;
+ $defaulttopic = $langs->trans('SendShippingRef');
+ $diroutput = $conf->expedition->dir_output.'/sending';
$trackid = 'shi'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
From 2e32254574c03e712024f5a4c6ddb92e747598da Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Mon, 11 Oct 2021 20:36:10 +0200
Subject: [PATCH 056/449] Fix rul to shipment files
---
htdocs/core/lib/files.lib.php | 4 ++--
htdocs/core/lib/functions.lib.php | 24 ------------------------
2 files changed, 2 insertions(+), 26 deletions(-)
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index 613f7f2d8a8..36feaf79a6e 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -2707,14 +2707,14 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
if ($fuser->rights->expedition->{$lire} || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
- $original_file = $conf->expedition->dir_output."/".(strpos('sending/', $original_file) == 0 ? '' : 'sending/').$original_file;
+ $original_file = $conf->expedition->dir_output."/".(strpos('sending/', $original_file) === 0 ? '' : 'sending/').$original_file;
//$original_file = $conf->expedition->dir_output."/".$original_file;
} elseif (($modulepart == 'livraison' || $modulepart == 'delivery') && !empty($conf->expedition->dir_output)) {
// Delivery Note Wrapping
if ($fuser->rights->expedition->delivery->{$lire} || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
- $original_file = $conf->expedition->dir_output."/".(strpos('receipt/', $original_file) == 0 ? '' : 'receipt/').$original_file;
+ $original_file = $conf->expedition->dir_output."/".(strpos('receipt/', $original_file) === 0 ? '' : 'receipt/').$original_file;
} elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) {
// Wrapping pour les actions
if ($fuser->rights->agenda->myactions->{$read} || preg_match('/^specimen/i', $original_file)) {
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 443a757b512..e0dcc51917b 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -65,30 +65,6 @@ function getDolGlobalInt($key)
return (int) (empty($conf->global->$key) ? 0 : $conf->global->$key);
}
-/**
- * Return dolibarr global constant string value
- * @param string $key key to return value, return '' if not set
- * @return string
- */
-function getDolGlobalString($key)
-{
- global $conf;
- // return $conf->global->$key ?? '';
- return (string) (empty($conf->global->$key) ? '' : $conf->global->$key);
-}
-
-/**
- * Return dolibarr global constant int value
- * @param string $key key to return value, return 0 if not set
- * @return int
- */
-function getDolGlobalInt($key)
-{
- global $conf;
- // return $conf->global->$key ?? 0;
- return (int) (empty($conf->global->$key) ? 0 : $conf->global->$key);
-}
-
/**
* Return a DoliDB instance (database handler).
*
From 17885089636859773c1bce76c66dec3a59af0479 Mon Sep 17 00:00:00 2001
From: lvessiller
Date: Tue, 12 Oct 2021 14:11:19 +0200
Subject: [PATCH 057/449] FIX payment style and html5 tags
---
htdocs/takepos/css/pos.css.php | 7 ++--
htdocs/takepos/pay.php | 66 +++++++++++++++++-----------------
2 files changed, 35 insertions(+), 38 deletions(-)
diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php
index e180dc33b3e..395c786b232 100644
--- a/htdocs/takepos/css/pos.css.php
+++ b/htdocs/takepos/css/pos.css.php
@@ -320,12 +320,11 @@ table.postablelines tr td {
div.paymentbordline
{
- width:calc(50% - 16px);
- background-color:#888;
+ background-color: #888;
border-radius: 8px;
- margin-bottom: 4px;
- display: inline-block;
+ margin: 4px auto;
padding: 5px;
+ width: calc(50% - 10px);
}
@media only screen and (max-aspect-ratio: 6/4) {
diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php
index 60a4840471e..66d710c2a52 100644
--- a/htdocs/takepos/pay.php
+++ b/htdocs/takepos/pay.php
@@ -37,9 +37,9 @@ if (!defined('NOREQUIREMENU')) {
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', '1');
}
-if (!defined('NOREQUIREAJAX')) {
- define('NOREQUIREAJAX', '1');
-}
+//if (!defined('NOREQUIREAJAX')) {
+// define('NOREQUIREAJAX', '1');
+//}
require '../main.inc.php'; // Load $user and permissions
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
@@ -257,38 +257,36 @@ if ($conf->global->TAKEPOS_NUMPAD == 0) {
}
-
-
-
-
trans('TotalTTC'); ?>: total_ttc, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?>
+
+
+
+ trans('TotalTTC'); ?>: total_ttc, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?>
+
+ total_ttc) { ?>
+
+ trans('RemainToPay'); ?>: multicurrency_code); ?>
+
+
+
+ trans("Received"); ?>: multicurrency_code); ?>
+
+
+ trans("Change"); ?>: multicurrency_code); ?>
+
+ global->TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT)) {
+ require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
+ print '
';
+ $filter = '';
+ $form = new Form($db);
+ print ''.$langs->trans("BankAccount").': ';
+ $form->select_comptes(0, 'accountid', 0, $filter, 1, '');
+ print ajax_combobox('selectaccountid');
+ print '
';
+ }
+ ?>
+
-total_ttc) { ?>
-
-
trans('RemainToPay'); ?>: multicurrency_code); ?>
-
-
-
-
trans("Received"); ?>: multicurrency_code); ?>
-
-
-
trans("Change"); ?>: multicurrency_code); ?>
-
-global->TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT)) {
- print '
-
';
- $filter = '';
- $form = new Form($db);
- print ''.$langs->trans("BankAccount").': ';
- $form->select_comptes(0, 'accountid', 0, $filter, 1, '');
- print ajax_combobox('selectaccountid');
- print '
- ';
-}
-?>
-
-
-
Date: Tue, 12 Oct 2021 15:52:59 +0200
Subject: [PATCH 058/449] FIX 2 columns for total labels
---
htdocs/takepos/css/pos.css.php | 7 +++--
htdocs/takepos/pay.php | 54 ++++++++++++++++------------------
2 files changed, 30 insertions(+), 31 deletions(-)
diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php
index 395c786b232..e180dc33b3e 100644
--- a/htdocs/takepos/css/pos.css.php
+++ b/htdocs/takepos/css/pos.css.php
@@ -320,11 +320,12 @@ table.postablelines tr td {
div.paymentbordline
{
- background-color: #888;
+ width:calc(50% - 16px);
+ background-color:#888;
border-radius: 8px;
- margin: 4px auto;
+ margin-bottom: 4px;
+ display: inline-block;
padding: 5px;
- width: calc(50% - 10px);
}
@media only screen and (max-aspect-ratio: 6/4) {
diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php
index 66d710c2a52..4bd20f33f4b 100644
--- a/htdocs/takepos/pay.php
+++ b/htdocs/takepos/pay.php
@@ -257,35 +257,33 @@ if ($conf->global->TAKEPOS_NUMPAD == 0) {
}
-
-
-
- trans('TotalTTC'); ?>: total_ttc, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?>
-
- total_ttc) { ?>
-
- trans('RemainToPay'); ?>: multicurrency_code); ?>
-
-
-
- trans("Received"); ?>: multicurrency_code); ?>
-
-
- trans("Change"); ?>: multicurrency_code); ?>
-
- global->TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT)) {
- require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
- print '
';
- $filter = '';
- $form = new Form($db);
- print ''.$langs->trans("BankAccount").': ';
- $form->select_comptes(0, 'accountid', 0, $filter, 1, '');
- print ajax_combobox('selectaccountid');
- print '
';
- }
- ?>
+
+
+ trans('TotalTTC'); ?>: total_ttc, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?>
+ total_ttc) { ?>
+
+ trans('RemainToPay'); ?>: multicurrency_code); ?>
+
+
+
+ trans("Received"); ?>: multicurrency_code); ?>
+
+
+ trans("Change"); ?>: multicurrency_code); ?>
+
+ global->TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT)) {
+ require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
+ print '
';
+ $filter = '';
+ $form = new Form($db);
+ print ''.$langs->trans("BankAccount").': ';
+ $form->select_comptes(0, 'accountid', 0, $filter, 1, '');
+ print ajax_combobox('selectaccountid');
+ print '
';
+ }
+ ?>
From d50c1a7603d7bc18bc62a0ded07172be8bdfa025 Mon Sep 17 00:00:00 2001
From: Vincent Dieltiens
Date: Tue, 12 Oct 2021 23:23:57 +0200
Subject: [PATCH 059/449] preview of expense report file using pdf file instead
of generated image
---
htdocs/expensereport/card.php | 3 +++
1 file changed, 3 insertions(+)
diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php
index 6e40b6b3a77..f700feb400b 100644
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -2174,7 +2174,10 @@ if ($action == 'create') {
// If the preview file is found
if (file_exists($fileimage)) {
$thumbshown = 1;
+ $urlforhref = getAdvancedPreviewUrl($modulepart, $relativepath.'/'.$fileinfo['filename'].'.'.strtolower($fileinfo['extension']), 1, '&entity='.(!empty($object->entity) ? $object->entity : $conf->entity));
+ print '';
print ' ';
+ print ' ';
}
}
}
From 04091169dab12429e88430b9f2eb3cf0f8fd9e90 Mon Sep 17 00:00:00 2001
From: Alexandre SPANGARO
Date: Wed, 13 Oct 2021 02:48:42 +0200
Subject: [PATCH 060/449] Accountancy - Show message for admin if accountancy
hidden options are activated to help to resolve some problems
---
htdocs/accountancy/admin/index.php | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php
index f8c0c95d3c1..4f4bff526c8 100644
--- a/htdocs/accountancy/admin/index.php
+++ b/htdocs/accountancy/admin/index.php
@@ -1,7 +1,7 @@
* Copyright (C) 2013-2014 Florian Henry
- * Copyright (C) 2013-2019 Alexandre Spangaro
+ * Copyright (C) 2013-2021 Alexandre Spangaro
* Copyright (C) 2014-2015 Ari Elbaz (elarifr)
* Copyright (C) 2014 Marcos García
* Copyright (C) 2014 Juanjo Menent
@@ -260,6 +260,22 @@ $linkback = '';
//$linkback = '' . $langs->trans("BackToModuleList") . ' ';
print load_fiche_titre($title, $linkback, 'accountancy');
+// Show message if accountancy hidden options are activated to help to resolve some problems
+if (!$user->admin) {
+ if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
+ print '' . $langs->trans("ConstantIsOn", "FACTURE_DEPOSITS_ARE_JUST_PAYMENTS") . '
';
+ }
+ if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
+ print '' . $langs->trans("ConstantIsOn", "ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY") . '
';
+ }
+ if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
+ print '' . $langs->trans("ConstantIsOn", "MAIN_COMPANY_PERENTITY_SHARED") . '
';
+ }
+ if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
+ print '' . $langs->trans("ConstantIsOn", "MAIN_PRODUCT_PERENTITY_SHARED") . '
';
+ }
+}
+
print '';
print ' ';
print ' ';
From 3a04a0115b4c1dc93223873f1349cb6b742a2b50 Mon Sep 17 00:00:00 2001
From: Alexandre SPANGARO
Date: Wed, 13 Oct 2021 03:26:39 +0200
Subject: [PATCH 061/449] Add data sortorder
---
htdocs/install/mysql/data/llx_c_units.sql | 80 ++++++++++++-----------
1 file changed, 41 insertions(+), 39 deletions(-)
diff --git a/htdocs/install/mysql/data/llx_c_units.sql b/htdocs/install/mysql/data/llx_c_units.sql
index 3a11453c9f8..59692793fe2 100644
--- a/htdocs/install/mysql/data/llx_c_units.sql
+++ b/htdocs/install/mysql/data/llx_c_units.sql
@@ -1,7 +1,9 @@
-- ========================================================================
--- Copyright (C) 2001-2002,2004 Rodolphe Quiedeville
--- Copyright (C) 2004 Laurent Destailleur
--- Copyright (C) 2019 Florian Henry
+-- Copyright (C) 2001-2002,2004 Rodolphe Quiedeville
+-- Copyright (C) 2004 Laurent Destailleur
+-- Copyright (C) 2019 Florian Henry
+-- Copyright (C) 2021 Alexandre Spangaro
+--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
@@ -17,45 +19,45 @@
--
-- ========================================================================
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('T', '3','WeightUnitton','T', 'weight', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('KG', '0','WeightUnitkg','kg', 'weight', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('G', '-3','WeightUnitg','g', 'weight', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('MG','-6','WeightUnitmg','mg', 'weight', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('OZ','98','WeightUnitounce','Oz', 'weight', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('LB','99','WeightUnitpound','lb', 'weight', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('T', '100', '3','WeightUnitton','T', 'weight', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('KG','110', '0','WeightUnitkg','kg', 'weight', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('G', '120','-3','WeightUnitg','g', 'weight', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('MG','130','-6','WeightUnitmg','mg', 'weight', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('OZ','140','98','WeightUnitounce','Oz', 'weight', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('LB','150','99','WeightUnitpound','lb', 'weight', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('M', '0','SizeUnitm','m', 'size', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('DM','-1','SizeUnitdm','dm', 'size', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('CM','-2','SizeUnitcm','cm', 'size', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('MM','-3','SizeUnitmm','mm', 'size', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('FT','98','SizeUnitfoot','ft', 'size', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('IN','99','SizeUnitinch','in', 'size', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('M', '200', '0','SizeUnitm','m', 'size', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('DM','210','-1','SizeUnitdm','dm', 'size', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('CM','220','-2','SizeUnitcm','cm', 'size', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('MM','230','-3','SizeUnitmm','mm', 'size', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('FT','240','98','SizeUnitfoot','ft', 'size', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('IN','250','99','SizeUnitinch','in', 'size', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('M2', '0','SurfaceUnitm2','m2', 'surface', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('DM2','-2','SurfaceUnitdm2','dm2', 'surface', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('CM2','-4','SurfaceUnitcm2','cm2', 'surface', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('MM2','-6','SurfaceUnitmm2','mm2', 'surface', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('FT2','98','SurfaceUnitfoot2','ft2', 'surface', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('IN2','99','SurfaceUnitinch2','in2', 'surface', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('M2', '300', '0','SurfaceUnitm2','m2', 'surface', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('DM2','310','-2','SurfaceUnitdm2','dm2', 'surface', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('CM2','320','-4','SurfaceUnitcm2','cm2', 'surface', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('MM2','330','-6','SurfaceUnitmm2','mm2', 'surface', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('FT2','340','98','SurfaceUnitfoot2','ft2', 'surface', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('IN2','350','99','SurfaceUnitinch2','in2', 'surface', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('M3', '0','VolumeUnitm3','m3', 'volume', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('DM3','-3','VolumeUnitdm3','dm3', 'volume', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('CM3','-6','VolumeUnitcm3','cm3', 'volume', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('MM3','-9','VolumeUnitmm3','mm3', 'volume', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('FT3','88','VolumeUnitfoot3','ft3', 'volume', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('IN3','89','VolumeUnitinch3','in3', 'volume', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('OZ3','97','VolumeUnitounce','Oz', 'volume', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('L', '98','VolumeUnitlitre','L', 'volume', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('GAL','99','VolumeUnitgallon','gal', 'volume', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('M3', '400', '0','VolumeUnitm3','m3', 'volume', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('DM3','410','-3','VolumeUnitdm3','dm3', 'volume', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('CM3','420','-6','VolumeUnitcm3','cm3', 'volume', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('MM3','430','-9','VolumeUnitmm3','mm3', 'volume', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('FT3','440','88','VolumeUnitfoot3','ft3', 'volume', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('IN3','450','89','VolumeUnitinch3','in3', 'volume', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('OZ3','460','97','VolumeUnitounce','Oz', 'volume', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('L', '470','98','VolumeUnitlitre','L', 'volume', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('GAL','480','99','VolumeUnitgallon','gal', 'volume', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('P', '0','Piece','p', 'qty', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('SET', '0','Set','set', 'qty', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('P', '500', '0','Piece','p', 'qty', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('SET','510', '0','Set','set', 'qty', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('S', '0','second','s', 'time', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('MI', '60','minute','i', 'time', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('H', '3600','hour','h', 'time', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('D', '86400','day','d', 'time', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('W', '604800','week','w', 'time', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('MO','2629800','month','m', 'time', 1);
-INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('Y','31557600','year','y', 'time', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('S', '600', '0','second','s', 'time', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('MI','610', '60','minute','i', 'time', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('H', '620', '3600','hour','h', 'time', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('D', '630', '86400','day','d', 'time', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('W', '640', '604800','week','w', 'time', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('MO','650', '2629800','month','m', 'time', 1);
+INSERT INTO llx_c_units (code, sortorder, scale, label, short_label, unit_type, active) VALUES ('Y', '660','31557600','year','y', 'time', 1);
From ce37323f697be20d84d03173238b1e8dbdc680e1 Mon Sep 17 00:00:00 2001
From: Regis Houssin
Date: Wed, 13 Oct 2021 14:14:30 +0200
Subject: [PATCH 062/449] FIX avoid non-numeric warning
---
htdocs/core/lib/invoice.lib.php | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php
index 193c4c3acb7..7c0dbbd084c 100644
--- a/htdocs/core/lib/invoice.lib.php
+++ b/htdocs/core/lib/invoice.lib.php
@@ -518,8 +518,10 @@ function getNumberInvoicesPieChart($mode)
$dataseries[$i]=array($langs->trans('NbOfOpenInvoices'), $obj->nblate30, $obj->nblate15 - $obj->nblate30, $obj->nblatenow - $obj->nblate15, $obj->nbnotlatenow - $obj->nbnotlate15, $obj->nbnotlate15 - $obj->nbnotlate30, $obj->nbnotlate30);
$i++;
}
- foreach ($dataseries[0] as $key=>$value) {
- $total += $value;
+ if (!empty($dataseries[0])) {
+ foreach ($dataseries[0] as $key=>$value) {
+ $total += $value;
+ }
}
$legend = array(
$langs->trans('InvoiceLate30Days'),
From f14de50bd787a932c9a15eced029467322395292 Mon Sep 17 00:00:00 2001
From: Regis Houssin
Date: Wed, 13 Oct 2021 14:26:43 +0200
Subject: [PATCH 063/449] FIX check if numeric value
---
htdocs/core/lib/invoice.lib.php | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php
index 7c0dbbd084c..573f27c1eee 100644
--- a/htdocs/core/lib/invoice.lib.php
+++ b/htdocs/core/lib/invoice.lib.php
@@ -519,8 +519,10 @@ function getNumberInvoicesPieChart($mode)
$i++;
}
if (!empty($dataseries[0])) {
- foreach ($dataseries[0] as $key=>$value) {
- $total += $value;
+ foreach ($dataseries[0] as $key => $value) {
+ if (is_numeric($value)) {
+ $total += $value;
+ }
}
}
$legend = array(
From 230af380109061ca4d2e1a5e5900f72a556f1562 Mon Sep 17 00:00:00 2001
From: javieralapps4up
Date: Wed, 13 Oct 2021 14:34:50 +0200
Subject: [PATCH 064/449] Update factures.php
When the list is greater than $ conf-> liste_limit, no more pages are output
---
htdocs/compta/prelevement/factures.php | 3 +++
1 file changed, 3 insertions(+)
diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php
index c00c29e1c39..17755b535ff 100644
--- a/htdocs/compta/prelevement/factures.php
+++ b/htdocs/compta/prelevement/factures.php
@@ -220,6 +220,9 @@ if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
+ if ($limit > 0 && $limit != $conf->liste_limit) {
+ $param.='&limit='.urlencode($limit);
+ }
$param = "&id=".urlencode($id);
// Lines of title fields
From d264bbca3c43b10507c486c1e046768236a1afbb Mon Sep 17 00:00:00 2001
From: stickler-ci
Date: Wed, 13 Oct 2021 12:36:58 +0000
Subject: [PATCH 065/449] Fixing style errors.
---
htdocs/compta/prelevement/factures.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php
index 17755b535ff..e5483a6c2fe 100644
--- a/htdocs/compta/prelevement/factures.php
+++ b/htdocs/compta/prelevement/factures.php
@@ -221,8 +221,8 @@ if ($resql) {
$i = 0;
if ($limit > 0 && $limit != $conf->liste_limit) {
- $param.='&limit='.urlencode($limit);
- }
+ $param.='&limit='.urlencode($limit);
+ }
$param = "&id=".urlencode($id);
// Lines of title fields
From b612815aed93e514bed30678e07aa82bc5d7451b Mon Sep 17 00:00:00 2001
From: Regis Houssin
Date: Wed, 13 Oct 2021 14:43:42 +0200
Subject: [PATCH 066/449] FIX wrong accented characters with DolGraph
---
htdocs/contrat/class/contrat.class.php | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index a7a42ca7350..a23a620359e 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -2770,20 +2770,20 @@ class ContratLigne extends CommonObjectLine
$langs->load("contracts");
if ($status == self::STATUS_INITIAL) {
- $labelStatus = $langs->trans("ServiceStatusInitial");
- $labelStatusShort = $langs->trans("ServiceStatusInitial");
+ $labelStatus = $langs->transnoentities("ServiceStatusInitial");
+ $labelStatusShort = $langs->transnoentities("ServiceStatusInitial");
} elseif ($status == self::STATUS_OPEN && $expired == -1) {
- $labelStatus = $langs->trans("ServiceStatusRunning");
- $labelStatusShort = $langs->trans("ServiceStatusRunning");
+ $labelStatus = $langs->transnoentities("ServiceStatusRunning");
+ $labelStatusShort = $langs->transnoentities("ServiceStatusRunning");
} elseif ($status == self::STATUS_OPEN && $expired == 0) {
- $labelStatus = $langs->trans("ServiceStatusNotLate");
- $labelStatusShort = $langs->trans("ServiceStatusNotLateShort");
+ $labelStatus = $langs->transnoentities("ServiceStatusNotLate");
+ $labelStatusShort = $langs->transnoentities("ServiceStatusNotLateShort");
} elseif ($status == self::STATUS_OPEN && $expired == 1) {
- $labelStatus = $langs->trans("ServiceStatusLate");
- $labelStatusShort = $langs->trans("ServiceStatusLateShort");
+ $labelStatus = $langs->transnoentities("ServiceStatusLate");
+ $labelStatusShort = $langs->transnoentities("ServiceStatusLateShort");
} elseif ($status == self::STATUS_CLOSED) {
- $labelStatus = $langs->trans("ServiceStatusClosed");
- $labelStatusShort = $langs->trans("ServiceStatusClosed");
+ $labelStatus = $langs->transnoentities("ServiceStatusClosed");
+ $labelStatusShort = $langs->transnoentities("ServiceStatusClosed");
}
$statusType = 'status'.$status;
From 3c33770f00955c4460ab7a7739bfa614d5974628 Mon Sep 17 00:00:00 2001
From: Maxime Kohlhaas
Date: Wed, 13 Oct 2021 15:30:49 +0200
Subject: [PATCH 067/449] Fix member creation from thirdparty extrafields
---
htdocs/adherents/card.php | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index 7199423669a..e54ac0bc31a 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -790,10 +790,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
if (!empty($socid)) {
- $object = new Societe($db);
- if ($socid > 0) $object->fetch($socid);
+ $soc = new Societe($db);
+ if ($socid > 0) $soc->fetch($socid);
- if (!($object->id > 0)) {
+ if (!($soc->id > 0)) {
$langs->load("errors");
print($langs->trans('ErrorRecordNotFound'));
exit;
@@ -877,7 +877,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print "\n";
// Company
- print ''.$langs->trans("Company").' ';
+ print ''.$langs->trans("Company").' ';
// Civility
print ''.$langs->trans("UserTitle").' ';
@@ -901,32 +901,32 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// EMail
print ' '.($conf->global->ADHERENT_MAIL_REQUIRED ? '' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? ' ' : '').' ';
- print ''.img_picto('', 'object_email').' ';
+ print ''.img_picto('', 'object_email').' ';
// Address
print ''.$langs->trans("Address").' ';
- print ''.(GETPOSTISSET('address') ?GETPOST('address', 'alphanohtml') : $object->address).' ';
+ print ''.(GETPOSTISSET('address') ?GETPOST('address', 'alphanohtml') : $soc->address).' ';
print ' ';
// Zip / Town
print ''.$langs->trans("Zip").' / '.$langs->trans("Town").' ';
- print $formcompany->select_ziptown((GETPOSTISSET('zipcode') ? GETPOST('zipcode', 'alphanohtml') : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
+ print $formcompany->select_ziptown((GETPOSTISSET('zipcode') ? GETPOST('zipcode', 'alphanohtml') : $soc->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
print ' ';
- print $formcompany->select_ziptown((GETPOSTISSET('town') ? GETPOST('town', 'alphanohtml') : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
+ print $formcompany->select_ziptown((GETPOSTISSET('town') ? GETPOST('town', 'alphanohtml') : $soc->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
print ' ';
// Country
$object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id;
print ''.$langs->trans('Country').' ';
- print $form->select_country(GETPOSTISSET('country_id') ? GETPOST('country_id', 'alpha') : $object->country_id, 'country_id');
+ print $form->select_country(GETPOSTISSET('country_id') ? GETPOST('country_id', 'alpha') : $soc->country_id, 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print ' ';
// State
if (empty($conf->global->MEMBER_DISABLE_STATE)) {
print ''.$langs->trans('State').' ';
- if ($object->country_id) {
- print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOST('state_id', 'int') : $object->state_id, $object->country_code);
+ if ($soc->country_id) {
+ print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOST('state_id', 'int') : $soc->state_id, $soc->country_code);
} else {
print $countrynotdefined;
}
@@ -935,7 +935,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Pro phone
print ' '.$langs->trans("PhonePro").' ';
- print ''.img_picto('', 'object_phoning').' ';
+ print ''.img_picto('', 'object_phoning').' ';
// Personal phone
print ''.$langs->trans("PhonePerso").' ';
From 3438a4a9f695b9526604f3a0da5857858fe33f31 Mon Sep 17 00:00:00 2001
From: Benjamin Chantalat <74144396+PyroShape@users.noreply.github.com>
Date: Thu, 14 Oct 2021 09:33:26 +0200
Subject: [PATCH 068/449] Add the module reception to the calcul of virtual
stock
---
htdocs/product/class/product.class.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index acb66eb1ebb..c7a48479f60 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -5281,7 +5281,7 @@ class Product extends CommonObject
}
$stock_commande_fournisseur = $this->stats_commande_fournisseur['qty'];
}
- if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && empty($conf->reception->enabled)) {
+ if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) || !empty($conf->reception->enabled)) {
$filterStatus = '4';
if (isset($includedraftpoforvirtual)) {
$filterStatus = '0,'.$filterStatus;
From 371c75e76a1be84fc4ce497f2d7ccb70256d41f6 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Thu, 14 Oct 2021 11:58:21 +0200
Subject: [PATCH 069/449] FIX list of categories in stats of supplier invoices
---
htdocs/compta/facture/stats/index.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php
index 49f9be88ac6..7482faebad8 100644
--- a/htdocs/compta/facture/stats/index.php
+++ b/htdocs/compta/facture/stats/index.php
@@ -283,7 +283,7 @@ if (! empty($conf->category->enabled)) {
$cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Supplier"));
}
print ''.$cat_label.' ';
- $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1);
+ $cate_arbo = $form->select_all_categories($cat_type, null, 'parent', null, null, 1);
print $form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), null, null, null, null, "90%");
//print $formother->select_categories($cat_type, $categ_id, 'categ_id', true);
print ' ';
From 27e8b17aafa008271691910ca40622e070ce577d Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Thu, 14 Oct 2021 14:49:01 +0200
Subject: [PATCH 070/449] NEW Add STOCK_MOVEMENT_LIST_HIDE_UNIT_PRICE to hide
unit price on movement list.
---
htdocs/product/stock/movement_list.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php
index bdd22c313ee..f3b9ea40559 100644
--- a/htdocs/product/stock/movement_list.php
+++ b/htdocs/product/stock/movement_list.php
@@ -132,7 +132,7 @@ $arrayfields = array(
'origin'=>array('label'=>"Origin", 'checked'=>1, 'position'=>155),
'm.fk_projet'=>array('label'=>'Project', 'checked'=>0, 'position'=>180),
'm.value'=>array('label'=>"Qty", 'checked'=>1, 'position'=>200),
- 'm.price'=>array('label'=>"UnitPurchaseValue", 'checked'=>0, 'position'=>210)
+ 'm.price'=>array('label'=>"UnitPurchaseValue", 'checked'=>0, 'position'=>210, 'enabled'=>empty($conf->global->STOCK_MOVEMENT_LIST_HIDE_UNIT_PRICE))
//'m.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
//'m.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500)
);
From db3d16f080a1151ab581920553b6d4dd227aed42 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Thu, 14 Oct 2021 15:43:35 +0200
Subject: [PATCH 071/449] Fix filter tag for supplier invoice statistics
---
htdocs/compta/facture/stats/index.php | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php
index 7482faebad8..fb47a3eb788 100644
--- a/htdocs/compta/facture/stats/index.php
+++ b/htdocs/compta/facture/stats/index.php
@@ -92,18 +92,15 @@ print load_fiche_titre($title, '', $picto);
dol_mkdir($dir);
$stats = new FactureStats($db, $socid, $mode, ($userid > 0 ? $userid : 0), ($typent_id > 0 ? $typent_id : 0), ($categ_id > 0 ? $categ_id : 0));
-if ($mode == 'customer')
-{
- if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')';
+if ($mode == 'customer' || $mode == 'supplier') {
+ if ($object_status != '' && $object_status >= 0) {
+ $stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')';
+ }
if (is_array($custcats) && !empty($custcats)) {
$stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_societe as cat ON (f.fk_soc = cat.fk_soc)';
$stats->where .= ' AND cat.fk_categorie IN ('.implode(',', $custcats).')';
}
}
-if ($mode == 'supplier')
-{
- if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')';
-}
// Build graphic number of object
// $data = array(array('Lib',val1,val2,val3),...)
From 3875d26a2feb7f6fb39cc158101521f7b563b617 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Thu, 14 Oct 2021 15:55:12 +0200
Subject: [PATCH 072/449] Fix filter for supplierinvoice stats
---
htdocs/compta/facture/stats/index.php | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php
index fb47a3eb788..03fcf5b37d0 100644
--- a/htdocs/compta/facture/stats/index.php
+++ b/htdocs/compta/facture/stats/index.php
@@ -92,7 +92,7 @@ print load_fiche_titre($title, '', $picto);
dol_mkdir($dir);
$stats = new FactureStats($db, $socid, $mode, ($userid > 0 ? $userid : 0), ($typent_id > 0 ? $typent_id : 0), ($categ_id > 0 ? $categ_id : 0));
-if ($mode == 'customer' || $mode == 'supplier') {
+if ($mode == 'customer') {
if ($object_status != '' && $object_status >= 0) {
$stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')';
}
@@ -101,6 +101,16 @@ if ($mode == 'customer' || $mode == 'supplier') {
$stats->where .= ' AND cat.fk_categorie IN ('.implode(',', $custcats).')';
}
}
+if ($mode == 'supplier') {
+ if ($object_status != '' && $object_status >= 0) {
+ $stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')';
+ }
+ if (is_array($custcats) && !empty($custcats)) {
+ $stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_fournisseur as cat ON (f.fk_soc = cat.fk_soc)';
+ $stats->where .= ' AND cat.fk_categorie IN ('.implode(',', $custcats).')';
+ }
+
+}
// Build graphic number of object
// $data = array(array('Lib',val1,val2,val3),...)
From a6c3c6b7ec8f1b3d30a364234ac7376fedda677e Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Thu, 14 Oct 2021 15:56:01 +0200
Subject: [PATCH 073/449] url
---
htdocs/compta/facture/stats/index.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php
index 5fe028e1268..088899956e4 100644
--- a/htdocs/compta/facture/stats/index.php
+++ b/htdocs/compta/facture/stats/index.php
@@ -119,10 +119,10 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
$filenamenb = $dir."/invoicesnbinyear-".$year.".png";
if ($mode == 'customer') {
- $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$year.'.png';
+ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$year.'.png';
}
if ($mode == 'supplier') {
- $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicesnbinyear-'.$year.'.png';
+ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicesnbinyear-'.$year.'.png';
}
$px1 = new DolGraph();
From 5d22eeeff2b946573481983953b446326f89539a Mon Sep 17 00:00:00 2001
From: lvessiller
Date: Thu, 14 Oct 2021 16:06:22 +0200
Subject: [PATCH 074/449] FIX user date timezone offset
---
htdocs/core/lib/functions.lib.php | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index e0dcc51917b..3ef328924f5 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -2284,8 +2284,17 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
} elseif ($tzoutput == 'tzuser' || $tzoutput == 'tzuserrel') {
$to_gmt = true;
$offsettzstring = (empty($_SESSION['dol_tz_string']) ? 'UTC' : $_SESSION['dol_tz_string']); // Example 'Europe/Berlin' or 'Indian/Reunion'
- $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore
- $offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60; // Will not be used anymore
+
+ if (class_exists('DateTimeZone')) {
+ $user_date_tz = new DateTimeZone($offsettzstring);
+ $user_dt = new DateTime();
+ $user_dt->setTimezone($user_date_tz);
+ $user_dt->setTimestamp($time);
+ $offsettz = $user_dt->getOffset();
+ } else {
+ $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore
+ $offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60; // Will not be used anymore
+ }
}
}
}
From ff7727466ad129070c0b56965eb0457f0ddf1795 Mon Sep 17 00:00:00 2001
From: atm-lena
Date: Thu, 14 Oct 2021 17:13:44 +0200
Subject: [PATCH 075/449] Function updateExtrafield : replace empty value to
null
---
htdocs/core/class/commonobject.class.php | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 5a5e1a58928..50c6f1893ea 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -5492,7 +5492,6 @@ abstract class CommonObject
}
$sql .= ")";
-
$resql = $this->db->query($sql);
if (!$resql)
{
@@ -5792,7 +5791,7 @@ abstract class CommonObject
}
if ($linealreadyfound) {
- if ($this->array_options["options_".$key] === null) {
+ if ($this->array_options["options_".$key] === '') {
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET ".$key." = null";
} else {
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET ".$key." = '".$this->db->escape($this->array_options["options_".$key])."'";
From 3d62ee22d323f821b81e725e60c32bfdc1585ef1 Mon Sep 17 00:00:00 2001
From: Henry
Date: Fri, 15 Oct 2021 11:13:40 +0800
Subject: [PATCH 076/449] Supplier Invoice Payment List
fix the missing multicurrency payments and remainders
---
htdocs/fourn/facture/paiement.php | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php
index f0967453701..1dd6f0a0f12 100644
--- a/htdocs/fourn/facture/paiement.php
+++ b/htdocs/fourn/facture/paiement.php
@@ -642,13 +642,19 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '';
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
- print price($objp->multicurrency_am);
+ print price($sign * $multicurrency_payment);
+ if ($multicurrency_creditnotes) {
+ print '+'.price($multicurrency_creditnotes);
+ }
+ if ($multicurrency_deposits) {
+ print '+'.price($multicurrency_deposits);
+ }
}
print ' ';
print '';
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
- print price($objp->multicurrency_total_ttc - $objp->multicurrency_am);
+ print price($sign * $multicurrency_remaintopay);
}
print ' ';
}
From 316bc16634ffc8abb76bae5cb3b8c8e7af59a86d Mon Sep 17 00:00:00 2001
From: Henry
Date: Fri, 15 Oct 2021 15:05:13 +0800
Subject: [PATCH 077/449] Update card.php
---
htdocs/fourn/facture/card.php | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index 80f868f3484..8a148bbb666 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -2406,6 +2406,15 @@ if ($action == 'create') {
// $resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
+ // Multicurrency
+ if (!empty($conf->multicurrency->enabled)) {
+ $multicurrency_totalpaye = $object->getSommePaiement(1);
+ $multicurrency_totalcreditnotes = $object->getSumCreditNotesUsed(1);
+ $multicurrency_totaldeposits = $object->getSumDepositsUsed(1);
+ $multicurrency_resteapayer = price2num($object->multicurrency_total_ttc - $multicurrency_totalpaye - $multicurrency_totalcreditnotes - $multicurrency_totaldeposits, 'MT');
+ $resteapayer = price2num($multicurrency_resteapayer / $object->multicurrency_tx, 'MT');
+ }
+
if ($object->paye) {
$resteapayer = 0;
}
From 0cb19726740a7e78c7e3e8a34e81f37bf3acde86 Mon Sep 17 00:00:00 2001
From: Henry
Date: Fri, 15 Oct 2021 15:07:48 +0800
Subject: [PATCH 078/449] Update card.php
---
htdocs/compta/facture/card.php | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 83c8ec8d718..5541725a480 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -3844,6 +3844,15 @@ if ($action == 'create') {
// $resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
// $resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
+
+ // Multicurrency
+ if (!empty($conf->multicurrency->enabled)) {
+ $multicurrency_totalpaye = $object->getSommePaiement(1);
+ $multicurrency_totalcreditnotes = $object->getSumCreditNotesUsed(1);
+ $multicurrency_totaldeposits = $object->getSumDepositsUsed(1);
+ $multicurrency_resteapayer = price2num($object->multicurrency_total_ttc - $multicurrency_totalpaye - $multicurrency_totalcreditnotes - $multicurrency_totaldeposits, 'MT');
+ $resteapayer = price2num($multicurrency_resteapayer / $object->multicurrency_tx, 'MT');
+ }
if ($object->paye) {
$resteapayer = 0;
From fb79aaeb0c2a4d187cc6aaa3c40430c975c125a2 Mon Sep 17 00:00:00 2001
From: stickler-ci
Date: Fri, 15 Oct 2021 07:19:49 +0000
Subject: [PATCH 079/449] Fixing style errors.
---
htdocs/compta/facture/card.php | 2 +-
htdocs/fourn/facture/card.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 5541725a480..56e66b9f759 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -3844,7 +3844,7 @@ if ($action == 'create') {
// $resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
// $resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
-
+
// Multicurrency
if (!empty($conf->multicurrency->enabled)) {
$multicurrency_totalpaye = $object->getSommePaiement(1);
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index 8a148bbb666..79a93cf3b0c 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -2414,7 +2414,7 @@ if ($action == 'create') {
$multicurrency_resteapayer = price2num($object->multicurrency_total_ttc - $multicurrency_totalpaye - $multicurrency_totalcreditnotes - $multicurrency_totaldeposits, 'MT');
$resteapayer = price2num($multicurrency_resteapayer / $object->multicurrency_tx, 'MT');
}
-
+
if ($object->paye) {
$resteapayer = 0;
}
From 412746ec8fea883dc437e6f3135d33773bc02be9 Mon Sep 17 00:00:00 2001
From: Gauthier PC portable 024
Date: Fri, 15 Oct 2021 10:18:32 +0200
Subject: [PATCH 080/449] NEW : we need to be able to put more filters on
deleteByParentField() function
---
htdocs/core/class/commonobject.class.php | 24 ++++++++++++++++++++++--
htdocs/hrm/class/job.class.php | 2 +-
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 37083cdf5f8..2bf6d758435 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -9056,10 +9056,13 @@ abstract class CommonObject
$className = str_replace('@', '', $deleteFromObject[0]);
$filePath = $deleteFromObject[1];
$columnName = $deleteFromObject[2];
+ $TMoreSQL = array();
+ $more_sql = $deleteFromObject[3];
+ if(!empty($more_sql)) $TMoreSQL['customsql'] = $more_sql;
if (dol_include_once($filePath)) {
$childObject = new $className($this->db);
if (method_exists($childObject, 'deleteByParentField')) {
- $result = $childObject->deleteByParentField($this->id, $columnName);
+ $result = $childObject->deleteByParentField($this->id, $columnName, $TMoreSQL);
if ($result < 0) {
$error++;
$this->errors[] = $childObject->error;
@@ -9144,7 +9147,7 @@ abstract class CommonObject
* @return int <0 if KO, >0 if OK
* @throws Exception
*/
- public function deleteByParentField($parentId = 0, $parentField = '')
+ public function deleteByParentField($parentId = 0, $parentField = '', $filter=array(), $filtermode="AND")
{
global $user;
@@ -9157,6 +9160,23 @@ abstract class CommonObject
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " WHERE ".$parentField." = ".(int) $parentId;
+ // Manage filter
+ $sqlwhere = array();
+ if (count($filter) > 0) {
+ foreach ($filter as $key => $value) {
+ if ($key == 'customsql') {
+ $sqlwhere[] = $value;
+ } elseif (strpos($value, '%') === false) {
+ $sqlwhere[] = $key.' IN ('.$this->db->sanitize($this->db->escape($value)).')';
+ } else {
+ $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\'';
+ }
+ }
+ }
+ if (count($sqlwhere) > 0) {
+ $sql .= " AND (".implode(" ".$filtermode." ", $sqlwhere).")";
+ }
+
$resql = $this->db->query($sql);
if (!$resql) {
$this->errors[] = $this->db->lasterror();
diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php
index 4ff5ccbe303..01cc9260c61 100644
--- a/htdocs/hrm/class/job.class.php
+++ b/htdocs/hrm/class/job.class.php
@@ -154,7 +154,7 @@ class Job extends CommonObject
// * If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will
// * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object
// */
- // protected $childtablesoncascade = array('hrm_jobdet');
+ protected $childtablesoncascade = array("@SkillRank:hrm/class/skillrank.class.php:fk_object:objecttype='job'");
// /**
// * @var JobLine[] Array of subtable lines
From 5f4410468d66efaae1da08606f20a29429c1d591 Mon Sep 17 00:00:00 2001
From: Florian HENRY
Date: Fri, 15 Oct 2021 10:24:56 +0200
Subject: [PATCH 081/449] add filed budget in task
---
htdocs/core/lib/project.lib.php | 17 +++++++-
.../install/mysql/migration/14.0.0-15.0.0.sql | 2 +
.../install/mysql/tables/llx_projet_task.sql | 1 +
htdocs/projet/class/task.class.php | 23 ++++++++++-
htdocs/projet/tasks.php | 29 +++++++++++++-
htdocs/projet/tasks/list.php | 39 ++++++++++++++++++-
htdocs/projet/tasks/task.php | 12 ++++++
7 files changed, 119 insertions(+), 4 deletions(-)
diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index 9d6b9c48192..b7c2279188d 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -572,7 +572,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
$numlines = count($lines);
// We declare counter as global because we want to edit them into recursive call
- global $total_projectlinesa_spent, $total_projectlinesa_planned, $total_projectlinesa_spent_if_planned, $total_projectlinesa_declared_if_planned, $total_projectlinesa_tobill, $total_projectlinesa_billed;
+ global $total_projectlinesa_spent, $total_projectlinesa_planned, $total_projectlinesa_spent_if_planned, $total_projectlinesa_declared_if_planned, $total_projectlinesa_tobill, $total_projectlinesa_billed, $total_budget_amount;
if ($level == 0) {
$total_projectlinesa_spent = 0;
@@ -581,6 +581,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
$total_projectlinesa_declared_if_planned = 0;
$total_projectlinesa_tobill = 0;
$total_projectlinesa_billed = 0;
+ $total_budget_amount = 0;
}
for ($i = 0; $i < $numlines; $i++) {
@@ -651,6 +652,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
$taskstatic->datee = $lines[$i]->date_end; // deprecated
$taskstatic->planned_workload = $lines[$i]->planned_workload;
$taskstatic->duration_effective = $lines[$i]->duration;
+ $taskstatic->budget_amount = $lines[$i]->budget_amount;
if ($showproject) {
@@ -850,6 +852,12 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
}
print '';
}*/
+ if (count($arrayfields) > 0 && !empty($arrayfields['c.assigned']['checked'])) {
+ print '';
+ print price($lines[$i]->budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
+ $total_budget_amount += $lines[$i]->budget_amount;
+ print ' ';
+ }
// Contacts of task
if (count($arrayfields) > 0 && !empty($arrayfields['c.assigned']['checked'])) {
@@ -1021,6 +1029,13 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
print '';
}
}
+
+ if (count($arrayfields) > 0 && !empty($arrayfields['t.budget_amount']['checked'])) {
+ print '';
+ price($total_budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
+ print ' ';
+ }
+
// Contacts of task for backward compatibility,
if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) {
print ' ';
diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
index 56ac0290292..44f7d08bab1 100644
--- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
+++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
@@ -374,3 +374,5 @@ ALTER TABLE llx_hrm_skillrank ADD CONSTRAINT llx_hrm_skillrank_fk_user_creat FOR
-- Manage accountancy auxiliary account for thirdparties per entity
ALTER TABLE llx_societe_perentity ADD COLUMN accountancy_code_customer varchar(24) AFTER entity; -- equivalent to code_compta in llx_societe
ALTER TABLE llx_societe_perentity ADD COLUMN accountancy_code_supplier varchar(24) AFTER accountancy_code_customer; -- equivalent to code_compta_supplier in llx_societe
+
+ALTER TABLE llx_projet_task ADD COLUMN budget_amount double(24,8) AFTER priority;
diff --git a/htdocs/install/mysql/tables/llx_projet_task.sql b/htdocs/install/mysql/tables/llx_projet_task.sql
index 01edb857738..721dbf8355f 100644
--- a/htdocs/install/mysql/tables/llx_projet_task.sql
+++ b/htdocs/install/mysql/tables/llx_projet_task.sql
@@ -35,6 +35,7 @@ create table llx_projet_task
planned_workload real DEFAULT 0,
progress integer DEFAULT 0, -- percentage increase
priority integer DEFAULT 0, -- priority
+ budget_amount double(24,8),
fk_user_creat integer, -- user who created the task
fk_user_modif integer, -- user who modify the task
fk_user_valid integer, -- user who validated the task
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index 085d092c2ac..240552ecc48 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -121,6 +121,16 @@ class Task extends CommonObject
public $comments = array();
+ /**
+ * @var float budget_amount
+ */
+ public $budget_amount;
+
+ /**
+ * @var float project_budget_amount
+ */
+ public $project_budget_amount;
+
public $oldcopy;
@@ -172,6 +182,7 @@ class Task extends CommonObject
$sql .= ", datee";
$sql .= ", planned_workload";
$sql .= ", progress";
+ $sql .= ", budget_amount";
$sql .= ") VALUES (";
$sql .= ((int) $conf->entity);
$sql .= ", ".((int) $this->fk_project);
@@ -185,6 +196,7 @@ class Task extends CommonObject
$sql .= ", ".($this->date_end ? "'".$this->db->idate($this->date_end)."'" : 'null');
$sql .= ", ".(($this->planned_workload != '' && $this->planned_workload >= 0) ? ((int) $this->planned_workload) : 'null');
$sql .= ", ".(($this->progress != '' && $this->progress >= 0) ? ((int) $this->progress) : 'null');
+ $sql .= ", ".(($this->budget_amount != '' && $this->budget_amount >= 0) ? ((int) $this->budget_amount) : 'null');
$sql .= ")";
$this->db->begin();
@@ -261,6 +273,7 @@ class Task extends CommonObject
$sql .= " t.fk_user_valid,";
$sql .= " t.fk_statut,";
$sql .= " t.progress,";
+ $sql .= " t.budget_amount,";
$sql .= " t.priority,";
$sql .= " t.note_private,";
$sql .= " t.note_public,";
@@ -304,6 +317,7 @@ class Task extends CommonObject
$this->fk_user_valid = $obj->fk_user_valid;
$this->fk_statut = $obj->fk_statut;
$this->progress = $obj->progress;
+ $this->budget_amount = $obj->budget_amount;
$this->priority = $obj->priority;
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
@@ -366,6 +380,9 @@ class Task extends CommonObject
if (isset($this->planned_workload)) {
$this->planned_workload = trim($this->planned_workload);
}
+ if (isset($this->budget_amount)) {
+ $this->budget_amount = trim($this->budget_amount);
+ }
// Check parameters
// Put here code to add control on parameters values
@@ -382,6 +399,7 @@ class Task extends CommonObject
$sql .= " dateo=".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null').",";
$sql .= " datee=".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null').",";
$sql .= " progress=".(($this->progress != '' && $this->progress >= 0) ? $this->progress : 'null').",";
+ $sql .= " budget_amount=".(($this->budget_amount != '' && $this->budget_amount >= 0) ? $this->budget_amount : 'null').",";
$sql .= " rang=".((!empty($this->rang)) ? $this->rang : "0");
$sql .= " WHERE rowid=".((int) $this->id);
@@ -791,8 +809,9 @@ class Task extends CommonObject
$sql .= " t.rowid as taskid, t.ref as taskref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut as status,";
$sql .= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang,";
$sql .= " t.description, ";
+ $sql .= " t.budget_amount, ";
$sql .= " s.rowid as thirdparty_id, s.nom as thirdparty_name, s.email as thirdparty_email,";
- $sql .= " p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount";
+ $sql .= " p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount as project_budget_amount";
if (!empty($extrafields->attributes['projet']['label'])) {
foreach ($extrafields->attributes['projet']['label'] as $key => $val) {
$sql .= ($extrafields->attributes['projet']['type'][$key] != 'separate' ? ",efp.".$key." as options_".$key : '');
@@ -897,6 +916,7 @@ class Task extends CommonObject
$sql .= " t.rowid, t.ref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut,";
$sql .= " t.dateo, t.datee, t.planned_workload, t.rang,";
$sql .= " t.description, ";
+ $sql .= " t.budget_amount, ";
$sql .= " s.rowid, s.nom, s.email,";
$sql .= " p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount";
if (!empty($extrafields->attributes['projet']['label'])) {
@@ -950,6 +970,7 @@ class Task extends CommonObject
$tasks[$i]->opp_amount = $obj->opp_amount;
$tasks[$i]->opp_percent = $obj->opp_percent;
$tasks[$i]->budget_amount = $obj->budget_amount;
+ $tasks[$i]->project_budget_amount = $obj->project_budget_amount;
$tasks[$i]->usage_bill_time = $obj->usage_bill_time;
$tasks[$i]->label = $obj->label;
diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php
index 2a814cd9cc5..ebd17ca9dd5 100644
--- a/htdocs/projet/tasks.php
+++ b/htdocs/projet/tasks.php
@@ -82,6 +82,7 @@ $search_planedworkload = GETPOST('search_planedworkload');
$search_timespend = GETPOST('search_timespend');
$search_progresscalc = GETPOST('search_progresscalc');
$search_progressdeclare = GETPOST('search_progressdeclare');
+$search_task_budget_amount = GETPOST('search_task_budget_amount');
$search_date_start_startmonth = GETPOST('search_date_start_startmonth', 'int');
$search_date_start_startyear = GETPOST('search_date_start_startyear', 'int');
@@ -142,6 +143,7 @@ $diroutputmassaction = $conf->projet->dir_output.'/tasks/temp/massgeneration/'.$
$hookmanager->initHooks(array('projecttaskscard', 'globalcard'));
$progress = GETPOST('progress', 'int');
+$budget_amount = GETPOST('budget_amount', 'int');
$label = GETPOST('label', 'alpha');
$description = GETPOST('description', 'restricthtml');
$planned_workloadhour = (GETPOST('planned_workloadhour', 'int') ?GETPOST('planned_workloadhour', 'int') : 0);
@@ -160,7 +162,8 @@ $arrayfields = array(
't.progress_calculated'=>array('label'=>$langs->trans("ProgressCalculated"), 'checked'=>1, 'position'=>8),
't.progress'=>array('label'=>$langs->trans("ProgressDeclared"), 'checked'=>1, 'position'=>9),
't.progress_summary'=>array('label'=>$langs->trans("TaskProgressSummary"), 'checked'=>1, 'position'=>10),
- 'c.assigned'=>array('label'=>$langs->trans("TaskRessourceLinks"), 'checked'=>1, 'position'=>11),
+ 't.budget_amount'=>array('label'=>"Budget", 'checked'=>1, 'position'=>11),
+ 'c.assigned'=>array('label'=>$langs->trans("TaskRessourceLinks"), 'checked'=>1, 'position'=>12),
);
if ($object->usage_bill_time) {
$arrayfields['t.tobill'] = array('label'=>$langs->trans("TimeToBill"), 'checked'=>0, 'position'=>11);
@@ -204,6 +207,7 @@ if (empty($reshook)) {
$search_timespend = '';
$search_progresscalc = '';
$search_progressdeclare = '';
+ $search_task_budget_amount = '';
$toselect = '';
$search_array_options = array();
$search_date_start_startmonth = "";
@@ -285,6 +289,10 @@ if (!empty($search_progressdeclare)) {
$morewherefilterarray[] = natural_search('t.progress', $search_progressdeclare, 1, 1);
}
+if ($search_task_budget_amount) {
+ $morewherefilterarray[]= natural_search('t.budget_amount', $search_task_budget_amount, 1);
+}
+
$morewherefilter = '';
if (count($morewherefilterarray) > 0) {
$morewherefilter = ' AND '.implode(' AND ', $morewherefilterarray);
@@ -338,6 +346,7 @@ if ($action == 'createtask' && $user->rights->projet->creer) {
$task->date_start = $date_start;
$task->date_end = $date_end;
$task->progress = $progress;
+ $task->budget_amount = $budget_amount;
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $task);
@@ -524,6 +533,9 @@ if ($id > 0 || !empty($ref)) {
if ($search_progressdeclare) {
$param .= '&search_progressdeclare='.urlencode($search_progressdeclare);
}
+ if ($search_task_budget_amount) {
+ $param .= '&search_task_budget_amount='.urlencode($search_task_budget_amount);
+ }
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
@@ -757,6 +769,10 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
print ''.$description.' ';
print ' ';
+ print ''.$langs->trans("Budget").' ';
+ print ' ';
+ print ' ';
+
// Other options
$parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $taskstatic, $action); // Note that $action and $object may have been modified by hook
@@ -944,6 +960,12 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
}
*/
+ if (!empty($arrayfields['t.budget_amount']['checked'])) {
+ print '';
+ print ' ';
+ print ' ';
+ }
+
if (!empty($arrayfields['c.assigned']['checked'])) {
print '';
print ' ';
@@ -1005,6 +1027,11 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
print_liste_field_titre("TaskRessourceLinks", $_SERVER["PHP_SELF"], '', '', $param, $sortfield, $sortorder);
}
*/
+
+ if (!empty($arrayfields['t.budget_amount']['checked'])) {
+ print_liste_field_titre($arrayfields['t.budget_amount']['label'], $_SERVER["PHP_SELF"], "t.budget_amount", "", $param, '', $sortfield, $sortorder, 'center ');
+ }
+
if (!empty($arrayfields['c.assigned']['checked'])) {
print_liste_field_titre($arrayfields['c.assigned']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center ', '');
}
diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php
index e6d8e5c6dfa..fc316fb2705 100644
--- a/htdocs/projet/tasks/list.php
+++ b/htdocs/projet/tasks/list.php
@@ -65,6 +65,7 @@ $search_task_ref_parent = GETPOST('search_task_ref_parent');
$search_project_user = GETPOST('search_project_user', 'int');
$search_task_user = GETPOST('search_task_user', 'int');
$search_task_progress = GETPOST('search_task_progress');
+$search_task_budget_amount = GETPOST('search_task_budget_amount');
$search_societe = GETPOST('search_societe');
$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
@@ -154,6 +155,7 @@ $arrayfields = array(
't.progress_calculated'=>array('label'=>"ProgressCalculated", 'checked'=>1, 'position'=>104),
't.progress'=>array('label'=>"ProgressDeclared", 'checked'=>1, 'position'=>105),
't.progress_summary'=>array('label'=>"TaskProgressSummary", 'checked'=>1, 'position'=>106),
+ 't.budget_amount'=>array('label'=>"Budget", 'checked'=>1, 'position'=>107),
't.tobill'=>array('label'=>"TimeToBill", 'checked'=>0, 'position'=>110),
't.billed'=>array('label'=>"TimeBilled", 'checked'=>0, 'position'=>111),
't.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
@@ -200,6 +202,7 @@ if (empty($reshook)) {
$search_task_description = "";
$search_task_ref_parent = "";
$search_task_progress = "";
+ $search_task_budget_amount = "";
$search_task_user = -1;
$search_project_user = -1;
$search_date_startday = '';
@@ -314,6 +317,7 @@ $sql .= " s.nom as name, s.rowid as socid,";
$sql .= " t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_update,";
$sql .= " t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut, ";
$sql .= " t.description, t.fk_task_parent";
+$sql .= " ,t.budget_amount";
// We'll need these fields in order to filter by categ
if ($search_categ) {
$sql .= ", cs.fk_categorie, cs.fk_project";
@@ -390,6 +394,9 @@ if ($search_task_ref_parent) {
if ($search_task_progress) {
$sql .= natural_search('t.progress', $search_task_progress, 1);
}
+if ($search_task_budget_amount) {
+ $sql .= natural_search('t.budget_amount', $search_task_budget_amount, 1);
+}
if ($search_societe) {
$sql .= natural_search('s.nom', $search_societe);
}
@@ -431,7 +438,7 @@ if (!empty($arrayfields['t.tobill']['checked']) || !empty($arrayfields['t.billed
$sql .= " GROUP BY p.rowid, p.ref, p.title, p.fk_statut, p.datee, p.fk_opp_status, p.public, p.fk_user_creat,";
$sql .= " s.nom, s.rowid,";
$sql .= " t.datec, t.dateo, t.datee, t.tms,";
- $sql .= " t.rowid, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut";
+ $sql .= " t.rowid, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress,t.budget_amount, t.fk_statut";
if ($search_categ) {
$sql .= ", cs.fk_categorie, cs.fk_project";
}
@@ -521,6 +528,9 @@ if ($search_datelimit_endmonth) {
if ($search_datelimit_endyear) {
$param .= '&search_datelimit_endyear='.urlencode($search_datelimit_endyear);
}
+if ($search_task_budget_amount) {
+ $param .= '&search_task_budget_amount='.urlencode($search_task_budget_amount);
+}
if ($socid) {
$param .= '&socid='.urlencode($socid);
}
@@ -756,6 +766,11 @@ if (!empty($arrayfields['t.progress']['checked'])) {
print ' ';
print '';
}
+if (!empty($arrayfields['t.budget_amount']['checked'])) {
+ print '';
+ print ' ';
+ print ' ';
+}
if (!empty($arrayfields['t.progress_summary']['checked'])) {
print ' ';
@@ -835,6 +850,9 @@ if (!empty($arrayfields['t.progress']['checked'])) {
if (!empty($arrayfields['t.progress_summary']['checked'])) {
print_liste_field_titre($arrayfields['t.progress_summary']['label'], $_SERVER["PHP_SELF"], "t.progress", "", $param, '', $sortfield, $sortorder, 'center ');
}
+if (!empty($arrayfields['t.budget_amount']['checked'])) {
+ print_liste_field_titre($arrayfields['t.budget_amount']['label'], $_SERVER["PHP_SELF"], "t.budget_amount", "", $param, '', $sortfield, $sortorder, 'center ');
+}
if (!empty($arrayfields['t.tobill']['checked'])) {
print_liste_field_titre($arrayfields['t.tobill']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center ');
}
@@ -877,6 +895,7 @@ while ($i < min($num, $limit)) {
$object->description = $obj->description;
$object->fk_statut = $obj->fk_statut;
$object->progress = $obj->progress;
+ $object->budget_amount = $obj->budget_amount;
$object->date_start = $db->jdate($obj->date_start);
$object->date_end = $db->jdate($obj->date_end);
$object->planned_workload = $obj->planned_workload;
@@ -1116,6 +1135,22 @@ while ($i < min($num, $limit)) {
$totalarray['totalprogress_summary'] = $totalarray['nbfield'];
}
}
+ if (!empty($arrayfields['t.budget_amount']['checked'])) {
+ print '';
+ print price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 't.budget_amount';
+ }
+ $totalarray['val']['t.budget_amount'] += $obj->budget_amount;
+ if (!$i) {
+ $totalarray['totalbudgetamount'] = $totalarray['nbfield'];
+ }
+ $totalarray['totalbudgetamount'] += $obj->budget_amount;
+ print ' ';
+ }
// Time not billed
if (!empty($arrayfields['t.tobill']['checked'])) {
print '';
@@ -1232,6 +1267,8 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota
print ' '.convertSecondToTime($totalarray['totaltobill'], $plannedworkloadoutputformat).' ';
} elseif ($totalarray['totalbilledfield'] == $i) {
print ''.convertSecondToTime($totalarray['totalbilled'], $plannedworkloadoutputformat).' ';
+ } elseif ($totalarray['totalbudgetamount'] == $i) {
+ print ''.price($totalarray['totalbudgetamount'], 0, $langs, 1, 0, 0, $conf->currency).' ';
} else {
print ' ';
}
diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php
index 2ae9bb7cc80..42280f57c67 100644
--- a/htdocs/projet/tasks/task.php
+++ b/htdocs/projet/tasks/task.php
@@ -105,6 +105,7 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->projet->creer) {
$object->date_start = dol_mktime(GETPOST('dateohour', 'int'), GETPOST('dateomin', 'int'), 0, GETPOST('dateomonth', 'int'), GETPOST('dateoday', 'int'), GETPOST('dateoyear', 'int'));
$object->date_end = dol_mktime(GETPOST('dateehour', 'int'), GETPOST('dateemin', 'int'), 0, GETPOST('dateemonth', 'int'), GETPOST('dateeday', 'int'), GETPOST('dateeyear', 'int'));
$object->progress = price2num(GETPOST('progress', 'alphanohtml'));
+ $object->budget_amount = price2num(GETPOST('budget_amount', 'alphanohtml'));
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
@@ -442,6 +443,10 @@ if ($id > 0 || !empty($ref)) {
print ''.$object->description.' ';
print '';
+ print ''.$langs->trans("Budget").' ';
+ print ' ';
+ print ' ';
+
// Other options
$parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
@@ -564,6 +569,13 @@ if ($id > 0 || !empty($ref)) {
}
print '';
+ // Budget
+ print ''.$langs->trans("Budget").' ';
+ if (strcmp($object->budget_amount, '')) {
+ print price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
+ }
+ print ' ';
+
// Other attributes
$cols = 3;
$parameters = array('socid'=>$socid);
From 5ef681ef912f8e07a51fa14467037d78809c3628 Mon Sep 17 00:00:00 2001
From: Gauthier PC portable 024
Date: Fri, 15 Oct 2021 10:36:47 +0200
Subject: [PATCH 082/449] FIX : stickler
---
htdocs/core/class/commonobject.class.php | 36 +++++++++++++-----------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 2bf6d758435..8689f7c26d1 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -9058,7 +9058,7 @@ abstract class CommonObject
$columnName = $deleteFromObject[2];
$TMoreSQL = array();
$more_sql = $deleteFromObject[3];
- if(!empty($more_sql)) $TMoreSQL['customsql'] = $more_sql;
+ if (!empty($more_sql)) $TMoreSQL['customsql'] = $more_sql;
if (dol_include_once($filePath)) {
$childObject = new $className($this->db);
if (method_exists($childObject, 'deleteByParentField')) {
@@ -9144,10 +9144,12 @@ abstract class CommonObject
*
* @param int $parentId Parent Id
* @param string $parentField Name of Foreign key parent column
+ * @param array $filter an array filter
+ * @param string $filtermode AND or OR
* @return int <0 if KO, >0 if OK
* @throws Exception
*/
- public function deleteByParentField($parentId = 0, $parentField = '', $filter=array(), $filtermode="AND")
+ public function deleteByParentField($parentId = 0, $parentField = '', $filter = array(), $filtermode = "AND")
{
global $user;
@@ -9160,22 +9162,22 @@ abstract class CommonObject
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " WHERE ".$parentField." = ".(int) $parentId;
- // Manage filter
- $sqlwhere = array();
- if (count($filter) > 0) {
- foreach ($filter as $key => $value) {
+ // Manage filters
+ $sqlwhere = array();
+ if (count($filter) > 0) {
+ foreach ($filter as $key => $value) {
if ($key == 'customsql') {
- $sqlwhere[] = $value;
- } elseif (strpos($value, '%') === false) {
- $sqlwhere[] = $key.' IN ('.$this->db->sanitize($this->db->escape($value)).')';
- } else {
- $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\'';
- }
- }
- }
- if (count($sqlwhere) > 0) {
- $sql .= " AND (".implode(" ".$filtermode." ", $sqlwhere).")";
- }
+ $sqlwhere[] = $value;
+ } elseif (strpos($value, '%') === false) {
+ $sqlwhere[] = $key.' IN ('.$this->db->sanitize($this->db->escape($value)).')';
+ } else {
+ $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\'';
+ }
+ }
+ }
+ if (count($sqlwhere) > 0) {
+ $sql .= " AND (".implode(" ".$filtermode." ", $sqlwhere).")";
+ }
$resql = $this->db->query($sql);
if (!$resql) {
From 0865916fe2c65db05c02926d38e3fec635fa662d Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Fri, 15 Oct 2021 10:01:07 +0200
Subject: [PATCH 083/449] Init page for public subscription
---
htdocs/partnership/admin/website.php | 258 ++++++++
.../partnership/class/partnership.class.php | 4 +-
htdocs/partnership/lib/partnership.lib.php | 5 +
htdocs/public/partnership/index.php | 26 +
htdocs/public/partnership/new.php | 620 ++++++++++++++++++
htdocs/theme/eldy/btn.inc.php | 2 +-
6 files changed, 912 insertions(+), 3 deletions(-)
create mode 100644 htdocs/partnership/admin/website.php
create mode 100644 htdocs/public/partnership/index.php
create mode 100644 htdocs/public/partnership/new.php
diff --git a/htdocs/partnership/admin/website.php b/htdocs/partnership/admin/website.php
new file mode 100644
index 00000000000..96ebb4ba6e9
--- /dev/null
+++ b/htdocs/partnership/admin/website.php
@@ -0,0 +1,258 @@
+
+ * Copyright (C) 2006-2015 Laurent Destailleur
+ * Copyright (C) 2006-2012 Regis Houssin
+ * Copyright (C) 2011 Juanjo Menent
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/partnership/admin/website.php
+ * \ingroup partnership
+ * \brief File of main public page for partnership module
+ */
+
+require '../../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
+
+// Load translation files required by the page
+$langs->loadLangs(array("admin", "partnership"));
+
+$action = GETPOST('action', 'aZ09');
+
+if (!$user->admin) {
+ accessforbidden();
+}
+
+$error = 0;
+
+
+/*
+ * Actions
+ */
+
+if ($action == 'setPARTNERSHIP_ENABLE_PUBLIC') {
+ if (GETPOST('value')) {
+ dolibarr_set_const($db, 'PARTNERSHIP_ENABLE_PUBLIC', 1, 'chaine', 0, '', $conf->entity);
+ } else {
+ dolibarr_set_const($db, 'PARTNERSHIP_ENABLE_PUBLIC', 0, 'chaine', 0, '', $conf->entity);
+ }
+}
+
+if ($action == 'update') {
+ $public = GETPOST('PARTNERSHIP_ENABLE_PUBLIC');
+
+ $res = dolibarr_set_const($db, "PARTNERSHIP_ENABLE_PUBLIC", $public, 'chaine', 0, '', $conf->entity);
+
+ if (!($res > 0)) {
+ $error++;
+ }
+
+ if (!$error) {
+ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
+ } else {
+ setEventMessages($langs->trans("Error"), null, 'errors');
+ }
+}
+
+
+/*
+ * View
+ */
+
+$form = new Form($db);
+
+//$help_url = 'EN:Module_Partnership|FR:Module_Adhérents|ES:Módulo_Miembros';
+llxHeader('', $langs->trans("PartnershipsSetup"), $help_url);
+
+
+$linkback = ''.$langs->trans("BackToModuleList").' ';
+print load_fiche_titre($langs->trans("PartnershipsSetup"), $linkback, 'title_setup');
+
+$head = partnershipAdminPrepareHead();
+
+
+
+print '';
+print ' ';
+print ' ';
+
+print dol_get_fiche_head($head, 'website', $langs->trans("Partnerships"), -1, 'user');
+
+if ($conf->use_javascript_ajax) {
+ print "\n".''."\n";
+}
+
+
+print ''.$langs->trans("BlankSubscriptionFormDesc").' ';
+
+$param = '';
+
+$enabledisablehtml = $langs->trans("EnablePublicSubscriptionForm").' ';
+if (empty($conf->global->PARTNERSHIP_ENABLE_PUBLIC)) {
+ // Button off, click to enable
+ $enabledisablehtml .= '';
+ $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
+ $enabledisablehtml .= ' ';
+} else {
+ // Button on, click to disable
+ $enabledisablehtml .= '';
+ $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
+ $enabledisablehtml .= ' ';
+}
+print $enabledisablehtml;
+print ' ';
+
+
+print ' ';
+
+if (!empty($conf->global->PARTNERSHIP_ENABLE_PUBLIC)) {
+ print ' ';
+
+ print '';
+ print '
';
+
+ print '';
+ print ''.$langs->trans("Parameter").' ';
+ print ''.$langs->trans("Value").' ';
+ print " \n";
+
+ // Force Type
+ $adht = new AdherentType($db);
+ print '';
+ print $langs->trans("ForceMemberType");
+ print ' ';
+ $listofval = array();
+ $listofval += $adht->liste_array(1);
+ $forcetype = empty($conf->global->PARTNERSHIP_NEWFORM_FORCETYPE) ? -1 : $conf->global->PARTNERSHIP_NEWFORM_FORCETYPE;
+ print $form->selectarray("PARTNERSHIP_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listofval) > 1 ? 1 : 0);
+ print " \n";
+
+ // Force nature of member (mor/phy)
+ $morphys["phy"] = $langs->trans("Physical");
+ $morphys["mor"] = $langs->trans("Moral");
+ print '';
+ print $langs->trans("ForceMemberNature");
+ print ' ';
+ $forcenature = empty($conf->global->PARTNERSHIP_NEWFORM_FORCEMORPHY) ? 0 : $conf->global->PARTNERSHIP_NEWFORM_FORCEMORPHY;
+ print $form->selectarray("PARTNERSHIP_NEWFORM_FORCEMORPHY", $morphys, $forcenature, 1);
+ print " \n";
+
+ // Amount
+ print '';
+ print $langs->trans("DefaultAmount");
+ print ' ';
+ print ' ';
+ print " \n";
+
+ // Can edit
+ print '';
+ print $langs->trans("CanEditAmount");
+ print ' ';
+ print $form->selectyesno("PARTNERSHIP_NEWFORM_EDITAMOUNT", (!empty($conf->global->PARTNERSHIP_NEWFORM_EDITAMOUNT) ? $conf->global->PARTNERSHIP_NEWFORM_EDITAMOUNT : 0), 1);
+ print " \n";
+
+ // Jump to an online payment page
+ print '';
+ print $langs->trans("PARTNERSHIP_NEWFORM_PAYONLINE");
+ print ' ';
+ $listofval = array();
+ $listofval['-1'] = $langs->trans('No');
+ $listofval['all'] = $langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')';
+ if (!empty($conf->paybox->enabled)) {
+ $listofval['paybox'] = 'Paybox';
+ }
+ if (!empty($conf->paypal->enabled)) {
+ $listofval['paypal'] = 'PayPal';
+ }
+ if (!empty($conf->stripe->enabled)) {
+ $listofval['stripe'] = 'Stripe';
+ }
+ print $form->selectarray("PARTNERSHIP_NEWFORM_PAYONLINE", $listofval, (!empty($conf->global->PARTNERSHIP_NEWFORM_PAYONLINE) ? $conf->global->PARTNERSHIP_NEWFORM_PAYONLINE : ''), 0);
+ print " \n";
+
+ print '
';
+ print '
';
+
+ print '';
+ print ' ';
+ print '
';
+}
+
+
+print dol_get_fiche_end();
+
+print ' ';
+
+
+if (!empty($conf->global->PARTNERSHIP_ENABLE_PUBLIC)) {
+ print ' ';
+ //print $langs->trans('FollowingLinksArePublic').' ';
+ print img_picto('', 'globe').' '.$langs->trans('BlankSubscriptionForm').' ';
+ if (!empty($conf->multicompany->enabled)) {
+ $entity_qr = '?entity='.$conf->entity;
+ } else {
+ $entity_qr = '';
+ }
+
+ // Define $urlwithroot
+ $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
+ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
+ //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
+
+ print '';
+ print ajax_autoselect('publicurlmember');
+}
+
+// End of page
+llxFooter();
+$db->close();
diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php
index f40b771b34d..1e3d3cebab1 100644
--- a/htdocs/partnership/class/partnership.class.php
+++ b/htdocs/partnership/class/partnership.class.php
@@ -131,14 +131,14 @@ class Partnership extends CommonObject
*/
public $rowid;
- public $fk_soc;
+ public $fk_soc; // Link to thirdparty
+ public $fk_member; // Link to member
public $tms;
public $fk_user_creat;
public $fk_user_modif;
public $status;
- public $fk_member;
public $date_partnership_start;
public $date_partnership_end;
public $count_last_url_check_error;
diff --git a/htdocs/partnership/lib/partnership.lib.php b/htdocs/partnership/lib/partnership.lib.php
index 5305f86132e..23b5a2901fb 100644
--- a/htdocs/partnership/lib/partnership.lib.php
+++ b/htdocs/partnership/lib/partnership.lib.php
@@ -46,6 +46,11 @@ function partnershipAdminPrepareHead()
$head[$h][2] = 'partnership_extrafields';
$h++;
+ $head[$h][0] = dol_buildpath("/partnership/admin/website.php", 1);
+ $head[$h][1] = $langs->trans("BlankSubscriptionForm");
+ $head[$h][2] = 'website';
+ $h++;
+
/*
$head[$h][0] = dol_buildpath("/partnership/admin/about.php", 1);
$head[$h][1] = $langs->trans("About");
diff --git a/htdocs/public/partnership/index.php b/htdocs/public/partnership/index.php
new file mode 100644
index 00000000000..6a9a6f8a557
--- /dev/null
+++ b/htdocs/public/partnership/index.php
@@ -0,0 +1,26 @@
+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/public/partnership/index.php
+ * \ingroup core
+ * \brief A redirect page to an error
+ */
+
+require '../../master.inc.php';
+
+header("Location: ".DOL_URL_ROOT.'/public/error-404.php');
diff --git a/htdocs/public/partnership/new.php b/htdocs/public/partnership/new.php
new file mode 100644
index 00000000000..a46488ab5f9
--- /dev/null
+++ b/htdocs/public/partnership/new.php
@@ -0,0 +1,620 @@
+
+ * Copyright (C) 2001-2002 Jean-Louis Bergamo
+ * Copyright (C) 2006-2013 Laurent Destailleur
+ * Copyright (C) 2012 Regis Houssin
+ * Copyright (C) 2012 J. Fernando Lagrange
+ * Copyright (C) 2018-2019 Frédéric France
+ * Copyright (C) 2018 Alexandre Spangaro
+ * Copyright (C) 2021 Waël Almoman
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/public/partnership/new.php
+ * \ingroup member
+ * \brief Example of form to add a new member
+ */
+
+if (!defined('NOLOGIN')) {
+ define("NOLOGIN", 1); // This means this output page does not require to be logged.
+}
+if (!defined('NOCSRFCHECK')) {
+ define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
+}
+if (!defined('NOIPCHECK')) {
+ define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
+}
+if (!defined('NOBROWSERNOTIF')) {
+ define('NOBROWSERNOTIF', '1');
+}
+if (!defined('NOIPCHECK')) {
+ define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
+}
+
+// For MultiCompany module.
+// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
+// TODO This should be useless. Because entity must be retrieve from object ref and not from url.
+$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
+if (is_numeric($entity)) {
+ define("DOLENTITY", $entity);
+}
+
+require '../../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
+
+// Init vars
+$errmsg = '';
+$num = 0;
+$error = 0;
+$backtopage = GETPOST('backtopage', 'alpha');
+$action = GETPOST('action', 'aZ09');
+
+// Load translation files
+$langs->loadLangs(array("main", "members", "companies", "install", "other"));
+
+// Security check
+if (empty($conf->partnership->enabled)) {
+ accessforbidden('', 0, 0, 1);
+}
+
+if (empty($conf->global->PARTNERSHIP_ENABLE_PUBLIC)) {
+ print $langs->trans("Auto subscription form for public visitors has not been enabled");
+ exit;
+}
+
+// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
+$hookmanager->initHooks(array('publicnewpartnershipcard', 'globalcard'));
+
+$extrafields = new ExtraFields($db);
+
+$object = new Partnership($db);
+
+$user->loadDefaultValues();
+
+
+/**
+ * Show header for new partnership
+ *
+ * @param string $title Title
+ * @param string $head Head array
+ * @param int $disablejs More content into html header
+ * @param int $disablehead More content into html header
+ * @param array $arrayofjs Array of complementary js files
+ * @param array $arrayofcss Array of complementary css files
+ * @return void
+ */
+function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '')
+{
+ global $user, $conf, $langs, $mysoc;
+
+ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
+
+ print '';
+
+ // Define urllogo
+ $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png';
+
+ if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
+ $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
+ } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
+ $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo);
+ } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) {
+ $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg';
+ }
+
+ print '';
+
+ // Output html code for logo
+ if ($urllogo) {
+ print '
';
+ print '
';
+ print '
';
+ print '
';
+ if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
+ print '
';
+ }
+ print '
';
+ }
+
+ if (!empty($conf->global->PARTNERSHIP_IMAGE_PUBLIC_REGISTRATION)) {
+ print '
';
+ print '
';
+ print '
';
+ }
+
+ print '
';
+
+ print '';
+}
+
+/**
+ * Show footer for new member
+ *
+ * @return void
+ */
+function llxFooterVierge()
+{
+ print '
';
+
+ printCommonFooter('public');
+
+ print "\n";
+ print "