diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 1eae1b063b0..d898628013e 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -36,12 +36,13 @@ Definition: As the Developer: -1. [Fork](https://help.github.com/articles/fork-a-repo) the [GitHub repository](https://github.com/Dolibarr/dolibarr). -2. Clone your fork. -3. Choose a branch(See the [Branches](#branches) section below). -4. Read our developer documentation on the [Dolibarr Wiki](https://wiki.dolibarr.org/index.php?title=Developer_documentation). -5. Commit and push your changes. -6. [Make a pull request](https://help.github.com/articles/creating-a-pull-request). +1. Check you agree with the terms of the [DCO - Developer's Certificate of Origin](https://github.com/Dolibarr/dolibarr/DCO) +2. [Fork](https://help.github.com/articles/fork-a-repo) the [GitHub repository](https://github.com/Dolibarr/dolibarr). +3. Clone your fork. +4. Choose a branch(See the [Branches](#branches) section below). +5. Read our developer documentation on the [Dolibarr Wiki](https://wiki.dolibarr.org/index.php?title=Developer_documentation). +6. Commit and push your changes. +7. [Make a pull request](https://help.github.com/articles/creating-a-pull-request). As the PR Maintainer: diff --git a/SECURITY.md b/SECURITY.md index 809681c74d1..062578e03b9 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -12,8 +12,9 @@ Security report are valid only on current stable version (see https://dolibarr.o To report a vulnerability, for a private report, you can: -- Send your report on Vulnerability Disclosure Program (VDP) [https://app.yogosha.com/cvd/dolibarr/10VxeNx6Ui3rSEhAgX63US](https://app.yogosha.com/cvd/dolibarr/10VxeNx6Ui3rSEhAgX63US) (recommended for everybody) +- Send your report on Vulnerability Disclosure Program (VDP): Link will be updated soon (recommended for everybody) - Or send an email to security@dolibarr.org with clear textual description of the report along with steps to reproduce the issue, include attachments such as screenshots or proof of concept code as necessary. diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 7f2f9c78236..3b63736901b 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -972,12 +972,6 @@ parameters: count: 2 path: ../../htdocs/adherents/class/adherent.class.php - - - message: '#^Call to function is_array\(\) with array\{\}\|array\{mixed\} will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/adherents/class/adherent.class.php - - message: '#^Call to function method_exists\(\) with \$this\(Adherent\) and ''getLibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -1014,36 +1008,12 @@ parameters: count: 5 path: ../../htdocs/adherents/class/adherent.class.php - - - message: '#^PHPDoc tag @var with type Contact is not subtype of native type \$this\(Adherent\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/adherents/class/adherent.class.php - - - - message: '#^PHPDoc tag @var with type Societe is not subtype of native type \$this\(Adherent\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/adherents/class/adherent.class.php - - - - message: '#^PHPDoc tag @var with type User is not subtype of native type \$this\(Adherent\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/adherents/class/adherent.class.php - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' identifier: argument.type count: 1 path: ../../htdocs/adherents/class/adherent.class.php - - - message: '#^Property Adherent\:\:\$email \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/adherents/class/adherent.class.php - - message: '#^Property Adherent\:\:\$first_subscription_amount \(int\|string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -1056,16 +1026,10 @@ parameters: count: 1 path: ../../htdocs/adherents/class/adherent.class.php - - - message: '#^Property Adherent\:\:\$societe \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/adherents/class/adherent.class.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse - count: 2 + count: 1 path: ../../htdocs/adherents/class/adherent.class.php - @@ -1224,18 +1188,6 @@ parameters: count: 1 path: ../../htdocs/adherents/partnership.php - - - message: '#^Variable \$label might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/adherents/stats/geo.php - - - - message: '#^Variable \$theme_datacolor might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/adherents/stats/geo.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue @@ -5280,12 +5232,6 @@ parameters: count: 2 path: ../../htdocs/compta/bank/bankentries_list.php - - - message: '#^If condition is always false\.$#' - identifier: if.alwaysFalse - count: 2 - path: ../../htdocs/compta/bank/bankentries_list.php - - message: '#^Left side of && is always true\.$#' identifier: booleanAnd.leftAlwaysTrue @@ -5568,12 +5514,6 @@ parameters: count: 3 path: ../../htdocs/compta/bank/list.php - - - message: '#^If condition is always false\.$#' - identifier: if.alwaysFalse - count: 2 - path: ../../htdocs/compta/bank/releve.php - - message: '#^Variable \$buttonreconcile might not be defined\.$#' identifier: variable.undefined @@ -7674,12 +7614,6 @@ parameters: count: 3 path: ../../htdocs/compta/tva/payments.php - - - message: '#^Call to function is_array\(\) with list\ will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/compta/tva/quadri_detail.php - - message: '#^Call to function is_array\(\) with list\ will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -7860,12 +7794,6 @@ parameters: count: 1 path: ../../htdocs/contact/card.php - - - message: '#^Call to function is_array\(\) with array\{\}\|array\{mixed\} will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/contact/class/contact.class.php - - message: '#^Call to function method_exists\(\) with \$this\(Contact\) and ''getLibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -7902,33 +7830,9 @@ parameters: count: 3 path: ../../htdocs/contact/class/contact.class.php - - - message: '#^PHPDoc tag @var with type Contact is not subtype of native type \$this\(Contact\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/contact/class/contact.class.php - - - - message: '#^PHPDoc tag @var with type Societe is not subtype of native type \$this\(Contact\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/contact/class/contact.class.php - - - - message: '#^PHPDoc tag @var with type User is not subtype of native type \$this\(Contact\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/contact/class/contact.class.php - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property - count: 2 - path: ../../htdocs/contact/class/contact.class.php - - - - message: '#^Property Contact\:\:\$email \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property count: 1 path: ../../htdocs/contact/class/contact.class.php @@ -7944,12 +7848,6 @@ parameters: count: 1 path: ../../htdocs/contact/class/contact.class.php - - - message: '#^Ternary operator condition is always false\.$#' - identifier: ternary.alwaysFalse - count: 1 - path: ../../htdocs/contact/class/contact.class.php - - message: '#^Variable \$url in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -12348,24 +12246,6 @@ parameters: count: 1 path: ../../htdocs/core/lib/project.lib.php - - - message: '#^Parameter \#1 \$inc of function projectLinesPerDay expects string, \(float\|int\) given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/lib/project.lib.php - - - - message: '#^Parameter \#1 \$inc of function projectLinesPerMonth expects string, \(float\|int\) given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/lib/project.lib.php - - - - message: '#^Parameter \#1 \$inc of function projectLinesPerWeek expects string, \(float\|int\) given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/lib/project.lib.php - - message: '#^Property Task\:\:\$progress \(int\|string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -17976,12 +17856,6 @@ parameters: count: 2 path: ../../htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php - - - message: '#^Negated boolean expression is always false\.$#' - identifier: booleanNot.alwaysFalse - count: 2 - path: ../../htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php - - message: '#^Variable \$old_MAIN_MAIL_AUTOCOPY_TO might not be defined\.$#' identifier: variable.undefined @@ -18438,12 +18312,6 @@ parameters: count: 1 path: ../../htdocs/don/class/api_donations.class.php - - - message: '#^Call to function is_array\(\) with array\{\}\|array\{mixed\} will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/don/class/don.class.php - - message: '#^Call to function method_exists\(\) with \$this\(Don\) and ''LibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -18480,42 +18348,12 @@ parameters: count: 1 path: ../../htdocs/don/class/don.class.php - - - message: '#^PHPDoc tag @var with type Contact is not subtype of native type \$this\(Don\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/don/class/don.class.php - - - - message: '#^PHPDoc tag @var with type Societe is not subtype of native type \$this\(Don\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/don/class/don.class.php - - - - message: '#^PHPDoc tag @var with type User is not subtype of native type \$this\(Don\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/don/class/don.class.php - - - - message: '#^Property Don\:\:\$email \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/don/class/don.class.php - - message: '#^Property Don\:\:\$societe \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property count: 1 path: ../../htdocs/don/class/don.class.php - - - message: '#^Ternary operator condition is always false\.$#' - identifier: ternary.alwaysFalse - count: 1 - path: ../../htdocs/don/class/don.class.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue @@ -19110,12 +18948,6 @@ parameters: count: 1 path: ../../htdocs/eventorganization/class/conferenceorboothattendee.class.php - - - message: '#^Property CommonObject\:\:\$name \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/eventorganization/class/conferenceorboothattendee.class.php - - message: '#^Property ConferenceOrBoothAttendee\:\:\$lastname \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -28374,12 +28206,6 @@ parameters: count: 1 path: ../../htdocs/projet/activity/perday.php - - - message: '#^Parameter \#1 \$inc of function projectLinesPerDay expects string, int given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/projet/activity/perday.php - - message: '#^Parameter \#11 \$isavailable of function projectLinesPerDay expects array\, afternoon\: int\<0, 1\>\}\>, non\-empty\-array\ given\.$#' identifier: argument.type @@ -28458,12 +28284,6 @@ parameters: count: 1 path: ../../htdocs/projet/activity/permonth.php - - - message: '#^Parameter \#1 \$inc of function projectLinesPerMonth expects string, int given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/projet/activity/permonth.php - - message: '#^Parameter \#14 \$arrayfields of function projectLinesPerMonth expects array\, array\\> given\.$#' identifier: argument.type @@ -28518,12 +28338,6 @@ parameters: count: 1 path: ../../htdocs/projet/activity/perweek.php - - - message: '#^Parameter \#1 \$inc of function projectLinesPerWeek expects string, int given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/projet/activity/perweek.php - - message: '#^Parameter \#11 \$isavailable of function projectLinesPerWeek expects array\, afternoon\: int\<0, 1\>\}\>, non\-empty\-array\ given\.$#' identifier: argument.type @@ -29190,12 +29004,6 @@ parameters: count: 1 path: ../../htdocs/projet/tasks.php - - - message: '#^Parameter \#1 \$inc of function projectLinesa expects string, int given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/projet/tasks.php - - message: '#^Parameter \#13 \$arrayfields of function projectLinesa expects array\, array\\> given\.$#' identifier: argument.type @@ -31416,12 +31224,6 @@ parameters: count: 1 path: ../../htdocs/recruitment/class/recruitmentcandidature.class.php - - - message: '#^Call to function property_exists\(\) with \$this\(RecruitmentCandidature\) and ''phone'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/recruitment/class/recruitmentcandidature.class.php - - message: '#^Call to function property_exists\(\) with RecruitmentCandidature and ''date_creation'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -31464,24 +31266,12 @@ parameters: count: 1 path: ../../htdocs/recruitment/class/recruitmentcandidature.class.php - - - message: '#^Property CommonObject\:\:\$name \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/recruitment/class/recruitmentcandidature.class.php - - message: '#^Property RecruitmentCandidature\:\:\$fields \(array\\|string, position\: int, notnull\?\: int, visible\: int\<\-2, 5\>\|string, noteditable\?\: int\<0, 1\>, default\?\: string, \.\.\.\}\>\) does not accept default value of type array\{rowid\: array\{type\: ''integer'', label\: ''TechnicalID'', enabled\: 1, position\: 1, notnull\: 1, visible\: 0, noteditable\: 1, index\: 1, \.\.\.\}, entity\: array\{type\: ''integer'', label\: ''Entity'', enabled\: 1, visible\: 0, position\: 5, notnull\: 1, default\: ''1'', index\: 1\}, ref\: array\{type\: ''varchar\(128\)'', label\: ''Ref'', enabled\: 1, position\: 10, notnull\: 1, visible\: 4, noteditable\: 1, default\: ''\(PROV\)'', \.\.\.\}, fk_recruitmentjobposition\: array\{type\: ''integer…'', label\: ''Job'', enabled\: 1, position\: 15, notnull\: 0, visible\: 1, index\: 1, picto\: ''recruitmentjobposit…'', \.\.\.\}, note_public\: array\{type\: ''html'', label\: ''NotePublic'', enabled\: 1, position\: 61, notnull\: 0, visible\: 0\}, note_private\: array\{type\: ''html'', label\: ''NotePrivate'', enabled\: 1, position\: 62, notnull\: 0, visible\: 0\}, fk_user_creat\: array\{type\: ''integer\:User\:user…'', label\: ''UserAuthor'', enabled\: 1, position\: 510, notnull\: \-1, visible\: \-2, foreignkey\: ''user\.rowid'', csslist\: ''tdoverflowmax100''\}, fk_user_modif\: array\{type\: ''integer\:User\:user…'', label\: ''UserModif'', enabled\: 1, position\: 511, notnull\: \-1, visible\: \-2, csslist\: ''tdoverflowmax100''\}, \.\.\.\}\.$#' identifier: property.defaultValue count: 1 path: ../../htdocs/recruitment/class/recruitmentcandidature.class.php - - - message: '#^Property RecruitmentCandidature\:\:\$lastname \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/recruitment/class/recruitmentcandidature.class.php - - message: '#^Property RecruitmentCandidature\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -31836,30 +31626,6 @@ parameters: count: 1 path: ../../htdocs/resource/card.php - - - message: '#^Call to function is_array\(\) with array\{\}\|array\{mixed\} will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/resource/class/dolresource.class.php - - - - message: '#^PHPDoc tag @var with type Contact is not subtype of native type \$this\(Dolresource\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/resource/class/dolresource.class.php - - - - message: '#^PHPDoc tag @var with type Societe is not subtype of native type \$this\(Dolresource\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/resource/class/dolresource.class.php - - - - message: '#^PHPDoc tag @var with type User is not subtype of native type \$this\(Dolresource\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/resource/class/dolresource.class.php - - message: '#^Property CommonObject\:\:\$ref \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -31899,7 +31665,7 @@ parameters: - message: '#^Property Dolresource\:\:\$email \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property - count: 3 + count: 2 path: ../../htdocs/resource/class/dolresource.class.php - @@ -31944,12 +31710,6 @@ parameters: count: 2 path: ../../htdocs/resource/class/dolresource.class.php - - - message: '#^Ternary operator condition is always false\.$#' - identifier: ternary.alwaysFalse - count: 1 - path: ../../htdocs/resource/class/dolresource.class.php - - message: '#^Call to function is_numeric\(\) with float\|int\\|int\<1, max\>\|\(non\-falsy\-string&numeric\-string\) will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -32724,12 +32484,6 @@ parameters: count: 2 path: ../../htdocs/societe/class/companybankaccount.class.php - - - message: '#^Call to function is_array\(\) with array\{\}\|array\{mixed\} will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/societe/class/societe.class.php - - message: '#^Call to function method_exists\(\) with \$this\(Societe\) and ''getLibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -32766,24 +32520,6 @@ parameters: count: 6 path: ../../htdocs/societe/class/societe.class.php - - - message: '#^PHPDoc tag @var with type Contact is not subtype of native type \$this\(Societe\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/societe/class/societe.class.php - - - - message: '#^PHPDoc tag @var with type Societe is not subtype of native type \$this\(Societe\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/societe/class/societe.class.php - - - - message: '#^PHPDoc tag @var with type User is not subtype of native type \$this\(Societe\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/societe/class/societe.class.php - - message: '#^Property Contact\:\:\$roles \(array\\) does not accept non\-empty\-list\\.$#' identifier: assign.propertyType @@ -32802,16 +32538,10 @@ parameters: count: 1 path: ../../htdocs/societe/class/societe.class.php - - - message: '#^Property Societe\:\:\$email \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/societe/class/societe.class.php - - message: '#^Property Societe\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property - count: 3 + count: 2 path: ../../htdocs/societe/class/societe.class.php - @@ -32850,12 +32580,6 @@ parameters: count: 1 path: ../../htdocs/societe/class/societe.class.php - - - message: '#^Ternary operator condition is always false\.$#' - identifier: ternary.alwaysFalse - count: 1 - path: ../../htdocs/societe/class/societe.class.php - - message: '#^Property SocieteAccount\:\:\$fields \(array\\|string, position\: int, notnull\?\: int, visible\: int\<\-2, 5\>\|string, noteditable\?\: int\<0, 1\>, default\?\: string, \.\.\.\}\>\) does not accept default value of type array\{rowid\: array\{type\: ''integer'', label\: ''TechnicalID'', visible\: \-2, enabled\: 1, position\: 1, notnull\: 1, index\: 1, comment\: ''Id''\}, entity\: array\{type\: ''integer'', label\: ''Entity'', visible\: 0, enabled\: 1, position\: 5, default\: 1\}, login\: array\{type\: ''varchar\(64\)'', label\: ''Login'', visible\: 1, enabled\: 1, notnull\: 1, position\: 10, showoncombobox\: 1, autofocusoncreate\: 1\}, pass_encoding\: array\{type\: ''varchar\(24\)'', label\: ''PassEncoding'', visible\: 0, enabled\: 1, position\: 30\}, pass_crypted\: array\{type\: ''password'', label\: ''Password'', visible\: \-1, enabled\: 1, position\: 31, notnull\: 1\}, pass_temp\: array\{type\: ''varchar\(128\)'', label\: ''Temp'', visible\: 0, enabled\: 0, position\: 32, notnull\: \-1\}, fk_soc\: array\{type\: ''integer\:Societe…'', label\: ''ThirdParty'', visible\: 1, enabled\: 1, position\: 40, notnull\: \-1, index\: 1, picto\: ''company'', \.\.\.\}, site\: array\{type\: ''varchar\(128\)'', label\: ''WebsiteTypeLabel'', visible\: 0, enabled\: 0, position\: 41, notnull\: 1, default\: '''', help\: ''Name of the website…'', \.\.\.\}, \.\.\.\}\.$#' identifier: property.defaultValue @@ -34518,12 +34242,6 @@ parameters: count: 1 path: ../../htdocs/user/class/api_users.class.php - - - message: '#^Call to function is_array\(\) with array\{\}\|array\{mixed\} will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/user/class/user.class.php - - message: '#^Call to function method_exists\(\) with \$this\(User\) and ''getLibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -34548,36 +34266,12 @@ parameters: count: 3 path: ../../htdocs/user/class/user.class.php - - - message: '#^PHPDoc tag @var with type Contact is not subtype of native type \$this\(User\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/user/class/user.class.php - - - - message: '#^PHPDoc tag @var with type Societe is not subtype of native type \$this\(User\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/user/class/user.class.php - - - - message: '#^PHPDoc tag @var with type User is not subtype of native type \$this\(User\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/user/class/user.class.php - - message: '#^Parameter \#1 \$array of function dol_sort_array contains unresolvable type\.$#' identifier: argument.unresolvableType count: 1 path: ../../htdocs/user/class/user.class.php - - - message: '#^Property User\:\:\$email \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/user/class/user.class.php - - message: '#^Property User\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -34644,12 +34338,6 @@ parameters: count: 1 path: ../../htdocs/user/class/user.class.php - - - message: '#^Ternary operator condition is always false\.$#' - identifier: ternary.alwaysFalse - count: 1 - path: ../../htdocs/user/class/user.class.php - - message: '#^Variable \$whereforadd in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index e5a37b8b709..8790cb6c9bc 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -54,14 +54,6 @@ $search_subaccount = GETPOST('search_subaccount', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); $search_type = GETPOST('search_type', 'intcomma'); -// Security check -if ($user->socid > 0) { - accessforbidden(); -} -if (!$user->hasRight('accounting', 'chartofaccount')) { - accessforbidden(); -} - // Load variable for pagination $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -92,6 +84,14 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { unset($arrayfields['reconcilable']); } +// Security check +if ($user->socid > 0) { + accessforbidden(); +} +if (!$user->hasRight('accounting', 'chartofaccount')) { // after this test, $user->hasRight('accounting', 'chartofaccount') is always valid + accessforbidden(); +} + /* * Actions @@ -124,6 +124,13 @@ if (empty($reshook)) { $search_type = ""; $search_array_options = array(); } + + if ($action == 'enable' /* && $user->hasRight('accounting', 'chartofaccount') */) { // test useless + setEventMessages($langs->trans("FeatureNotYetAvailable"), null, 'errors'); + } + if ($action == 'disable' /* && $user->hasRight('accounting', 'chartofaccount') */) { + setEventMessages($langs->trans("FeatureNotYetAvailable"), null, 'errors'); + } } @@ -142,7 +149,7 @@ llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-adm // Customer -$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '1' as type, sa.entity, sa.client as nature"; +$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '1' as type, sa.entity, sa.client as nature, sa.fournisseur as nature2"; $sql .= " FROM ".MAIN_DB_PREFIX."societe sa"; $sql .= " WHERE sa.entity IN (".getEntity('societe').")"; $sql .= " AND sa.code_compta <> ''"; @@ -163,7 +170,6 @@ if (strlen(trim($search_subaccount))) { } } - //var_dump($search_subaccount); exit; if ($search_subaccount_tmp) { if ($weremovedsomezero) { $search_subaccount_tmp_clean = $search_subaccount_tmp; @@ -190,7 +196,8 @@ if (!empty($search_type) && $search_type >= 0) { // Supplier $sql .= " UNION "; -$sql .= " SELECT sa.rowid, sa.nom as label, sa.code_compta_fournisseur as subaccount, '2' as type, sa.entity, '0' as nature FROM ".MAIN_DB_PREFIX."societe sa"; +$sql .= " SELECT sa.rowid, sa.nom as label, sa.code_compta_fournisseur as subaccount, '2' as type, sa.entity, sa.client as nature, sa.fournisseur as nature2"; +$sql .= " FROM ".MAIN_DB_PREFIX."societe sa"; $sql .= " WHERE sa.entity IN (".getEntity('societe').")"; $sql .= " AND sa.code_compta_fournisseur <> ''"; //print $sql; @@ -237,7 +244,8 @@ if (!empty($search_type) && $search_type >= 0) { // User - Employee $sql .= " UNION "; -$sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '3' as type, u.entity, '0' as nature FROM ".MAIN_DB_PREFIX."user u"; +$sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '3' as type, u.entity, '0' as nature, '0' as nature2"; +$sql .= " FROM ".MAIN_DB_PREFIX."user u"; $sql .= " WHERE u.entity IN (".getEntity('user').")"; $sql .= " AND u.accountancy_code <> ''"; //print $sql; @@ -368,7 +376,7 @@ if ($resql) { print ''; } if (!empty($arrayfields['type']['checked'])) { - print ''.$form->selectarray('search_type', array('1'=>$langs->trans('Customer'), '2'=>$langs->trans('Supplier'), '3'=>$langs->trans('Employee')), $search_type, 1).''; + print ''.$form->selectarray('search_type', array('1'=>$langs->trans('Customer').' / '.$langs->trans("Prospect"), '2'=>$langs->trans('Supplier'), '3'=>$langs->trans('Employee')), $search_type, 1).''; } if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { if (!empty($arrayfields['reconcilable']['checked'])) { @@ -409,12 +417,25 @@ if ($resql) { } print "\n"; + $companystatic = new Societe($db); + $totalarray = array(); $totalarray['nbfield'] = 0; $i = 0; while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); + if ($obj->type == 1) { + $companystatic->id = $obj->id; + $companystatic->client = $obj->nature; + $companystatic->fournisseur = 0; + } + if ($obj->type == 2) { + $companystatic->id = $obj->id; + $companystatic->client = 0; + $companystatic->fournisseur = $obj->nature2; + } + print ''; // Action column @@ -466,7 +487,12 @@ if ($resql) { // Customer if ($obj->type == 1) { - $s .= ''.$langs->trans("Customer").''; + $s .= ''; + $s .= $langs->trans("Customer"); + $s .= ''; + if ($obj->nature == 2) { + $s .= ' ('.$langs->trans("Prospect").')'; + } } elseif ($obj->type == 2) { // Supplier $s .= ''.$langs->trans("Supplier").''; @@ -475,9 +501,6 @@ if ($resql) { $s .= ''.$langs->trans("Employee").''; } print $s; - if ($obj->nature == 2) { - print ' ('.$langs->trans("Prospect").')'; - } print ''; if (!$i) { $totalarray['nbfield']++; @@ -489,11 +512,11 @@ if ($resql) { if (!empty($arrayfields['reconcilable']['checked'])) { print ''; if (empty($obj->reconcilable)) { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 37c52af55e8..153644333b7 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1623,7 +1623,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (isModEnabled('mailman') && getDolGlobalString('ADHERENT_USE_SPIP')) { $formquestion[] = array('type' => 'other', 'label' => $langs->transnoentitiesnoconv("SynchroSpipEnabled"), 'value' => ''); } - print $form->formconfirm("card.php?rowid=".$id, $langs->trans("ValidateMember"), $langs->trans("ConfirmValidateMember"), "confirm_valid", $formquestion, 'yes', 1, 220); + print $form->formconfirm("card.php?rowid=".$id, $langs->trans("ValidateMember"), $langs->trans("ConfirmValidateMember"), "confirm_valid", $formquestion, 'yes', 1, 250); } // Confirm resiliate diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index fb48539e467..7ad5ee54ee7 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -112,14 +112,14 @@ class Adherent extends CommonObject public $civility; /** - * @var string company name + * @var ?string company name * @deprecated Use $company * @see $company */ public $societe; /** - * @var string company name + * @var ?string company name */ public $company; @@ -646,6 +646,9 @@ class Adherent extends CommonObject } } + // setEntity will set entity with the right value if empty or change it for the right value if multicompany module is active + $this->entity = setEntity($this); + $this->db->begin(); // Insert member @@ -658,7 +661,7 @@ class Adherent extends CommonObject $sql .= ", ".($user->id > 0 ? $user->id : "null"); // Can be null because member can be created by a guest or a script $sql .= ", null, null, '".$this->db->escape($this->morphy)."'"; $sql .= ", ".((int) $this->typeid); - $sql .= ", ".$conf->entity; + $sql .= ", ".((int) $this->entity); $sql .= ", ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); $sql .= ", ".(!empty($this->ip) ? "'".$this->db->escape($this->ip)."'" : "null"); $sql .= ")"; @@ -3297,7 +3300,7 @@ class Adherent extends CommonObject $return .= '
'; $return .= ''; if (property_exists($this, 'photo') || !empty($this->photo)) { - $return .= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1); + $return .= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photowithmargin photologintooltip', 'small', 0, 1); } else { $return .= img_picto('', 'user'); } diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 3f0ebd040f2..8e5362fdeec 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -95,6 +95,7 @@ print load_fiche_titre($title, '', $memberstatic->picto); //dol_mkdir($dir); $data = array(); $tab = null; +$label = ''; if ($mode) { // Define sql @@ -263,6 +264,7 @@ if ($mode && !count($data)) { // Show graphics if (count($arrayjs) && $mode == 'memberbycountry') { + global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; $color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; if (is_readable($color_file)) { include $color_file; diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index a4d7451af03..3b7b80d6935 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -608,7 +608,7 @@ if (getDolGlobalInt('MAIN_MULTILANGS')) { // Public $linkofpubliclist = DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.((isModEnabled('multicompany')) ? '?entity='.$conf->entity : ''); -print ''.$form->textwithpicto($langs->trans("PublicFile"), $langs->trans("Public", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist), 1, 'help', '', 0, 3, 'publicfile').''.yn($object->public).''; +print ''.$form->textwithpicto($langs->trans("MembershipPublic"), $langs->trans("Public", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist), 1, 'help', '', 0, 3, 'publicfile').''.yn($object->public).''; // Other attributes $cols = 2; @@ -617,7 +617,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; // Third party Dolibarr if (isModEnabled('societe')) { print ''; - print '
'; + print ''; if ($action != 'editthirdparty' && $user->hasRight('adherent', 'creer')) { @@ -638,9 +638,9 @@ if (isModEnabled('societe')) { print ''; print '
'; print $langs->trans("LinkedToDolibarrThirdParty"); print '
'; } else { - if ($object->fk_soc) { + if ($object->socid > 0) { $company = new Societe($db); - $result = $company->fetch($object->fk_soc); + $result = $company->fetch($object->socid); print $company->getNomUrl(1); // Show link to invoices @@ -659,7 +659,7 @@ if (isModEnabled('societe')) { // Login Dolibarr - Link to user print '
'; -print '
'; +print ''; if ($action != 'editlogin' && $user->hasRight('adherent', 'creer')) { diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index da7e77b2810..02714bc87df 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -532,7 +532,7 @@ if ($action == 'edit') { // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { - print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE', $oauthservices, $conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE); + print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE', $oauthservices, getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE')); } else { $text = $oauthservices[getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE')]; if (empty($text)) { diff --git a/htdocs/admin/order.php b/htdocs/admin/order.php index e2f2cac0bfe..ebad20367b1 100644 --- a/htdocs/admin/order.php +++ b/htdocs/admin/order.php @@ -695,7 +695,7 @@ print "\n"; // Allow external download print ''; print ''; -print ''; print ''; diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 81ca57f03ac..a67844e31bc 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -80,6 +80,15 @@ $statuslist = array( include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +if (GETPOSTISSET('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION')) { // only for no js case + $param_disable_email = GETPOST('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION', $param_disable_email, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + } +} + if ($action == 'updateMask') { $maskconstticket = GETPOST('maskconstticket', 'aZ09'); $maskticket = GETPOST('maskticket', 'alpha'); @@ -112,17 +121,9 @@ if ($action == 'updateMask') { } elseif (preg_match('/set_(.*)/', $action, $reg)) { $code = $reg[1]; $value = GETPOSTISSET($code) ? GETPOSTINT($code) : 1; - if ($code == 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS' && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } - } else { - $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } + $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; } } elseif (preg_match('/del_(.*)/', $action, $reg)) { $code = $reg[1]; @@ -240,15 +241,6 @@ if ($action == 'updateMask') { if (!($res > 0)) { $error++; } - - // For compatibility when javascript is not enabled - if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 && empty($conf->use_javascript_ajax)) { - $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } - } } @@ -605,21 +597,6 @@ print $formcategory->textwithpicto('', $langs->trans("TicketAutoChangeStatusOnAn print ''; print ''; -// Check "Notify thirdparty" on ticket creation -print ''; -print ''; -print ''; -print ''; - print ''; print '"; print '
'; print $langs->trans("LinkedToDolibarrUser"); print '
'.$langs->trans("AllowExternalDownload").''; +print ''; print ajax_constantonoff('ORDER_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1); print '
'.$langs->trans("TicketAutoCheckNotifyThirdParty").''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $formcategory->selectarray("TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION", $arrval, getDolGlobalString('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION')); -} -print ''; -print $formcategory->textwithpicto('', $langs->trans("TicketAutoCheckNotifyThirdPartyHelp"), 1, 'help'); -print '
'.$langs->trans("TicketsDelayBeforeFirstAnswer")." @@ -646,13 +623,14 @@ print $formcategory->buttonsSaveCancel("Save", '', array(), 0, 'reposition'); print ''; +print '
'; /* - * Notification + * Emails */ // Admin var of module -print load_fiche_titre($langs->trans("Notification"), '', ''); +print load_fiche_titre($langs->trans("Emails"), '', ''); print ''; @@ -662,7 +640,8 @@ print ''; print ''; print ''; -print ''; +print ''; +print ''; print ''; print "\n"; @@ -687,28 +666,26 @@ print ''; // Email for notification of TICKET_CREATE print ''; print ''; +print ''; print ''; print ''; -// Also send to TICKET_NOTIFICATION_EMAIL_TO for responses (not only creation) -if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - print ''; - print ''; - print ''; - print ''; +// Check "Notify thirdparty" on ticket creation +print ''; +print ''; +print ''; +print ''; // Message header $mail_intro = getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO', ''); diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php index 52a61d81c57..2c09caf0618 100644 --- a/htdocs/admin/ticket_public.php +++ b/htdocs/admin/ticket_public.php @@ -84,15 +84,6 @@ if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE') { } } - if (GETPOSTISSET('TICKET_DISABLE_CUSTOMER_MAILS')) { // only for no js case - $param_disable_email = GETPOST('TICKET_DISABLE_CUSTOMER_MAILS', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_DISABLE_CUSTOMER_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - $errors[] = $db->lasterror(); - } - } - if (GETPOSTISSET('TICKET_SHOW_COMPANY_LOGO')) { // only for no js case $param_show_module_logo = GETPOST('TICKET_SHOW_COMPANY_LOGO', 'alpha'); $res = dolibarr_set_const($db, 'TICKET_SHOW_COMPANY_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity); @@ -408,23 +399,6 @@ if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) { print ''; print ''; - // Also send to main email address - if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - print ''; - print ''; - print ''; - print ''; - } - if (empty($conf->use_javascript_ajax)) { print ''; print ''; @@ -516,20 +490,6 @@ if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) { print ''; print ''; - // Activate email creation to user - print ''; - print ''; - print ''; - // Text of email after creatio of a ticket $mail_mesg_new = getDolGlobalString("TICKET_MESSAGE_MAIL_NEW", $langs->trans('TicketNewEmailBody')); print ''; print ''; + // Also send to main email address + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { + print ''; + print ''; + print ''; + } + print '
'.$langs->trans("Email").''.$langs->trans("Parameter").''.$langs->trans("ShortInfo").'
'.$langs->trans("TicketEmailNotificationTo").''; -print ''; print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help'); print '
'.$langs->trans("TicketsEmailAlsoSendToMainAddress").''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $formcategory->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS); - } - print ''; - print $formcategory->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help'); - print '
'.$langs->trans("TicketAutoCheckNotifyThirdParty").''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $formcategory->selectarray("TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION", $arrval, getDolGlobalString('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION')); } +print ''; +print $formcategory->textwithpicto('', $langs->trans("TicketAutoCheckNotifyThirdPartyHelp"), 1, 'help'); +print '
'.$langs->trans("TicketsEmailAlsoSendToMainAddress").''; - if (!empty($conf->use_javascript_ajax)) { - print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, getDolGlobalInt('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS')); - } - print ''; - print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp", $langs->transnoentitiesnoconv("TicketEmailNotificationTo").' ('.$langs->transnoentitiesnoconv("Creation").')', $langs->trans("Settings")), 1, 'help'); - print '
'; - print $form->textwithpicto($langs->trans("TicketsDisableCustomerEmail"), $langs->trans("TicketsDisableEmailHelp"), 1, 'help'); - print ''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('TICKET_DISABLE_CUSTOMER_MAILS'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("TICKET_DISABLE_CUSTOMER_MAILS", $arrval, getDolGlobalInt('TICKET_DISABLE_CUSTOMER_MAILS')); - } - print '
'; @@ -564,6 +524,22 @@ if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) { print '
'.$langs->trans("TicketsEmailAlsoSendToMainAddress"); + print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp", $langs->transnoentitiesnoconv("TicketEmailNotificationTo").' ('.$langs->transnoentitiesnoconv("Creation").')', $langs->trans("Settings")), 1, 'help'); + print ''; + if (!empty($conf->use_javascript_ajax)) { + print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, getDolGlobalInt('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS')); + } + print '
'; print ''; diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 75d92306f16..433f08bcd80 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -418,6 +418,6 @@ class DolibarrApi */ protected static function _forge_criteria_callback($matches) { - return dolForgeCriteriaCallback($matches); + return dolForgeSQLCriteriaCallback($matches); } } diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 90718bbe85f..e7f8a9b1139 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -2139,8 +2139,8 @@ if ($id > 0) { 'type' => 'user', //'transparency'=>$object->userassigned[$user->id]['transparency'], 'transparency' => $object->transparency, // Force transparency on ownerfrom event - 'answer_status' => $object->userassigned[$object->userownerid]['answer_status'], - 'mandatory' => $object->userassigned[$object->userownerid]['mandatory'] + 'answer_status' => (isset($object->userassigned[$object->userownerid]['answer_status']) ? $object->userassigned[$object->userownerid]['answer_status']: null), + 'mandatory' => (isset($object->userassigned[$object->userownerid]['mandatory']) ? $object->userassigned[$object->userownerid]['mandatory']:null) ); } if (!empty($object->userassigned)) { // Now concat assigned users diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index fb94299c405..249e342d5fc 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -2715,83 +2715,86 @@ class ActionComm extends CommonObject // Load event $res = $this->fetch($actionCommReminder->fk_actioncomm); if ($res > 0) { - $res = $this->fetch_thirdparty(); - } - if ($res > 0) { - // PREPARE EMAIL - $errormesg = ''; + $res2 = $this->fetch_thirdparty(); + if ($res2 >= 0) { + // PREPARE EMAIL + $errormesg = ''; - // Make substitution in email content - $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $this); + // Make substitution in email content + $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $this); - complete_substitutions_array($substitutionarray, $langs, $this); + complete_substitutions_array($substitutionarray, $langs, $this); - // Content - $sendContent = make_substitutions($langs->trans($arraymessage->content), $substitutionarray); + // Content + $sendContent = make_substitutions($langs->trans($arraymessage->content), $substitutionarray); - //Topic - $sendTopic = (!empty($arraymessage->topic)) ? $arraymessage->topic : html_entity_decode($langs->transnoentities('EventReminder')); + //Topic + $sendTopic = (!empty($arraymessage->topic)) ? $arraymessage->topic : html_entity_decode($langs->transnoentities('EventReminder')); - // Recipient - $recipient = new User($this->db); - $res = $recipient->fetch($actionCommReminder->fk_user); - if ($res > 0) { - if (!empty($recipient->email)) { - $to = $recipient->email; + // Recipient + $recipient = new User($this->db); + $res = $recipient->fetch($actionCommReminder->fk_user); + if ($res > 0) { + if (!empty($recipient->email)) { + $to = $recipient->email; + } else { + $errormesg = "Failed to send remind to user id=".$actionCommReminder->fk_user.". No email defined for user."; + $error++; + } } else { - $errormesg = "Failed to send remind to user id=".$actionCommReminder->fk_user.". No email defined for user."; + $errormesg = "Failed to load recipient with user id=".$actionCommReminder->fk_user; $error++; } + + // Sender + $from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); + if (empty($from)) { + $errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM"; + $error++; + } + + if (!$error) { + // Errors Recipient + $errors_to = getDolGlobalString('MAIN_MAIL_ERRORS_TO'); + + // Mail Creation + $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', '', '', '', ''); + + // Sending Mail + if ($cMailFile->sendfile()) { + $nbMailSend++; + } else { + $errormesg = 'Failed to send email to: '.$to.' '.$cMailFile->error.implode(',', $cMailFile->errors); + $error++; + } + } + + if (!$error) { + $actionCommReminder->status = $actionCommReminder::STATUS_DONE; + + $res = $actionCommReminder->update($user); + if ($res < 0) { + $errorsMsg[] = "Failed to update status to done of ActionComm Reminder"; + $error++; + break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. + } + } else { + $actionCommReminder->status = $actionCommReminder::STATUS_ERROR; + $actionCommReminder->lasterror = dol_trunc($errormesg, 128, 'right', 'UTF-8', 1); + + $res = $actionCommReminder->update($user); + if ($res < 0) { + $errorsMsg[] = "Failed to update status to error of ActionComm Reminder"; + $error++; + break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. + } else { + $errorsMsg[] = $errormesg; + } + } } else { - $errormesg = "Failed to load recipient with user id=".$actionCommReminder->fk_user; + $errorsMsg[] = 'Failed to fetch record thirdparty on actioncomm with ID = '.$actionCommReminder->fk_actioncomm; $error++; } - - // Sender - $from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); - if (empty($from)) { - $errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM"; - $error++; - } - - if (!$error) { - // Errors Recipient - $errors_to = getDolGlobalString('MAIN_MAIL_ERRORS_TO'); - - // Mail Creation - $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', '', '', '', ''); - - // Sending Mail - if ($cMailFile->sendfile()) { - $nbMailSend++; - } else { - $errormesg = 'Failed to send email to: '.$to.' '.$cMailFile->error.implode(',', $cMailFile->errors); - $error++; - } - } - - if (!$error) { - $actionCommReminder->status = $actionCommReminder::STATUS_DONE; - - $res = $actionCommReminder->update($user); - if ($res < 0) { - $errorsMsg[] = "Failed to update status to done of ActionComm Reminder"; - $error++; - break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. - } - } else { - $actionCommReminder->status = $actionCommReminder::STATUS_ERROR; - $actionCommReminder->lasterror = dol_trunc($errormesg, 128, 'right', 'UTF-8', 1); - - $res = $actionCommReminder->update($user); - if ($res < 0) { - $errorsMsg[] = "Failed to update status to error of ActionComm Reminder"; - $error++; - break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. - } else { - $errorsMsg[] = $errormesg; - } - } } else { $errorsMsg[] = 'Failed to fetch record actioncomm with ID = '.$actionCommReminder->fk_actioncomm; $error++; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index ffe50ab8e41..cc2a9324478 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -1435,7 +1435,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $tmpcontact->fetch($event->contact_id); $cachecontacts[$event->contact_id] = $tmpcontact; } - $cases2[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs); + $cases3[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs); } } if ($event->date_start_in_calendar < $c && $dateendtouse > $b2) { diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c42b5b22c93..ac6d62da82c 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1135,6 +1135,8 @@ class Propal extends CommonObject $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } + // setEntity will set entity with the right value if empty or change it for the right value if multicompany module is active + $this->entity = setEntity($this); // Set tmp vars $delivery_date = $this->delivery_date; @@ -1229,7 +1231,7 @@ class Propal extends CommonObject $sql .= ", ".($this->fk_project ? $this->fk_project : "null"); $sql .= ", ".(int) $this->fk_incoterms; $sql .= ", '".$this->db->escape($this->location_incoterms)."'"; - $sql .= ", ".setEntity($this); + $sql .= ", ".(int) $this->entity; $sql .= ", ".(int) $this->fk_multicurrency; $sql .= ", '".$this->db->escape($this->multicurrency_code)."'"; $sql .= ", ".(float) $this->multicurrency_tx; @@ -3566,7 +3568,7 @@ class Propal extends CommonObject $this->multicurrency_code = $conf->currency; // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new PropaleLigne($this->db); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 3e97bd80372..4a6d220c49c 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -947,6 +947,7 @@ class Commande extends CommonOrder $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } + $this->entity = setEntity($this); dol_syslog(get_class($this)."::create user=".$user->id); @@ -1010,7 +1011,7 @@ class Commande extends CommonOrder $sql .= ", ".(!empty($this->warehouse_id) && $this->warehouse_id > 0 ? ((int) $this->warehouse_id) : 'NULL'); $sql .= ", ".(int) $this->fk_incoterms; $sql .= ", '".$this->db->escape($this->location_incoterms)."'"; - $sql .= ", ".setEntity($this); + $sql .= ", ".(int) $this->entity; $sql .= ", ".($this->module_source ? "'".$this->db->escape($this->module_source)."'" : "null"); $sql .= ", ".($this->pos_source != '' ? "'".$this->db->escape($this->pos_source)."'" : "null"); $sql .= ", ".(int) $this->fk_multicurrency; @@ -4049,8 +4050,9 @@ class Commande extends CommonOrder $this->status = $this::STATUS_DRAFT; // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; + while ($xnbp < $nbp) { $line = new OrderLine($this->db); diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 6f4e4a946f3..3dd37bf0d1b 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -554,7 +554,11 @@ if ($id > 0 || !empty($ref)) { // Bank card $head = bank_prepare_head($object); - print dol_get_fiche_head($head, 'journal', $langs->trans("FinancialAccount"), 0, 'account'); + $activetab = 'journal'; + if ($action == 'reconcile') { + $activetab = 'reconcile'; + } + print dol_get_fiche_head($head, $activetab, $langs->trans("FinancialAccount"), 0, 'account'); $linkback = ''.$langs->trans("BackToList").''; @@ -566,7 +570,7 @@ if ($id > 0 || !empty($ref)) { /* * Buttons actions */ - + /* Moved into tab if ($action != 'reconcile') { if ($object->canBeConciliated() > 0) { $allowautomaticconciliation = false; // TODO @@ -598,6 +602,7 @@ if ($id > 0 || !empty($ref)) { } } } + */ } $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,"; @@ -1032,8 +1037,8 @@ if ($resql) { print ''; print ' '.$langs->trans("otherwise").' '; print ''; - print ' '.$langs->trans("or").' '; - print ''; + //print ' '.$langs->trans("or").' '; + //print ''; print ''; print '
'; diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index f1d3523c336..1ebf78604fd 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -310,7 +310,7 @@ if (empty($numref)) { print dol_get_fiche_end(); - + /* Moved as a tab if ($object->canBeConciliated() > 0) { $allowautomaticconciliation = false; // TODO $titletoconciliatemanual = $langs->trans("Conciliate"); @@ -339,6 +339,7 @@ if (empty($numref)) { } } } + */ // List of mass actions available $arrayofmassactions = array( diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 69c859037b2..243ab3af6c1 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -216,7 +216,7 @@ if (GETPOST("account") || GETPOST("ref")) { $morehtml = ''; $limit = 0; - print_barre_liste($langs->trans("RemainderToPay"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit, 0, 0, 1); + print_barre_liste($langs->trans("PlannedTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit, 0, 0, 1); $solde = $object->solde(0); diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index a8dfc070bd4..8dc01195026 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -29,6 +29,7 @@ require '../../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; 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.'/compta/bank/class/paymentvarious.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index c8242aa1753..f9cd158244f 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1311,7 +1311,7 @@ class FactureRec extends CommonInvoice if (empty($this->date_when)) { return false; } - return dol_time_plus_duree($this->date_when, $this->frequency, $this->unit_frequency); + return dol_time_plus_duree($this->date_when, $this->frequency, $this->unit_frequency, 1); } /** @@ -1830,7 +1830,7 @@ class FactureRec extends CommonInvoice if (empty($option) || $option != 'nolines') { // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new FactureLigne($this->db); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index dacff6569d8..e63c86551cc 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -523,6 +523,7 @@ class Facture extends CommonInvoice $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } + $this->entity = setEntity($this); dol_syslog(get_class($this)."::create user=".$user->id." date=".$this->date); @@ -718,7 +719,7 @@ class Facture extends CommonInvoice $sql .= ")"; $sql .= " VALUES ("; $sql .= "'(PROV)'"; - $sql .= ", ".setEntity($this); + $sql .= ", ".(int) $this->entity; $sql .= ", ".($this->ref_ext ? "'".$this->db->escape($this->ref_ext)."'" : "null"); $sql .= ", '".$this->db->escape($this->type)."'"; $sql .= ", ".($this->subtype ? "'".$this->db->escape($this->subtype)."'" : "null"); @@ -1472,6 +1473,8 @@ class Facture extends CommonInvoice $this->fk_account = $object->fk_account; $this->cond_reglement_id = $object->cond_reglement_id; $this->mode_reglement_id = $object->mode_reglement_id; + $this->fk_incoterms = $object->fk_incoterms; + $this->location_incoterms = $object->location_incoterms; $this->availability_id = $object->availability_id; $this->demand_reason_id = $object->demand_reason_id; $this->delivery_date = $object->delivery_date; @@ -5156,7 +5159,7 @@ class Facture extends CommonInvoice if (empty($option) || $option != 'nolines') { // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new FactureLigne($this->db); diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index e6d8b689ac2..4d69db45350 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -136,7 +136,7 @@ class FactureStats extends Stats } if ($categid) { - $this->where .= ' AND EXISTS (SELECT rowid FROM '.MAIN_DB_PREFIX.'categorie_societe as cats WHERE cats.fk_soc = f.fk_soc AND cats.fk_categorie = '.((int) $categid).')'; + $this->where .= ' AND EXISTS (SELECT cats.fk_categorie FROM '.MAIN_DB_PREFIX.'categorie_societe as cats WHERE cats.fk_soc = f.fk_soc AND cats.fk_categorie = '.((int) $categid).')'; } } diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 29d6488f4ab..25eb5c6f532 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -990,7 +990,7 @@ if ($object->id > 0) { // Iban print '
'; - print $obj->iban; + print dolDecrypt($obj->iban); if ($obj->iban && $obj->bic) { print " / "; } @@ -1119,7 +1119,7 @@ if ($object->id > 0) { // Iban print ''; - print $obj->iban; + print dolDecrypt($obj->iban); if ($obj->iban && $obj->bic) { print " / "; } diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 55222f6c4cd..7fd7ea75d88 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1068,7 +1068,7 @@ class BonPrelevement extends CommonObject // phpcs:enable global $conf, $langs, $user; - dol_syslog(__METHOD__ . " Bank=" . $banque . " Office=" . $agence . " mode=" . $mode . " format=" . $format, LOG_DEBUG); + dol_syslog(__METHOD__ . " Bank=".$banque." Office=".$agence." mode=".$mode." format=".$format." type=".$type." did=".$did." fk_bank_account=".$fk_bank_account." sourcetype=".$sourcetype, LOG_DEBUG); require_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php"; require_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php"; @@ -1150,7 +1150,7 @@ class BonPrelevement extends CommonObject dol_syslog(__METHOD__ . " Read invoices for did=" . ((int) $did), LOG_DEBUG); $sql = "SELECT f.rowid, pd.rowid as pfdrowid"; - $sql .= ", f.".$this->db->sanitize($socOrUser); + $sql .= ", f.".$this->db->sanitize($socOrUser); // fk_soc or fk_user $sql .= ", pd.code_banque, pd.code_guichet, pd.number, pd.cle_rib"; $sql .= ", pd.amount"; if ($sourcetype != 'salary') { @@ -1200,7 +1200,12 @@ class BonPrelevement extends CommonObject while ($i < $num) { $row = $this->db->fetch_row($resql); // TODO Replace with fetch_object() '@phan-var-force array,string> $row'; - $factures[$i] = $row; // All fields + + // All fields: 0=rowid, 1=pfdrowid, 2=$socOrUser, 3=code_banque, 4=code_guichet, 5=number, 6=key, 7=amount, 8=name, 9=ref, 10=bic, 11=iban, 12=frstrecur + $factures[$i] = $row; + + // Decode BAN + $factures[$i][11] = dolDecrypt($factures[$i][11]); if ($row[7] == 0) { $error++; @@ -1232,20 +1237,10 @@ class BonPrelevement extends CommonObject // Check BAN $i = 0; - dol_syslog(__METHOD__ . " Check BAN", LOG_DEBUG); + dol_syslog(__METHOD__ . " Check BAN for each invoices or salary", LOG_DEBUG); if (count($factures) > 0) { foreach ($factures as $key => $fac) { - /* - if ($type != 'bank-transfer') { - $tmpinvoice = new Facture($this->db); - } else { - $tmpinvoice = new FactureFournisseur($this->db); - } - $resfetch = $tmpinvoice->fetch($fac[0]); - if ($resfetch >= 0) { // Field 0 of $fac is rowid of invoice - */ - // Check if $fac[8] s.nom is null if ($fac[8] != null) { if ($type != 'bank-transfer') { @@ -1259,6 +1254,7 @@ class BonPrelevement extends CommonObject $verif = checkSwiftForAccount(null, $fac[10]); if ($verif || (empty($fac[10]) && getDolGlobalInt("WITHDRAWAL_WITHOUT_BIC"))) { + dol_syslog(__METHOD__." now call checkIbanForAccount(null, ".$fac[11].")"); $verif = checkIbanForAccount(null, $fac[11]); } @@ -1312,7 +1308,7 @@ class BonPrelevement extends CommonObject $ok = 0; // Withdraw invoices in factures_prev array - $out = count($factures_prev) . " invoices will be included."; + $out = count($factures_prev) . " invoices or salaries will be included."; //print $out."\n"; dol_syslog($out); @@ -1901,8 +1897,9 @@ class BonPrelevement extends CommonObject $cachearraytotestduplicate[$obj->idfac] = $obj->rowid; $daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec); + $iban = dolDecrypt($obj->iban); - $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->reffac, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type); + $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->reffac, $obj->idfac, $iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type); $this->total += $obj->somme; $i++; @@ -2044,12 +2041,13 @@ class BonPrelevement extends CommonObject $cachearraytotestduplicate[$obj->idfac] = $obj->rowid; $daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec); + $iban = dolDecrypt($obj->iban); $refobj = $obj->reffac; if (empty($refobj) && !empty($forsalary)) { // If ref of salary not defined, we force a value $refobj = "SAL" . $obj->idfac; } - $fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $refobj, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type, $obj->fac_ref_supplier); + $fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $refobj, $obj->idfac, $iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type, $obj->fac_ref_supplier); $this->total += $obj->somme; $i++; diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 34610f8d98a..f7da72fa53d 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -274,9 +274,9 @@ print ''; print ''; if ($modecompta == 'BOOKKEEPING') { - print_liste_field_titre("PredefinedGroups", $_SERVER["PHP_SELF"], 'f.thirdparty_code,f.rowid', '', $param, '', $sortfield, $sortorder, 'width200 '); + print_liste_field_titre("PredefinedGroups", $_SERVER["PHP_SELF"], 'f.thirdparty_code,f.rowid', '', $param, '', $sortfield, $sortorder, ''); } else { - print_liste_field_titre("", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'width200 '); + print_liste_field_titre("", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, ''); } print_liste_field_titre(''); if ($modecompta == 'BOOKKEEPING') { diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 54fee8c2882..e0ea47ccbd8 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -60,6 +60,7 @@ $refresh = (GETPOSTISSET('submit') || GETPOSTISSET('vat_rate_show') || GETPOSTIS $invoice_type = GETPOSTISSET('invoice_type') ? GETPOST('invoice_type', 'alpha') : ''; $vat_rate_show = GETPOSTISSET('vat_rate_show') ? GETPOST('vat_rate_show', 'alphanohtml') : -1; +// Set $date_start_xxx and $date_end_xxx... include DOL_DOCUMENT_ROOT . '/compta/tva/initdatesforvat.inc.php'; // Variables provided by include: ' @@ -323,7 +324,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { foreach ($x_paye[$my_paye_rate]['facid'] as $id => $dummy) { // ExpenseReport - if ($x_paye[$my_paye_rate]['ptype'][$id] == 'ExpenseReportPayment') { + if ($x_paye[$my_paye_rate]['ptype'][$id] === 'ExpenseReportPayment') { $expensereport->id = $x_paye[$my_paye_rate]['facid'][$id]; $expensereport->ref = $x_paye[$my_paye_rate]['facnum'][$id]; $expensereport->type = $x_paye[$my_paye_rate]['type'][$id]; @@ -441,7 +442,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { print ""; print 'error .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("SalesRepresentativeFollowUp")); $paramsok = 0; } + $this->entity = setEntity($this); if (!$paramsok) { return -1; } @@ -1043,7 +1044,7 @@ class Contrat extends CommonObject $sql .= ",".($this->commercial_suivi_id > 0 ? ((int) $this->commercial_suivi_id) : "NULL"); $sql .= ",".($this->fk_project > 0 ? ((int) $this->fk_project) : "NULL"); $sql .= ", ".(dol_strlen($this->ref) <= 0 ? "null" : "'".$this->db->escape($this->ref)."'"); - $sql .= ", ".((int) $conf->entity); + $sql .= ", ".((int) $this->entity); $sql .= ", ".((int) $this->signed_status); $sql .= ", ".(!empty($this->note_private) ? ("'".$this->db->escape($this->note_private)."'") : "NULL"); $sql .= ", ".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL"); @@ -2486,7 +2487,7 @@ class Contrat extends CommonObject $this->note_public = 'This is a comment (public)'; $this->fk_project = 0; // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new ContratLigne($this->db); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 80bbf2c800f..b76e51d2d17 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -637,7 +637,7 @@ abstract class CommonObject public $comments = array(); /** - * @var string The name + * @var ?string The name */ public $name; @@ -6856,28 +6856,52 @@ abstract class CommonObject } if ($extrafields->attributes[$this->table_element]['type'][$attributeKey] == 'point') { // for point type if (!empty($new_array_options[$key])) { - $sql .= ",ST_PointFromText('".$this->db->escape($new_array_options[$key])."')"; + if (!preg_match('/error/i', $new_array_options[$key])) { + // Text must be a WKT string, so "POINT(15 20)" + $sql .= ",ST_PointFromText('".$this->db->escape($new_array_options[$key])."')"; + } else { + dol_syslog("Bad syntax string for point ".$new_array_options[$key]." to generate SQL request", LOG_WARNING); + $sql .= ",null"; + } } else { $sql .= ",null"; } } if ($extrafields->attributes[$this->table_element]['type'][$attributeKey] == 'multipts') { // for point type if (!empty($new_array_options[$key])) { - $sql .= ",ST_MultiPointFromText('".$this->db->escape($new_array_options[$key])."')"; + if (!preg_match('/error/i', $new_array_options[$key])) { + // Text must be a WKT string, so "MULTIPOINT(0 0, 20 20, 60 60)" + $sql .= ",ST_MultiPointFromText('".$this->db->escape($new_array_options[$key])."')"; + } else { + dol_syslog("Bad syntax string for multipoint ".$new_array_options[$key]." to generate SQL request", LOG_WARNING); + $sql .= ",null"; + } } else { $sql .= ",null"; } } if ($extrafields->attributes[$this->table_element]['type'][$attributeKey] == 'linestrg') { // for linestring type if (!empty($new_array_options[$key])) { - $sql .= ",ST_LineFromText('".$this->db->escape($new_array_options[$key])."')"; + if (!preg_match('/error/i', $new_array_options[$key])) { + // Text must be a WKT string, so "LINESTRING(0 0, 10 10, 20 25, 50 60)" + $sql .= ",ST_LineFromText('".$this->db->escape($new_array_options[$key])."')"; + } else { + dol_syslog("Bad syntax string for line ".$new_array_options[$key]." to generate SQL request", LOG_WARNING); + $sql .= ",null"; + } } else { $sql .= ",null"; } } if ($extrafields->attributes[$this->table_element]['type'][$attributeKey] == 'polygon') { // for polygon type if (!empty($new_array_options[$key])) { - $sql .= ",ST_PolyFromText('".$this->db->escape($new_array_options[$key])."')"; + if (!preg_match('/error/i', $new_array_options[$key])) { + // Text must be a WKT string, so "POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))" + $sql .= ",ST_PolyFromText('".$this->db->escape($new_array_options[$key])."')"; + } else { + dol_syslog("Bad syntax string for polygon ".$new_array_options[$key]." to generate SQL request", LOG_WARNING); + $sql .= ",null"; + } } else { $sql .= ",null"; } @@ -9395,14 +9419,14 @@ abstract class CommonObject $out .= getPictoForType($extrafields->attributes[$this->table_element]['type'][$key], ($extrafields->attributes[$this->table_element]['type'][$key] == 'text' ? 'tdtop' : '')); } //$out .= ''; - $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element); + $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this, $this->table_element); break; case "edit": $listoftypestoshowpicto = explode(',', getDolGlobalString('MAIN_TYPES_TO_SHOW_PICTO', 'email,phone,ip,password')); if (in_array($extrafields->attributes[$this->table_element]['type'][$key], $listoftypestoshowpicto)) { $out .= getPictoForType($extrafields->attributes[$this->table_element]['type'][$key], ($extrafields->attributes[$this->table_element]['type'][$key] == 'text' ? 'tdtop' : '')); } - $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', '', $this->id, $this->table_element, 0, $this); + $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', '', $this, $this->table_element, 0, $this); break; } diff --git a/htdocs/core/class/commonpeople.class.php b/htdocs/core/class/commonpeople.class.php index 8bd31082ba7..9d80dbdd518 100644 --- a/htdocs/core/class/commonpeople.class.php +++ b/htdocs/core/class/commonpeople.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2023-2024 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -152,9 +152,9 @@ trait CommonPeople /** * Return full address for banner * - * @param string $htmlkey HTML id to make banner content unique - * @param Object $object Object (thirdparty, thirdparty of contact for contact, null for a member) - * @return string Full address string + * @param string $htmlkey HTML id to make banner content unique + * @param CommonObject $object Object (thirdparty, thirdparty of contact for contact, null for a member) + * @return string Full address string */ public function getBannerAddress($htmlkey, $object) { @@ -165,20 +165,24 @@ trait CommonPeople $contactid = 0; $thirdpartyid = 0; $elementforaltlanguage = $this->element; - if ($this->element == 'societe') { - /** @var Societe $this */ + if ($this->element === 'societe' && $this instanceof Societe) { $thirdpartyid = $this->id; } - if ($this->element == 'contact') { - /** @var Contact $this */ + if ($this->element === 'contact' && $this instanceof Contact) { $contactid = $this->id; $thirdpartyid = empty($this->fk_soc) ? 0 : $this->fk_soc; } - if ($this->element == 'user') { - /** @var User $this */ + if ($this->element == 'member' && $this instanceof Adherent) { + $contactid = $this->id; + $thirdpartyid = empty($this->socid) ? 0 : $this->socid; + } + if ($this->element === 'user' && $this instanceof User) { $contactid = $this->contact_id; $thirdpartyid = empty($object->fk_soc) ? 0 : $object->fk_soc; } + if ($this->element == 'recruitmentcandidature' && $this instanceof RecruitmentCandidature) { + $thirdpartyid = 0; + } $out = ''; @@ -210,7 +214,7 @@ trait CommonPeople $arrayoflangcode[] = getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE'); } - if (is_array($arrayoflangcode) && count($arrayoflangcode)) { + if (/* is_array($arrayoflangcode) && */count($arrayoflangcode)) { if (!is_object($extralanguages)) { include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php'; $extralanguages = new ExtraLanguages($this->db); @@ -258,7 +262,7 @@ trait CommonPeople // Phones $outphonedone = 0; if (!empty($this->phone) && empty($this->phone_pro)) { // For objects that store pro phone into ->phone - $out .= ($outphonedone ? ' ' : ''); + // $out .= ($outphonedone ? ' ' : ''); $out .= dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro")); $outdone++; $outphonedone++; @@ -387,7 +391,7 @@ trait CommonPeople $this->address = dol_strtoupper($this->address); $this->town = dol_strtoupper($this->town); } - if (isset($this->email)) { + if (!empty($this->email)) { $this->email = dol_strtolower($this->email); } if (isset($this->personal_email)) { diff --git a/htdocs/core/class/dolgeophp.class.php b/htdocs/core/class/dolgeophp.class.php index 78f6bfed620..d5211bcc436 100644 --- a/htdocs/core/class/dolgeophp.class.php +++ b/htdocs/core/class/dolgeophp.class.php @@ -115,10 +115,15 @@ class DolGeoPHP { $value_key = ''; - $geom = geoPHP::load($geojson, 'json'); - if ($geom) { - '@phan-var-force Geometry $geom'; - $value_key = $geom->out('wkt'); + try { + $geom = geoPHP::load($geojson, 'json'); + if ($geom) { + '@phan-var-force Geometry $geom'; + $value_key = $geom->out('wkt'); + } + } catch (Exception $e) { + // Do nothing + $value_key = 'Error: Bad value for property'; } return $value_key; } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 70d529ff0fa..ee4e149f9ed 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1076,19 +1076,18 @@ class ExtraFields * Return HTML string to put an input field into a page * Code very similar with showInputField of common object * - * @param string $key Key of attribute + * @param string $key Key of attribute * @param string|array{start:int,end:int} $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value); for dates in filter mode, a range array('start'=>, 'end'=>) should be provided - * @param string $moreparam To add more parameters on html input tag - * @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names) - * @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names) - * @param string $morecss More css (to defined size of field. Old behaviour: may also be a numeric) - * @param int $objectid Current object id - * @param string $extrafieldsobjectkey The key to use to store retrieved data (commonly $object->table_element) - * @param int $mode 1=Used for search filters - * @param ?CommonObject $object Common object dolibarr + * @param string $moreparam To add more parameters on html input tag + * @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names) + * @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names) + * @param string $morecss More css (to defined size of field. Old behaviour: may also be a numeric) + * @param int|CommonObject $object Current object or object ID. Preferably, pass the object itself. + * @param string $extrafieldsobjectkey The key to use to store retrieved data (commonly $object->table_element) + * @param int $mode 1=Used for search filters * @return string */ - public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '', $objectid = 0, $extrafieldsobjectkey = '', $mode = 0, $object = null) + public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '', $object = 0, $extrafieldsobjectkey = '', $mode = 0) { global $conf, $langs, $form; @@ -1097,6 +1096,8 @@ class ExtraFields $form = new Form($this->db); } + $objectid = (is_numeric($object) ? $object : $object->id); + $out = ''; if (!preg_match('/options_$/', $keyprefix)) { // Because we work on extrafields, we add 'options_' to prefix if not already added @@ -1121,6 +1122,7 @@ class ExtraFields $list = (string) dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '2'); $totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key]; $help = $this->attributes[$extrafieldsobjectkey]['help'][$key]; + $alwayseditable = $this->attributes[$extrafieldsobjectkey]['alwayseditable'][$key]; $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) //var_dump('key='.$key.' '.$value.' '.$moreparam.' '.$keysuffix.' '.$keyprefix.' '.$objectid.' '.$extrafieldsobjectkey.' '.$mode); @@ -1982,6 +1984,12 @@ class ExtraFields if (!empty($hidden)) { $out = ''; } + + // If alwayseditable is false, and object is not in draft, then showOutputField + // @phan-suppress-next-line PhanUndeclaredConstantOfClass + if ($alwayseditable == 0 && is_object($object) && isset($object->status) && defined(get_class($object)."::STATUS_DRAFT") && $object->status != $object::STATUS_DRAFT) { + $out = $this->showOutputField($key, $value, $moreparam, $extrafieldsobjectkey, null, $object); + } /* Add comments if ($type == 'date') $out.=' (YYYY-MM-DD)'; elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)'; @@ -2001,7 +2009,7 @@ class ExtraFields * @param string $moreparam To add more parameters on html input tag (only checkbox use html input for output rendering) * @param string $extrafieldsobjectkey Required (for example $object->table_element). * @param Translate|null $outputlangs Output - * @param object $object The parent object of field to show + * @param CommonObject $object The parent object of field to show * @return string Formatted value */ public function showOutputField($key, $value, $moreparam = '', $extrafieldsobjectkey = '', $outputlangs = null, $object = null) @@ -2035,7 +2043,7 @@ class ExtraFields // If alwayseditable is false, and object is not in draft, then we show value instead of input field $showValueInsteadOfInputField = 0; // Variable used to disable update of fields via ajax // @phan-suppress-next-line PhanUndeclaredConstantOfClass - if ($alwayseditable == 0 && !is_numeric($object) && isset($object->status) && $object->status != $object::STATUS_DRAFT) { + if ($alwayseditable == 0 && is_object($object) && isset($object->status) && defined(get_class($object)."::STATUS_DRAFT") && $object->status != $object::STATUS_DRAFT) { $showValueInsteadOfInputField = 1; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e61568e6209..218c5822d66 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2767,9 +2767,9 @@ class Form } if (empty($hidelabel)) { - $out .= $langs->trans("RefOrLabel") . ' : '; + $placeholder = ' placeholder="' . dolPrintHTMLForAttribute($langs->trans("RefOrLabel")) . '"'; } elseif ($hidelabel > 1) { - $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; + $placeholder = ' placeholder="' . dolPrintHTMLForAttribute($langs->trans("RefOrLabel")) . '"'; if ($hidelabel == 2) { $out .= img_picto($langs->trans("Search"), 'search'); } @@ -5263,14 +5263,15 @@ class Form while ($i < $num) { $obj = $this->db->fetch_object($result); + $iban = dolDecrypt($obj->iban_prefix); if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) { - $out .= ''; $i++; diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 57f86f121cf..65b4cea3a88 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -511,7 +511,7 @@ class FormAdmin */ public function selectTypeOfFields($htmlname, $type, $typewecanchangeinto = array()) { - global $type2label; // TODO Remove this + global $type2label; // TODO Remove this global $out = ''; diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index 2c2390a9005..0ca6f57f458 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -515,7 +515,9 @@ class vCard $this->setOrg($company->name); } - $this->setURL($company->url, ""); + if (!empty($company->url)) { + $this->setURL($company->url, ""); + } if ($company->phone && empty($object->office_phone)) { // If we already set the type TYPE=WORK,VOICE with office_phone $this->setPhoneNumber($company->phone, "TYPE=WORK,VOICE"); diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index eb867663795..8378d992bd3 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -639,14 +639,14 @@ function ajax_event($htmlname, $events) * @param string $suffix Suffix to use on the name of the switch picto when option is on. Example: '', '_red' * @param string $mode Add parameter &mode= to the href link (Used for href link) * @param string $morecss More CSS - * @param int $userconst 1=OnOff for user constant of user $userconst + * @param User|int $userconst If set, use the ajax On/Off for user or user ID $userconst * @param string $showwarning String to show a warning when enabled the option * @return string * @see ajax_object_onoff() to update the status of an object */ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0, $setzeroinsteadofdel = 0, $suffix = '', $mode = '', $morecss = 'inline-block', $userconst = 0, $showwarning = '') { - global $conf, $langs, $user; + global $conf, $langs, $user, $db; $entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity); if (!isset($input)) { @@ -660,6 +660,15 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof $out = ''.img_picto($langs->trans("Enabled"), 'on').''; } } else { + $userconstid = 0; + if (is_object($userconst)) { + $userconstid = $userconst->id; + } elseif (is_numeric($userconst) && $userconst > 0) { + $userconstid = $userconst; + $userconst = new User($db); + $userconst->fetch($userconstid); + } + $out = "\n".' '."\n"; - if ($userconst) { - $value = getDolUserString($code); + if (!empty($userconst) && $userconst instanceof User) { + $value = getDolUserString($code, '', $userconst); } else { $value = getDolGlobalString($code); } @@ -724,7 +734,7 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof * On/off button to change a property status of an object * This uses the ajax service objectonoff.php (May be called when MAIN_DIRECT_STATUS_UPDATE is set for some pages) * - * @param Object $object Object to set + * @param CommonObject $object Object to set * @param string $code Name of property in object : 'status' or 'status_buy' for product by example * @param string $field Name of database field : 'tosell' or 'tobuy' for product by example * @param string $text_on Text if on ('Text' or 'Text:Picto on:Css picto on') @@ -744,7 +754,6 @@ function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input = if (empty($htmlname)) { $htmlname = $code; } - //var_dump($object->module); var_dump($object->element); $out = ''; diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 787ae745949..5815d177767 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -38,7 +38,8 @@ */ function bank_prepare_head(Account $object) { - global $db, $langs, $conf; + global $db, $langs, $conf, $user; + $h = 0; $head = array(); @@ -52,23 +53,44 @@ function bank_prepare_head(Account $object) $head[$h][2] = 'journal'; $h++; - // if ($conf->global->MAIN_FEATURES_LEVEL >= 1) - // { - $head[$h][0] = DOL_URL_ROOT."/compta/bank/treso.php?account=".$object->id; - $head[$h][1] = $langs->trans("PlannedTransactions"); - $head[$h][2] = 'cash'; - $h++; - // } + if ($object->canBeConciliated() > 0) { + $allowautomaticconciliation = getDolGlobalBool('MAIN_ALLOW_AUTOMATIC_CONCILIATION'); // TODO + $titletoconciliatemanual = $langs->trans("Conciliate"); + $titletoconciliateauto = $langs->trans("Conciliate"); + if ($allowautomaticconciliation) { + $titletoconciliatemanual .= ' ('.$langs->trans("Manual").')'; + $titletoconciliateauto .= ' ('.$langs->trans("Auto").')'; + } - $head[$h][0] = DOL_URL_ROOT."/compta/bank/annuel.php?account=".$object->id; - $head[$h][1] = $langs->trans("IOMonthlyReporting"); - $head[$h][2] = 'annual'; - $h++; + $param = ''; - $head[$h][0] = DOL_URL_ROOT."/compta/bank/graph.php?account=".$object->id; - $head[$h][1] = $langs->trans("Graph"); - $head[$h][2] = 'graph'; - $h++; + // If not cash account and can be reconciliate + if ($user->hasRight('banque', 'consolidate')) { + $head[$h][0] = DOL_URL_ROOT."/compta/bank/bankentries_list.php?id=".$object->id.'&action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0&search_account='.$object->id.$param; + $head[$h][1] = $titletoconciliatemanual; + $head[$h][2] = 'reconcile'; + $h++; + }/* else { + $buttonreconcile = ''.$titletoconciliatemanual.''; + }*/ + + if ($allowautomaticconciliation) { + // If not cash account and can be reconciliate + if ($user->hasRight('banque', 'consolidate')) { + $newparam = $param; + $newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam); + + $head[$h][0] = DOL_URL_ROOT."/compta/bank/bankentries_list.php?id=".$object->id.'&action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0&search_account='.$object->id.$newparam; + $head[$h][1] = $titletoconciliateauto; + $head[$h][2] = 'reconcileauto'; + $h++; + + //$buttonreconcile .= ' '.$titletoconciliateauto.''; + }/* else { + $buttonreconcile .= ' '.$titletoconciliateauto.''; + }*/ + } + } if ($object->type != Account::TYPE_CASH || getDolGlobalString('BANK_CAN_RECONCILIATE_CASHACCOUNT')) { $nbReceipts = 0; @@ -110,6 +132,21 @@ function bank_prepare_head(Account $object) $head[$h][2] = 'document'; $h++; + $head[$h][0] = DOL_URL_ROOT."/compta/bank/annuel.php?account=".$object->id; + $head[$h][1] = $langs->trans("IOMonthlyReporting"); + $head[$h][2] = 'annual'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/compta/bank/graph.php?account=".$object->id; + $head[$h][1] = $langs->trans("Graph"); + $head[$h][2] = 'graph'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/compta/bank/treso.php?account=".$object->id; + $head[$h][1] = $langs->trans("PlannedTransactions"); + $head[$h][2] = 'cash'; + $h++; + // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 2a77d594349..737f8ac24fc 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1898,7 +1898,7 @@ function dol_init_file_process($pathtoscan = '', $trackid = '') * @param int<0,1> $generatethumbs 1=Generate also thumbs for uploaded image files * @param ?Object $object Object used to set 'src_object_*' fields * @param string $forceFullTestIndexation '1'=Force full text storage in database even if global option not set (consume a high level of data) - * @return int Return integer <=0 if KO, >0 if OK + * @return int Return integer <=0 if KO, nb of success if OK (>0) * @see dol_remove_file_process() */ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $updatesessionordb = 0, $varfiles = 'addedfile', $savingdocmask = '', $link = null, $trackid = '', $generatethumbs = 1, $object = null, $forceFullTestIndexation = '') @@ -2041,7 +2041,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $updatesessionor } } if ($nbok > 0) { - $res = 1; + $res = $nbok; setEventMessages($langs->trans("FileTransferComplete"), null, 'mesgs'); } } else { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d2609495d49..c2800d3ef84 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4039,7 +4039,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor $link = str_replace('{socialid}', $value, getDolGlobalString($networkconstname)); if (preg_match('/^https?:\/\//i', $link)) { $htmllink .= ''.dol_escape_htmltag($value).''; - } else { + } elseif ($link) { $htmllink .= ''.dol_escape_htmltag($value).''; } } elseif (!empty($dictsocialnetworks[$type]['url'])) { @@ -13777,7 +13777,7 @@ function forgeSQLFromUniversalSearchCriteria($filter, &$errorstr = '', $noand = } } - $ret = ($noand ? "" : " AND ").($nopar ? "" : '(').preg_replace_callback('/'.$regexstring.'/i', 'dolForgeCriteriaCallback', $filter).($nopar ? "" : ')'); + $ret = ($noand ? "" : " AND ").($nopar ? "" : '(').preg_replace_callback('/'.$regexstring.'/i', 'dolForgeSQLCriteriaCallback', $filter).($nopar ? "" : ')'); if (is_object($db)) { $ret = str_replace('__NOW__', $db->idate(dol_now()), $ret); @@ -13938,14 +13938,14 @@ function dolForgeDummyCriteriaCallback($matches) } /** - * Function to forge a SQL criteria from a Dolibarr filter syntax string. + * Function to forge a SQL criteria from a USF (Universal Filter Syntax) string. * This method is called by forgeSQLFromUniversalSearchCriteria() * * @param string[] $matches Array of found string by regex search. * Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.date_creation:<:'2016-01-01 12:30:00'" or "t.nature:is:NULL" * @return string Forged criteria. Example: "t.field LIKE 'abc%'" */ -function dolForgeCriteriaCallback($matches) +function dolForgeSQLCriteriaCallback($matches) { global $db; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 95566b86a53..2383a86619f 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -581,7 +581,7 @@ function project_admin_prepare_head() /** * Show task lines with a particular parent * - * @param string $inc Line number (start to 0, then increased by recursive call) + * @param int $inc Line number (start to 0, then increased by recursive call) * @param int $parent Id of parent task to show (0 to show all) * @param Task[] $lines Array of lines * @param int $level Level (start to 0, then increased/decrease by recursive call), or -1 to show all level in order of $lines without the recursive groupment feature. @@ -1168,7 +1168,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t /** * Output a task line into a pertime input mode * - * @param string $inc Line number (start to 0, then increased by recursive call) + * @param int $inc Line number (start to 0, then increased by recursive call) * @param int $parent Id of parent task to show (0 to show all) * @param ?User $fuser Restrict list to user if defined * @param Task[] $lines Array of lines @@ -1398,7 +1398,7 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec /** * Output a task line into a pertime input mode * - * @param string $inc Line number (start to 0, then increased by recursive call) + * @param int $inc Line number (start to 0, then increased by recursive call) * @param int $parent Id of parent task to show (0 to show all) * @param ?User $fuser Restrict list to user if defined * @param Task[] $lines Array of lines @@ -1801,7 +1801,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr /** * Output a task line into a perday input mode * - * @param string $inc Line output identificator (start to 0, then increased by recursive call) + * @param int $inc Line output identificator (start to 0, then increased by recursive call) * @param int $firstdaytoshow First day to show * @param ?User $fuser Restrict list to user if defined * @param int $parent Id of parent task to show (0 to show all) @@ -2207,7 +2207,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ /** * Output a task line into a perday input mode * - * @param string $inc Line output identificator (start to 0, then increased by recursive call) + * @param int $inc Line output identificator (start to 0, then increased by recursive call) * @param int $firstdaytoshow First day to show * @param User|null $fuser Restrict list to user if defined * @param int $parent Id of parent task to show (0 to show all) diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index 205031bed98..ed5586ff29d 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -1160,8 +1160,8 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire $sql = "SELECT d.rowid, d.product_type as dtype, e.rowid as facid, d.$f_rate as rate, d.vat_src_code as vat_src_code, d.total_ht as total_ht, d.total_ttc as total_ttc, d.total_tva as total_vat, e.note_private as descr,"; $sql .= " d.total_localtax1 as total_localtax1, d.total_localtax2 as total_localtax2, "; $sql .= " e.date_debut as date_start, e.date_fin as date_end, e.fk_user_author,"; - $sql .= " e.ref as facnum, e.total_ttc as ftotal_ttc, e.date_create, d.fk_c_type_fees as type,"; - $sql .= " p.fk_bank as payment_id, p.amount as payment_amount, p.rowid as pid, e.ref as pref"; + $sql .= " e.ref as facnum, e.ref as pref, e.total_ttc as ftotal_ttc, e.date_create, d.fk_c_type_fees as type,"; + $sql .= " p.fk_bank as payment_id, p.amount as payment_amount, p.rowid as pid"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as e"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."expensereport_det as d ON d.fk_expensereport = e.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_expensereport as p ON p.fk_expensereport = e.rowid"; @@ -1184,7 +1184,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire $sql .= " AND (d.product_type = -1"; $sql .= " OR e.date_debut is NOT null OR e.date_fin IS NOT NULL)"; // enhance detection of service if (getDolGlobalString('MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS')) { - $sql .= " AND (d.".$f_rate." <> 0 OR d.total_tva <> 0)"; + $sql .= " AND (d.".$db->sanitize($f_rate)." <> 0 OR d.total_tva <> 0)"; } $sql .= " ORDER BY e.rowid"; diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 190a50e6ae1..f5873eaeeb3 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -689,7 +689,7 @@ class pdf_espadon extends ModelePdfExpedition $weighttxt = round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, getDolGlobalInt('SHIPMENT_ROUND_WEIGHT_ON_PDF', 5)).' '.measuringUnitString(0, "weight", $object->lines[$i]->weight_units, 1); } $voltxt = ''; - if (empty($object->lines[$i]->fk_product_type) && $object->lines[$i]->volume) { + if (empty($object->lines[$i]->fk_product_type) && $object->lines[$i]->volume && !getDolGlobalString('SHIPPING_PDF_HIDE_VOLUME')) { $voltxt = round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, getDolGlobalInt('SHIPMENT_ROUND_VOLUME_ON_PDF', 5)).' '.measuringUnitString(0, "volume", $object->lines[$i]->volume_units ? $object->lines[$i]->volume_units : 0, 1); } @@ -883,13 +883,13 @@ class pdf_espadon extends ModelePdfExpedition if (!empty($totalWeight)) { $totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs, -1, 'no', 1); } - if (!empty($totalVolume)) { + if (!empty($totalVolume) && !getDolGlobalString('SHIPPING_PDF_HIDE_VOLUME')) { $totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs, -1, 'no', 1); } if (!empty($object->trueWeight)) { $totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, (int) $object->weight_units, "weight", $outputlangs); } - if (!empty($object->trueVolume)) { + if (!empty($object->trueVolume) && !getDolGlobalString('SHIPPING_PDF_HIDE_VOLUME')) { if ($object->volume_units < 50) { $totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs); } else { diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index dfaa64aafea..9d54b5b4e88 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -583,7 +583,7 @@ class pdf_rouget extends ModelePdfExpedition $weighttxt = round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, getDolGlobalInt('SHIPMENT_ROUND_WEIGHT_ON_PDF', 5)).' '.measuringUnitString(0, "weight", $object->lines[$i]->weight_units, 1); } $voltxt = ''; - if (empty($object->lines[$i]->fk_product_type) && $object->lines[$i]->volume) { + if (empty($object->lines[$i]->fk_product_type) && $object->lines[$i]->volume && !getDolGlobalString('SHIPPING_PDF_HIDE_VOLUME')) { $voltxt = round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, getDolGlobalInt('SHIPMENT_ROUND_VOLUME_ON_PDF', 5)).' '.measuringUnitString(0, "volume", $object->lines[$i]->volume_units ? $object->lines[$i]->volume_units : 0, 1); } @@ -769,13 +769,13 @@ class pdf_rouget extends ModelePdfExpedition if (!empty($totalWeight)) { $totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs, -1, 'no', 1); } - if (!empty($totalVolume)) { + if (!empty($totalVolume) && !getDolGlobalString('SHIPPING_PDF_HIDE_VOLUME')) { $totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs, -1, 'no', 1); } if (!empty($object->trueWeight)) { $totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, (int) $object->weight_units, "weight", $outputlangs); } - if (!empty($object->trueVolume)) { + if (!empty($object->trueVolume) && !getDolGlobalString('SHIPPING_PDF_HIDE_VOLUME')) { $totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs); } diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 41b98dcf06d..9661cdb6416 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -160,11 +160,13 @@ class InterfaceTicketEmail extends DolibarrTriggers $see_ticket_assignee = 'SeeThisTicketIntomanagementInterface'; // Send email to notification email + // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation because email sending is already managed by page + // $object->context['createdfrompublicinterface'] may also be defined when creation done from public interface if (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') && empty($object->context['disableticketemail'])) { - $sendto = !getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') ? '' : $conf->global->TICKET_NOTIFICATION_EMAIL_TO; - if ($sendto) { - $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs); - } + $sendto = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); + // if ($sendto) { // already test, can't be empty + $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs); + // } } // Send email to assignee if an assignee was set at creation @@ -196,7 +198,9 @@ class InterfaceTicketEmail extends DolibarrTriggers } // Send email to customer - if (!getDolGlobalInt('TICKET_DISABLE_CUSTOMER_MAILS') && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) { + // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation because email sending is already managed by page + // $object->context['createdfrompublicinterface'] may also be defined when creation done from public interface + if (empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) { $sendto = ''; // if contact selected send to email's contact else send to email's thirdparty @@ -244,15 +248,17 @@ class InterfaceTicketEmail extends DolibarrTriggers $see_ticket_customer = 'TicketCloseEmailBodyInfosTrackUrlCustomer'; // Send email to notification email + // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation but not at closing if (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') && empty($object->context['disableticketemail'])) { - $sendto = !getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') ? '' : $conf->global->TICKET_NOTIFICATION_EMAIL_TO; - if ($sendto) { - $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs); - } + $sendto = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); + // if ($sendto) { // already test, can't be empty + $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs); + // } } // Send email to customer. - if (!getDolGlobalString('TICKET_DISABLE_CUSTOMER_MAILS') && empty($object->context['disableticketemail'])) { + // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation but not at closing + if (empty($object->context['disableticketemail'])) { $linked_contacts = $object->listeContact(-1, 'thirdparty'); $linked_contacts = array_merge($linked_contacts, $object->listeContact(-1, 'internal')); if (empty($linked_contacts) && getDolGlobalString('TICKET_NOTIFY_AT_CLOSING') && !empty($object->fk_soc)) { @@ -353,7 +359,7 @@ class InterfaceTicketEmail extends DolibarrTriggers $message_admin .= '

'.$langs->trans('Message').' :

'.$message.'


'; $message_admin .= '

'.$langs->trans('SeeThisTicketIntomanagementInterface').'

'; - $from = getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . '<' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>'; + $from = (getDolGlobalString('MAIN_INFO_SOCIETE_NOM') ? getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . ' ' : '') . '<' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>'; $trackid = 'tic'.$object->id; @@ -442,7 +448,7 @@ class InterfaceTicketEmail extends DolibarrTriggers $message_customer .= '

'.$langs->trans($see_ticket).' : '.$url_public_ticket.'

'; $message_customer .= '

'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'

'; - $from = (!getDolGlobalString('MAIN_INFO_SOCIETE_NOM') ? '' : getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . ' ').'<' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>'; + $from = (getDolGlobalString('MAIN_INFO_SOCIETE_NOM') ? getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . ' ' : '').'<' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>'; $trackid = 'tic'.$object->id; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 2583dec22c2..38e18e2302c 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -138,6 +138,8 @@ $result = restrictedArea($user, 'expedition', $object->id, ''); $permissiondellink = $user->hasRight('expedition', 'delivery', 'creer'); // Used by the include of actions_dellink.inc.php $permissiontoadd = $user->hasRight('expedition', 'creer'); +$upload_dir = $conf->expedition->dir_output.'/sending'; + $editColspan = 0; $objectsrc = null; $typeobject = null; @@ -146,6 +148,7 @@ $typeobject = null; /* * Actions */ + $error = 0; $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -169,7 +172,6 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once' // Actions to build doc - $upload_dir = $conf->expedition->dir_output.'/sending'; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; // Back to draft @@ -558,6 +560,14 @@ if (empty($reshook)) { if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } + } elseif ($action == 'setdate_shipping' && $user->hasRight('expedition', 'creer')) { + $dateshipping = dol_mktime(GETPOSTINT('ship_hour'), GETPOSTINT('ship_min'), 0, GETPOSTINT('ship_month'), GETPOSTINT('ship_day'), GETPOSTINT('ship_year')); + + $object->fetch($id); + $result = $object->setShippingDate($user, $dateshipping); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } elseif (in_array($action, array('settracking_number', 'settracking_url', 'settrueWeight', 'settrueWidth', 'settrueHeight', 'settrueDepth', 'setshipping_method_id')) && $user->hasRight('expedition', 'creer')) { // Action update $error = 0; @@ -2059,10 +2069,10 @@ if ($action == 'create') { print '
'; print $langs->trans('Rate') . ' : ' . vatrate($rate) . '%'; - print ' - "; print ''; print $langs->trans('Rate') . ' : ' . vatrate($rate) . '%'; - print ' - '; // Ref diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 08041134de3..5fc553e9994 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -508,7 +508,8 @@ class Contact extends CommonObject $this->statut = 0; // This is to convert '' into '0' to avoid bad sql request } - $this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity); + // setEntity will set entity with the right value if empty or change it for the right value if multicompany module is active + $this->entity = setEntity($this); $sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople ("; $sql .= " datec"; @@ -1530,7 +1531,7 @@ class Contact extends CommonObject * @param string $morecss Add more css on link * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $moreparam = '', $save_lastsearch_value = -1, $notooltip = 0, $morecss = '') + public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $moreparam = '', $save_lastsearch_value = -1, $notooltip = 0, $morecss = 'valignmiddle') { global $conf, $langs, $hookmanager; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 0d971f01723..ae6fd816681 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -166,26 +166,22 @@ if ($type == "p") { $contextpage = 'contactprospectlist'; } $title .= ' ('.$langs->trans("ThirdPartyProspects").')'; - $urlfiche = "card.php"; } if ($type == "c") { if (empty($contextpage) || $contextpage == 'contactlist') { $contextpage = 'contactcustomerlist'; } $title .= ' ('.$langs->trans("ThirdPartyCustomers").')'; - $urlfiche = "card.php"; } elseif ($type == "f") { if (empty($contextpage) || $contextpage == 'contactlist') { $contextpage = 'contactsupplierlist'; } $title .= ' ('.$langs->trans("ThirdPartySuppliers").')'; - $urlfiche = "card.php"; } elseif ($type == "o") { if (empty($contextpage) || $contextpage == 'contactlist') { $contextpage = 'contactotherlist'; } $title .= ' ('.$langs->trans("OthersNotLinkedToThirdParty").')'; - $urlfiche = ""; } // Initialize a technical object @@ -1453,7 +1449,6 @@ while ($i < $imaxinloop) { } } else { // Show here line of result - $j = 0; print '
'; print '
'; if ($action == 'editdate_shipping') { - print '
'; + print ''; print ''; - print ''; - print $form->selectDate($object->date_shipping ? $object->date_shipping : -1, 'liv_', 1, 1, 0, "setdate_shipping", 1, 0); + print ''; + print $form->selectDate($object->date_shipping ? $object->date_shipping : -1, 'ship_', 1, 1, 0, "setdate_shipping", 1, 0); print ''; print '
'; } else { diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 8a49d6139a6..47fae30ca4b 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -430,6 +430,7 @@ class Expedition extends CommonObject if (empty($this->date_shipping) && !empty($this->date_expedition)) { $this->date_shipping = $this->date_expedition; } + $this->entity = setEntity($this); $this->user = $user; @@ -462,7 +463,7 @@ class Expedition extends CommonObject $sql .= ", signed_status"; $sql .= ") VALUES ("; $sql .= "'(PROV)'"; - $sql .= ", ".((int) $conf->entity); + $sql .= ", ".((int) $this->entity); $sql .= ", ".($this->ref_customer ? "'".$this->db->escape($this->ref_customer)."'" : "null"); $sql .= ", ".($this->ref_ext ? "'".$this->db->escape($this->ref_ext)."'" : "null"); $sql .= ", '".$this->db->idate($now)."'"; @@ -2156,7 +2157,7 @@ class Expedition extends CommonObject $this->note_private = 'Private note'; $this->note_public = 'Public note'; - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new ExpeditionLigne($this->db); @@ -2223,6 +2224,34 @@ class Expedition extends CommonObject } } + /** + * Set the shipping date + * + * @param User $user Object user that modify + * @param integer $shipping_date Date of shipping + * @return int Return integer <0 if KO, >0 if OK + */ + public function setShippingDate($user, $shipping_date) + { + if ($user->hasRight('expedition', 'creer')) { + $sql = "UPDATE ".MAIN_DB_PREFIX."expedition"; + $sql .= " SET date_expedition = ".($shipping_date ? "'".$this->db->idate($shipping_date)."'" : 'null'); + $sql .= " WHERE rowid = ".((int) $this->id); + + dol_syslog(get_class($this)."::setShippingDate", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $this->date_shipping = $shipping_date; + return 1; + } else { + $this->error = $this->db->error(); + return -1; + } + } else { + return -2; + } + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Fetch deliveries method and return an array. Load array this->meths(rowid=>label). diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index e2cbfed00c5..b45450396bc 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -669,7 +669,7 @@ $companystatic = new Societe($db); $formcompany = new FormCompany($db); $shipment = new Expedition($db); -$title = $langs->trans('ListOfSendings'); +$title = $langs->trans('Shipments'); $help_url = 'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones'; llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'bodyforlist mod-expedition page-list'); @@ -934,8 +934,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ exit; } -$expedition = new Expedition($db); - if ($socid > 0) { $soc = new Societe($db); $soc->fetch($socid); @@ -1074,7 +1072,7 @@ print ''; print ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder -print_barre_liste($langs->trans('ListOfSendings'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'dolly', 0, $newcardbutton, '', $limit, 0, 0, 1); +print_barre_liste($langs->trans('Shipments'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'dolly', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "SendShippingRef"; $modelmail = "shipping_send"; @@ -1085,7 +1083,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($massaction == 'createbills') { print ''; - print ''; + print '
'; print ''; print ''; @@ -1119,7 +1120,7 @@ if ($action == 'create') { print $form->buttonsSaveCancel("CreateDraftIntervention"); // Show origin lines - if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { + if (!empty($origin) && !empty($originid) && is_object($objectsrc) && !getDolGlobalInt('FICHINTER_DISABLE_DETAILS')) { $title = $langs->trans('Services'); print load_fiche_titre($title); diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 33d4eda3805..1a9340923e6 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -295,6 +295,7 @@ class Fichinter extends CommonObject dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -1; } + $this->entity = setEntity($this); $soc = new Societe($this->db); $result = $soc->fetch($this->socid); @@ -325,7 +326,7 @@ class Fichinter extends CommonObject $sql .= ", '".$this->db->idate($now)."'"; $sql .= ", '".$this->db->escape($this->ref)."'"; $sql .= ", ".($this->ref_client ? "'".$this->db->escape($this->ref_client)."'" : "null"); - $sql .= ", ".((int) $conf->entity); + $sql .= ", ".((int) $this->entity); $sql .= ", ".((int) $user->id); $sql .= ", ".((int) $user->id); $sql .= ", ".($this->description ? "'".$this->db->escape($this->description)."'" : "null"); diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index b2debc9e3ca..f3635cbd023 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -1063,7 +1063,7 @@ while ($i < $imaxinloop) { print ''."\n"; - $total += $obj->duree; + $total += (isset($obj->duree) ? $obj->duree : 0); } $i++; } diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 53a7fba96df..ebd5fd2e3ca 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -268,7 +268,7 @@ if (empty($dolibarr_strict_mode)) { define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem core php (htdocs) if (!file_exists(DOL_DOCUMENT_ROOT."/core/lib/functions.lib.php")) { - print "Error: Dolibarr config file content seems to be not correctly defined.
\n"; + print "Error: Dolibarr config file content seems to be not correctly defined (file ".DOL_DOCUMENT_ROOT."/core/lib/functions.lib.php not found).
\n"; print "Please run dolibarr setup by calling page /install.
\n"; exit(1); } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 3fef90726d4..7f6dc7b957e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -116,6 +116,8 @@ class CommandeFournisseur extends CommonOrder /** * @var ?int<0,9> + * @deprecated see $status + * @see $status */ public $statut; // 0=Draft -> 1=Validated -> 2=Approved -> 3=Ordered/Process running -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially // -> 7=Canceled/Never received -> (reopen) 3=Process running @@ -892,7 +894,7 @@ class CommandeFournisseur extends CommonOrder */ public function getLibStatut($mode = 0) { - return $this->LibStatut($this->statut, $mode, $this->billed); + return $this->LibStatut($this->status, $mode, $this->billed); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -992,7 +994,7 @@ class CommandeFournisseur extends CommonOrder if ($user->hasRight("fournisseur", "commande", "read")) { $datas['picto'] = ''.$langs->trans("SupplierOrder").''; - if ($this->statut) { + if ($this->status) { $datas['picto'] .= ' '.$this->getLibStatut(5); } if (!empty($this->ref)) { @@ -1156,6 +1158,7 @@ class CommandeFournisseur extends CommonOrder $obj = new $classname(); '@phan-var-force ModeleNumRefSuppliersOrders $obj'; + /** @var ModeleNumRefSuppliersOrders $obj */ $numref = $obj->getNextValue($soc, $this); if ($numref != "") { @@ -1169,6 +1172,7 @@ class CommandeFournisseur extends CommonOrder return -2; } } + /** * Class invoiced the supplier order * @@ -1598,6 +1602,7 @@ class CommandeFournisseur extends CommonOrder $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } + $this->entity = setEntity($this); // We set order into draft status $this->statut = self::STATUS_DRAFT; // deprecated @@ -1630,7 +1635,7 @@ class CommandeFournisseur extends CommonOrder $sql .= ", ".(isset($this->ref_supplier) ? "'".$this->db->escape($this->ref_supplier)."'" : "NULL"); $sql .= ", '".$this->db->escape($this->note_private)."'"; $sql .= ", '".$this->db->escape($this->note_public)."'"; - $sql .= ", ".setEntity($this); + $sql .= ", ".((int) $this->entity); $sql .= ", ".((int) $this->socid); $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : "null"); $sql .= ", '".$this->db->idate($date)."'"; @@ -3188,9 +3193,10 @@ class CommandeFournisseur extends CommonOrder $this->multicurrency_code = $conf->currency; $this->statut = 0; + $this->status = 0; // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new CommandeFournisseurLigne($this->db); diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index db1b79ad4c6..7d2ea231dfc 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1307,7 +1307,7 @@ class FactureFournisseurRec extends CommonInvoice if (empty($this->date_when)) { return false; } - return dol_time_plus_duree((int) $this->date_when, $this->frequency, $this->unit_frequency); + return dol_time_plus_duree((int) $this->date_when, $this->frequency, $this->unit_frequency, 1); } /** @@ -1783,7 +1783,7 @@ class FactureFournisseurRec extends CommonInvoice if (empty($option) || $option != 'nolines') { // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new FactureLigne($this->db); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index c0514cead7e..b0b14cf5092 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -423,6 +423,7 @@ class FactureFournisseur extends CommonInvoice $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } + $this->entity = setEntity($this); $this->db->begin(); @@ -577,7 +578,7 @@ class FactureFournisseur extends CommonInvoice $sql .= "'(PROV)'"; $sql .= ", '".$this->db->escape($this->ref_supplier)."'"; $sql .= ", '".$this->db->escape($this->ref_ext)."'"; - $sql .= ", ".((int) $conf->entity); + $sql .= ", ".((int) $this->entity); $sql .= ", '".$this->db->escape($this->type)."'"; $sql .= ", ".((int) $this->subtype); $sql .= ", '".$this->db->escape(isset($this->label) ? $this->label : (isset($this->libelle) ? $this->libelle : ''))."'"; @@ -3071,7 +3072,7 @@ class FactureFournisseur extends CommonInvoice $xnbp = 0; if (empty($option) || $option != 'nolines') { // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) while ($xnbp < $nbp) { $line = new SupplierInvoiceLine($this->db); $line->desc = $langs->trans("Description")." ".$xnbp; diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index b1a80578fa6..3fd55c11bc4 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -242,7 +242,7 @@ if (!defined('DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) > $result = conf($dolibarr_main_document_root); } // Load database driver - if ($result) { + if ($result > 0) { if (!empty($dolibarr_main_document_root) && !empty($dolibarr_main_db_type)) { $result = include_once $dolibarr_main_document_root."/core/db/".$dolibarr_main_db_type.'.class.php'; if (!$result) { @@ -432,7 +432,7 @@ function conf($dolibarr_main_document_root) global $dolibarr_main_instance_unique_id; global $dolibarr_main_cookie_cryptkey; - $return = include_once $dolibarr_main_document_root.'/core/class/conf.class.php'; + $return = @include_once $dolibarr_main_document_root.'/core/class/conf.class.php'; if (!$return) { return -1; } diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index b2397e2069c..ec3053a6a40 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -349,7 +349,8 @@ ALTER TABLE llx_societe_commerciaux ADD COLUMN fk_c_type_contact_code varchar(32 -- VPGSQL8.2 DROP INDEX uk_societe_commerciaux; ALTER TABLE llx_societe_commerciaux ADD UNIQUE INDEX uk_societe_commerciaux_c_type_contact (fk_soc, fk_user, fk_c_type_contact_code); ALTER TABLE llx_c_type_contact ADD INDEX idx_c_type_contact_code (code); -ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_c_type_contact_code FOREIGN KEY (fk_c_type_contact_code) REFERENCES llx_c_type_contact(code); +--Removed, not unique. ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_c_type_contact_code FOREIGN KEY (fk_c_type_contact_code) REFERENCES llx_c_type_contact(code); +ALTER TABLE llx_societe_commerciaux DROP FOREIGN KEY fk_societe_commerciaux_fk_c_type_contact_code; ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid); ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user(rowid); diff --git a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql index b823e23f6f8..71037e6248e 100644 --- a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql +++ b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql @@ -81,7 +81,9 @@ ALTER TABLE llx_product DROP FOREIGN KEY fk_product_default_warehouse; DROP TABLE llx_contratdet_log; -ALTER TABLE llx_societe_rib MODIFY COLUMN iban_prefix varchar(60); +ALTER TABLE llx_societe_rib MODIFY COLUMN iban_prefix varchar(80); +ALTER TABLE llx_bank_account MODIFY COLUMN iban_prefix varchar(80); +ALTER TABLE llx_user_rib MODIFY COLUMN iban_prefix varchar(80); ALTER TABLE llx_bom_bom ADD COLUMN last_main_doc varchar(255) AFTER model_pdf; diff --git a/htdocs/install/mysql/tables/llx_bank_account.sql b/htdocs/install/mysql/tables/llx_bank_account.sql index b5edc3a2793..059cad3118b 100644 --- a/htdocs/install/mysql/tables/llx_bank_account.sql +++ b/htdocs/install/mysql/tables/llx_bank_account.sql @@ -39,7 +39,7 @@ create table llx_bank_account cle_rib varchar(5), bic varchar(11), -- 11 according to ISO 9362 bic_intermediate varchar(11), -- 11 according to ISO 9362. Same as bic but for intermediate bank - iban_prefix varchar(34), -- full iban. 34 according to ISO 13616 + iban_prefix varchar(80), -- full iban. 34 according to ISO 13616 but we set 80 to allow to store it with encryption information country_iban varchar(2), -- deprecated cle_iban varchar(2), domiciliation varchar(255), diff --git a/htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql b/htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql index 1672ff659c1..f4bc719c4ba 100644 --- a/htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql +++ b/htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql @@ -17,6 +17,6 @@ -- =================================================================== ALTER TABLE llx_societe_commerciaux ADD UNIQUE INDEX uk_societe_commerciaux_c_type_contact (fk_soc, fk_user, fk_c_type_contact_code); -ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_c_type_contact_code FOREIGN KEY (fk_c_type_contact_code) REFERENCES llx_c_type_contact(code); +--Removed, not unique. ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_c_type_contact_code FOREIGN KEY (fk_c_type_contact_code) REFERENCES llx_c_type_contact(code); ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid); ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user(rowid); diff --git a/htdocs/install/mysql/tables/llx_societe_rib.sql b/htdocs/install/mysql/tables/llx_societe_rib.sql index 064cc203131..9fb4370c243 100644 --- a/htdocs/install/mysql/tables/llx_societe_rib.sql +++ b/htdocs/install/mysql/tables/llx_societe_rib.sql @@ -39,7 +39,7 @@ create table llx_societe_rib bic varchar(20), -- 11 according to ISO 9362 (we keep 20 for backward compatibility) bic_intermediate varchar(11), -- 11 according to ISO 9362. Same as bic but for intermediate bank - iban_prefix varchar(60), -- full iban. 34 according to ISO 13616 ut we set 60 to allow to store it with encryption information + iban_prefix varchar(80), -- full iban. 34 according to ISO 13616 but we set 80 to allow to store it with encryption information domiciliation varchar(255), proprio varchar(60), diff --git a/htdocs/install/mysql/tables/llx_user_rib.sql b/htdocs/install/mysql/tables/llx_user_rib.sql index a86fbb01f9e..50733bcbc75 100644 --- a/htdocs/install/mysql/tables/llx_user_rib.sql +++ b/htdocs/install/mysql/tables/llx_user_rib.sql @@ -31,7 +31,7 @@ create table llx_user_rib cle_rib varchar(5), -- key of bank account bic varchar(11), -- 11 according to ISO 9362 bic_intermediate varchar(11), -- 11 according to ISO 9362. Same as bic but for intermediate bank - iban_prefix varchar(34), -- full iban. 34 according to ISO 13616 + iban_prefix varchar(80), -- full iban. 34 according to ISO 13616 but we set 80 to allow to store it with encryption information domiciliation varchar(255), proprio varchar(60), owner_address varchar(255), diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 7084a3332d7..fc5a4283965 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -133,7 +133,7 @@ DeleteTransaction=Delete entry ConfirmDeleteTransaction=Are you sure you want to delete this entry? ThisWillAlsoDeleteBankRecord=This will also delete generated bank entry BankMovements=Movements -PlannedTransactions=Planned entries +PlannedTransactions=Upcoming entries Graph=Graphs ExportDataset_banque_1=Bank entries and account statement ExportDataset_banque_2=Deposit slip diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index afe22259f17..5155d532f7c 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -60,7 +60,7 @@ Numberspad=Numbers Pad BillsCoinsPad=Coins and banknotes Pad DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr TakeposNeedsCategories=TakePOS needs at least one product category to work -TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS needs at least 1 product category under the category %s to work +TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS needs at least 1 sub-category under the product category %s to work OrderNotes=Can add some notes to each ordered items CashDeskBankAccountFor=Default account to use for payments in NoPaimementModesDefined=No paiment mode defined in TakePOS configuration diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index 7b78f488cd0..5c8287b4c0b 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -98,4 +98,5 @@ NeedBusinessTravels=Need business travels NoDescription=No description TheJobProfileHasNoSkillsDefinedFixBefore=The evaluated job profile of this employee has no skill defined on it. Please add skill(s), then delete and restart the evaluation. PDFStandardHrmEvaluation=Standard template to generate a PDF document for a competency assessment -SkillNotRequired=Skill not required \ No newline at end of file +SkillNotRequired=Skill not required +LinkToUserCreated=Link to an employee if the applicant has been hired and converted into a user. diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index 6afa486d033..4ea49a160fa 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -72,6 +72,7 @@ Language_fr_FR=French Language_fr_GA=French (Gabon) Language_fr_NC=French (New Caledonia) Language_fr_SN=French (Senegal) +Language_fr_TN=French (Tunisia) Language_fy_NL=Frisian Language_gl_ES=Galician Language_he_IL=Hebrew diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index c3b29b9751b..2d8d05e9761 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -97,7 +97,6 @@ ShowService=Show service ProductsAndServicesArea=Product and Services area ProductsArea=Product area ServicesArea=Services area -ListOfStockMovements=List of stock movements BuyingPrice=Buying price PriceForEachProduct=Products with specific prices SupplierCard=Vendor card diff --git a/htdocs/langs/en_US/receptions.lang b/htdocs/langs/en_US/receptions.lang index 80e9724b3b4..34b2276fca7 100644 --- a/htdocs/langs/en_US/receptions.lang +++ b/htdocs/langs/en_US/receptions.lang @@ -7,7 +7,6 @@ Receptions=Receptions AllReceptions=All Receptions ShowReception=Show Receptions ReceptionsArea=Receptions area -ListOfReceptions=List of receptions ReceptionMethod=Reception method LastReceptions=Latest %s receptions StatisticsOfReceptions=Statistics for receptions diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index eb9c16239cc..95406dcc87e 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -8,13 +8,12 @@ Shipments=Shipments ShowSending=Show Shipments Receivings=Delivery Receipts SendingsArea=Shipments area -ListOfSendings=List of shipments SendingMethod=Shipping method LastSendings=Latest %s shipments StatisticsOfSendings=Statistics for shipments NbOfSendings=Number of shipments NumberOfShipmentsByMonth=Number of shipments by month -SendingCard=Shipment card +SendingCard=Shipment NewSending=New shipment CreateShipment=Create shipment QtyShipped=Qty shipped diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 400a39ec951..9b651192a6b 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -27,9 +27,6 @@ LotSerialList=List of lot/serials SubjectToLotSerialOnly=Products subject to lot/serial only Movements=Movements ErrorWarehouseRefRequired=Warehouse reference name is required -ListOfWarehouses=List of warehouses -ListOfStockMovements=List of stock movements -ListOfInventories=List of inventories MovementId=Movement ID StockMovementForId=Movement ID %d ListMouvementStockProject=List of stock movements associated to project @@ -348,3 +345,4 @@ QtyViewed=Quantity viewed QtyStock=Quantity on stock QtyRegulated=Quantity on stock correction InventoryEntrepot=Warehouse identity +SelectedWarehouse=Select a warehouse diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index ee2449ce74c..39b8ff61ce6 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -72,10 +72,10 @@ TicketPublicAccess=A public interface requiring no identification is available a TicketSetupDictionaries=The type of ticket, severity and analytic codes are configurable from dictionaries TicketParamModule=Module variable setup TicketParamMail=Email setup -TicketEmailNotificationFrom=Sender e-mail for notification on answers -TicketEmailNotificationFromHelp=Sender e-mail to use to send the notification email when an answer is provided inside the back office. For example noreply@example.com +TicketEmailNotificationFrom=Sender e-mail for notification on tickets +TicketEmailNotificationFromHelp=Sender e-mail to use to send the notification emails for tickets creation or messages. For example noreply@example.com TicketEmailNotificationTo=Notify ticket creation to this e-mail address -TicketEmailNotificationToHelp=If present, this e-mail address will be notified of a ticket creation +TicketEmailNotificationToHelp=If present, this e-mail address will be notified of a ticket creation (in addition to any other default recipients) TicketNewEmailBodyLabel=Text message sent after creating a ticket TicketNewEmailBodyHelp=The text specified here will be inserted into the email confirming the creation of a new ticket from the public interface. Information on the consultation of the ticket are automatically added. TicketParamPublicInterface=Public interface setup @@ -96,7 +96,9 @@ TicketPublicInterfaceTextHelpMessageHelpAdmin=This text will appear above the me ExtraFieldsTicket=Extra attributes TicketCkEditorEmailNotActivated=HTML editor is not activated. Please put FCKEDITOR_ENABLE_MAIL content to 1 to get it. TicketsDisableEmail=Do not send emails for ticket creation or message recording -TicketsDisableEmailHelp=By default, emails are sent when new tickets or messages created. Enable this option to disable *all* email notifications +TicketsDisableEmailHelp=By default, notification emails to third parties are sent when new tickets or messages are created for both backoffice and public interface. Enable this option to disable email notifications to thirdparties when creation is done from backoffice. +TicketsNotifyThirdPartyFromBackOfficeByDefault=Notify third party by default on ticket creation from backoffice +TicketsNotifyThirdPartyFromBackOfficeByDefaultHelp=When creating a ticket from the backoffice, the option "Notify third party" will be checked by default TicketsLogEnableEmail=Enable log by email TicketsLogEnableEmailHelp=At each change, an email will be sent **to each contact** associated with the ticket. TicketParams=Params @@ -119,7 +121,7 @@ TicketAutoChangeStatusOnAnswerHelp=When a user answers to a ticket, the status w TicketNumberingModules=Tickets numbering module TicketsModelModule=Document templates for tickets TicketNotifyTiersAtCreation=Notify third party at creation -TicketsDisableCustomerEmail=Always disable emails when a ticket is created from public interface +TicketsDisableCustomerEmail=Always disable emails to third parties when a ticket is created from the backoffice TicketsPublicNotificationNewMessage=Send email(s) when a new message/comment is added to a ticket TicketsPublicNotificationNewMessageHelp=Send email(s) when a new message is added from public interface (to assigned user or the notifications email to (update) and/or the notifications email to) TicketPublicNotificationNewMessageDefaultEmail=Notifications email to (update) diff --git a/htdocs/langs/fr_FR/cashdesk.lang b/htdocs/langs/fr_FR/cashdesk.lang index 2f7a1a59aa8..ecbb052ad0b 100644 --- a/htdocs/langs/fr_FR/cashdesk.lang +++ b/htdocs/langs/fr_FR/cashdesk.lang @@ -60,7 +60,7 @@ Numberspad=Pavé numérique BillsCoinsPad=Pavé avec montant des Pièces et Billets DolistorePosCategory=Modules TakePOS et autres solutions de PDV pour Dolibarr TakeposNeedsCategories=TakePOS a besoin d'au moins une catégorie de produits pour fonctionner -TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS a besoin d'au moins 1 catégorie de produits dans la catégorie %s pour fonctionner +TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS a besoin d'au moins 1 sous-catégorie dans la catégorie de produit %s pour fonctionner OrderNotes=Il est possible d'ajouter des notes sur chacun des produits commandés CashDeskBankAccountFor=Compte par défaut à utiliser pour les paiements en NoPaimementModesDefined=Aucun mode de paiement défini dans la configuration de TakePOS diff --git a/htdocs/langs/fr_TN/main.lang b/htdocs/langs/fr_TN/main.lang new file mode 100644 index 00000000000..ae3db1eeb17 --- /dev/null +++ b/htdocs/langs/fr_TN/main.lang @@ -0,0 +1,31 @@ +# Dolibarr language file - Source file is en_US - main +DIRECTION=ltr +# Default for FONTFORPDF=helvetica +# Note for Chinese: +# msungstdlight or cid0ct are for traditional Chinese zh_TW (traditional does not render with Ubuntu pdf reader) +# stsongstdlight or cid0cs are for simplified Chinese zh_CN +# To read Chinese pdf with Linux: sudo apt-get install poppler-data +# cid0jp is for Japanish +# cid0kr is for Korean +# DejaVuSans is for some Eastern languages, some Asian languages and some Arabic languages +# freemono is for ru_RU or uk_UA, uz_UZ +# freeserif is for Tamil or Ethiopian +FONTFORPDF=helvetica +FONTSIZEFORPDF=10 +SeparatorDecimal=, +SeparatorThousand=Space +FormatDateShort=%d/%m/%Y +FormatDateShortInput=%d/%m/%Y +FormatDateShortJava=dd/MM/yyyy +FormatDateShortJavaInput=dd/MM/yyyy +FormatDateShortJQuery=dd/mm/yy +FormatDateShortJQueryInput=dd/mm/yy +FormatHourShortJQuery=HH:MI +FormatHourShort=%H:%M +FormatHourShortDuration=%H:%M +FormatDateTextShort=%d %b %Y +FormatDateText=%d %B %Y +FormatDateHourShort=%d/%m/%Y %H:%M +FormatDateHourSecShort=%d/%m/%Y %H:%M:%S +FormatDateHourTextShort=%d %b %Y %H:%M +FormatDateHourText=%d %B %Y %H:%M diff --git a/htdocs/langs/fr_TN/sendings.lang b/htdocs/langs/fr_TN/sendings.lang new file mode 100644 index 00000000000..776063f7602 --- /dev/null +++ b/htdocs/langs/fr_TN/sendings.lang @@ -0,0 +1,2 @@ +# Dolibarr language file - Source file is en_US - sendings +SendingCard=Bon livraison diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index ea093c7885a..3d7e56c8de8 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -650,6 +650,9 @@ print ''; +print '
'; + + print load_fiche_titre($langs->trans("UserInterface"), '', ''); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index e10fe4caabd..2ca40d0bad0 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -2539,6 +2539,7 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT $total_ttc = $resultarray[2]; if (!getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { + print ''."\n"; print ''; print ''; @@ -2580,7 +2581,10 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT print ''; if (!empty($extralabels)) { foreach ($extralabels as $key) { - print ''; + // Show field if not hidden + if (!empty($extrafields->attributes["product_customer_price"]['list'][$key]) && $extrafields->attributes["product_customer_price"]['list'][$key] != 3) { + print ''; + } } } if ($user->hasRight('produit', 'supprimer') || $user->hasRight('service', 'supprimer')) { diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index a0d2cf1a04a..f2708e0df27 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -217,7 +217,7 @@ if ($result || !($id > 0)) { // Product print ''; // Tag diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 6f4232b1ca7..45668188f93 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -478,7 +478,7 @@ class MouvementStock extends CommonObject return -8; } } else { - if (isset($product->stock_warehouse[$entrepot_id]) && (empty($product->stock_warehouse[$entrepot_id]->real) || $product->stock_warehouse[$entrepot_id]->real < abs($qty))) { + if (empty($product->stock_warehouse[$entrepot_id]) || empty($product->stock_warehouse[$entrepot_id]->real) || $product->stock_warehouse[$entrepot_id]->real < abs($qty)) { $langs->load("stocks"); $this->error = $langs->trans('qtyToTranferIsNotEnough').' : '.$product->ref; $this->errors[] = $langs->trans('qtyToTranferIsNotEnough').' : '.$product->ref; diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index f76a30f674a..9c81e707e3d 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -560,7 +560,7 @@ if ($resql) { if ($msid) { $texte = $langs->trans('StockMovementForId', $msid); } else { - $texte = $langs->trans("ListOfStockMovements"); + $texte = $langs->trans("StockMovements"); if ($id) { $texte .= ' ('.$langs->trans("ForThisWarehouse").')'; } diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index a8ecbeacf72..86986da7ed4 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -832,7 +832,7 @@ $help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; if ($msid) { $title = $langs->trans('StockMovementForId', $msid); } else { - $title = $langs->trans("ListOfStockMovements"); + $title = $langs->trans("StockMovements"); if ($id) { if (!empty($warehouse->ref)) { $title .= ' ('.$warehouse->ref.')'; @@ -1236,7 +1236,7 @@ if (!empty($arrayfields['pl.sellby']['checked'])) { if (!empty($arrayfields['e.ref']['checked'])) { print ''; } if (!empty($arrayfields['m.fk_user_author']['checked'])) { @@ -1564,7 +1564,7 @@ while ($i < $imaxinloop) { } // Warehouse if (!empty($arrayfields['e.ref']['checked'])) { - print '\n"; } @@ -1591,7 +1591,7 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['origin']['checked'])) { print ''; } - // fk_project + // Project if (!empty($arrayfields['m.fk_projet']['checked'])) { print ''; // Action column diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 523f93e97e4..aad0471027b 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -2119,6 +2119,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser break; } + // Line is invoiced if it has an invoice_id + $invoiced = $task_time->invoice_id ? true : false; + $date1 = $db->jdate($task_time->element_date); $date2 = $db->jdate($task_time->element_datehour); @@ -2156,7 +2159,18 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $selected = 1; } print ' '; - print ''; + + // Disable select if task not billable or already invoiced + $disabled = (intval($task_time->billable) != 1 || $invoiced); + $ctrl = ''; + if ($disabled) { + // If disabled, a dbl-click very close outside the control + // will re-enable it, so that user is not blocked if needed. + print ''.$ctrl.''; + print ''; + } else { + print $ctrl; + } } } } @@ -2426,7 +2440,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } // Invoiced - $invoiced = false; if (!empty($arrayfields['valuebilled']['checked'])) { print '
'; print $langs->trans('DateInvoice'); diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index f73497dd375..a4e5b557b08 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -968,7 +968,7 @@ class ExpenseReport extends CommonObject $this->note_private = 'Private note'; $this->note_public = 'SPECIMEN'; - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new ExpenseReportLine($this->db); diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 30ccab7725d..07311a5ca20 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -908,7 +908,7 @@ if ($action == 'create') { $res = $soc->fetch($socid); } - if (GETPOST('origin') && GETPOSTINT('originid')) { + if (GETPOST('origin', 'alphanohtml') && GETPOSTINT('originid')) { // Parse element/subelement (ex: project_task) $regs = array(); $element = $subelement = GETPOST('origin', 'alphanohtml'); @@ -1076,6 +1076,7 @@ if ($action == 'create') { if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { $newclassname = $classname; if ($newclassname == 'Propal') { + $langs->load('propal'); $newclassname = 'CommercialProposal'; } print '
'.$langs->trans($newclassname).''.$objectsrc->getNomUrl(1).'
' . $langs->trans('Default') . '
'.$langs->trans("ProductOrService").''; print img_picto('', 'product', 'class="pictofixedwidth"'); - print $form->select_produits($id, 'id', '', 0, 0, 1, 2, '', ($conf->dol_optimize_smallscreen ? 1 : 0), array(), 0, '1', 0, 'widthcentpercentminusx maxwidth400'); + print $form->select_produits($id, 'id', '', 0, 0, 1, 2, '', 0, array(), 0, $langs->trans("RefOrLabel"), 0, 'widthcentpercentminusx maxwidth400'); print '
'; //print ''; - print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'maxwidth200'); + print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'maxwidth150'); print ''; + print ''; print $warehousestatic->getNomUrl(1); print "'.$origin.''; if ($obj->fk_project != 0) { diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 150984d4064..1f0a72aeb43 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -745,7 +745,7 @@ if ($usevirtualstock == 0) { $stocklabel = $langs->trans('PhysicalStock'); } if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) { - $stocklabelbis = $stocklabel.' (Selected warehouse)'; + $stocklabelbis = $stocklabel.' ('.$langs->trans('SelectedWarehouse').')'; $stocklabel .= ' ('.$langs->trans("AllWarehouses").')'; } $texte = $langs->trans('Replenishment'); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 632aa18b6a4..40217eded88 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -883,7 +883,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object- print ''; } elseif ($id > 0 || !empty($ref)) { - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields // Projet card in view mode @@ -1085,6 +1085,11 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + // Fields from hook + $parameters = array('arrayfields' => $arrayfields); + $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print ' '; // invoice_id and invoice_line_id if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { @@ -2506,6 +2519,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $selected = 1; } print ' '; + // Disable select if task not billable or already invoiced $disabled = (intval($task_time->billable) != 1 || $invoiced); $ctrl = ''; diff --git a/htdocs/public/cron/cron_run_jobs_by_url.php b/htdocs/public/cron/cron_run_jobs_by_url.php index 2ded3bfb832..012c18b08f2 100644 --- a/htdocs/public/cron/cron_run_jobs_by_url.php +++ b/htdocs/public/cron/cron_run_jobs_by_url.php @@ -225,13 +225,13 @@ if (is_array($object->lines) && (count($object->lines) > 0)) { // We re-program the next execution and stores the last execution time for this job $result = $cronjob->reprogram_jobs($userlogin, $now); if ($result < 0) { - echo "Error cronjobid: ".$line->id." cronjob->reprogram_job: ".$cronjob->error."\n"; + echo " - Error cronjobid: ".$line->id." cronjob->reprogram_job: ".$cronjob->error."\n"; echo "Enable module Log if not yet enabled, run again and take a look into dolibarr.log file\n"; dol_syslog("cron_run_jobs.php::reprogram_jobs Error".$cronjob->error, LOG_ERR); - exit; + exit(1); } - echo "Job re-scheduled\n"; + echo " - Job re-scheduled\n"; } else { echo " - not qualified (datenextrunok=".($datenextrunok ?: 0).", datestartok=".($datestartok ?: 0).", dateendok=".($dateendok ?: 0).")\n"; diff --git a/htdocs/public/ticket/ajax/ajax.php b/htdocs/public/ticket/ajax/ajax.php index e28b849eb2d..a2f57cade82 100644 --- a/htdocs/public/ticket/ajax/ajax.php +++ b/htdocs/public/ticket/ajax/ajax.php @@ -57,7 +57,7 @@ include_once '../../../main.inc.php'; // Load $user and permissions * @var DoliDB $db */ - $action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ09'); $id = GETPOSTINT('id'); $email = GETPOST('email', 'custom', 0, FILTER_VALIDATE_EMAIL); diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php index f0b759fa668..e87dcdbd08e 100644 --- a/htdocs/public/users/view.php +++ b/htdocs/public/users/view.php @@ -99,7 +99,6 @@ if ($cancel) { * View */ -$form = new Form($db); $v = new vCard(); $company = $mysoc; @@ -157,9 +156,20 @@ if (getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object)) { } if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object)) { $object->socialnetworks = []; +} else { + // Show list of social networks for company + $listofnetworks = $object->socialnetworks; + + if (!empty($listofnetworks)) { + foreach ($listofnetworks as $key => $networkVal) { + if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS_'.strtoupper($key), 0, $object)) { + unset($object->socialnetworks[$key]); + } + } + } } -// By default, personal address not visible +// By default, personal birthdate and address is not visible if (!getDolUserInt('USER_PUBLIC_SHOW_BIRTH', 0, $object)) { $object->birth = null; } @@ -174,10 +184,32 @@ if (!getDolUserInt('USER_PUBLIC_SHOW_ADDRESS', 0, $object)) { if (getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) { $company = null; } +if (getDolUserInt('SOCIETE_PUBLIC_HIDE_EMAIL', 0, $object)) { + $mysoc->email = ''; +} +if (getDolUserInt('SOCIETE_PUBLIC_HIDE_OFFICE_PHONE', 0, $object)) { + $mysoc->phone = ''; +} +if (getDolUserInt('SOCIETE_PUBLIC_HIDE_OFFICE_FAX', 0, $object)) { + $mysoc->fax = ''; +} +if (getDolUserInt('SOCIETE_PUBLIC_HIDE_URL', 0, $object)) { + $mysoc->url = ''; +} if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS', 0, $object) && is_object($company)) { $company->socialnetworks = []; -} +} else { + // Show list of social networks for company + $listofnetworks = $mysoc->socialnetworks; + if (!empty($listofnetworks)) { + foreach ($listofnetworks as $key => $networkVal) { + if (getDolUserInt('SOCIETE_PUBLIC_HIDE_SOCIALNETWORKS_'.strtoupper($key), 0, $object)) { + unset($mysoc->socialnetworks[$key]); + } + } + } +} // Output vcard if ($mode == 'vcard') { @@ -220,7 +252,7 @@ $arrayofjs = array(); $arrayofcss = array(); $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; -llxHeader($head, $object->getFullName($langs).' - '.$langs->trans("PublicVirtualCard"), '', '', 0, 0, '', '', '', 'onlinepaymentbody'.(GETPOST('mode')=='preview' ? ' scalepreview cursorpointer virtualcardpreview' : ''), $replacemainarea, 1, 1); +llxHeader($head, $object->getFullName($langs).' - '.$langs->trans("PublicVirtualCard"), '', '', 0, 0, $arrayofjs, $arrayofcss, '', 'onlinepaymentbody'.(GETPOST('mode') == 'preview' ? ' scalepreview cursorpointer virtualcardpreview' : ''), $replacemainarea, 1, 1); print '