Merge branch 'develop' into New-status-for-webhook
This commit is contained in:
commit
16e2a120ad
68 changed files with 1473 additions and 680 deletions
|
|
@ -9627,7 +9627,7 @@ parameters:
|
|||
-
|
||||
message: '#^Parameter \#1 \$array of function dol_sort_array contains unresolvable type\.$#'
|
||||
identifier: argument.unresolvableType
|
||||
count: 4
|
||||
count: 3
|
||||
path: ../../../htdocs/core/class/html.form.class.php
|
||||
|
||||
-
|
||||
|
|
@ -9660,12 +9660,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/core/class/html.form.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Form\:\:\$cache_availability has no type specified\.$#'
|
||||
identifier: missingType.property
|
||||
count: 1
|
||||
path: ../../../htdocs/core/class/html.form.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Form\:\:\$cache_conditions_paiements has no type specified\.$#'
|
||||
identifier: missingType.property
|
||||
|
|
@ -9711,7 +9705,7 @@ parameters:
|
|||
-
|
||||
message: '#^Return type of call to function dol_sort_array contains unresolvable type\.$#'
|
||||
identifier: function.unresolvableReturnType
|
||||
count: 4
|
||||
count: 3
|
||||
path: ../../../htdocs/core/class/html.form.class.php
|
||||
|
||||
-
|
||||
|
|
@ -9762,12 +9756,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/core/class/html.formcompany.class.php
|
||||
|
||||
-
|
||||
message: '#^Call to function is_numeric\(\) with float\|int\<min, \-1\>\|int\<1, max\>\|\(non\-falsy\-string&numeric\-string\) will always evaluate to true\.$#'
|
||||
identifier: function.alreadyNarrowedType
|
||||
count: 1
|
||||
path: ../../../htdocs/core/class/html.formcompany.class.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$array of function dol_sort_array contains unresolvable type\.$#'
|
||||
identifier: argument.unresolvableType
|
||||
|
|
@ -13410,12 +13398,6 @@ parameters:
|
|||
count: 2
|
||||
path: ../../../htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Product\:\:\$weight_units \(int\|string\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 1
|
||||
path: ../../../htdocs/core/modules/product/doc/pdf_standard.modules.php
|
||||
|
||||
-
|
||||
message: '#^Method ModeleProductCode\:\:liste_modeles\(\) return type has no value type specified in iterable type array\.$#'
|
||||
identifier: missingType.iterableValue
|
||||
|
|
@ -13440,12 +13422,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/core/modules/project/doc/pdf_baleine.modules.php
|
||||
|
||||
-
|
||||
message: '#^Comparison operation "\>\=" between int\<0, max\> and 0 is always true\.$#'
|
||||
identifier: greaterOrEqual.alwaysTrue
|
||||
count: 1
|
||||
path: ../../../htdocs/core/modules/project/doc/pdf_beluga.modules.php
|
||||
|
||||
-
|
||||
message: '#^If condition is always true\.$#'
|
||||
identifier: if.alwaysTrue
|
||||
|
|
@ -21618,12 +21594,6 @@ parameters:
|
|||
count: 2
|
||||
path: ../../../htdocs/product/admin/product.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$mc might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/product/admin/product.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$obj might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
|
|
@ -21684,12 +21654,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/product/card.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$prod might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/product/card.php
|
||||
|
||||
-
|
||||
message: '#^If condition is always true\.$#'
|
||||
identifier: if.alwaysTrue
|
||||
|
|
@ -22218,18 +22182,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/product/document.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$upload_dir might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 2
|
||||
path: ../../../htdocs/product/document.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$upload_dirold might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 2
|
||||
path: ../../../htdocs/product/document.php
|
||||
|
||||
-
|
||||
message: '#^Negated boolean expression is always true\.$#'
|
||||
identifier: booleanNot.alwaysTrue
|
||||
|
|
@ -22308,12 +22260,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/product/inventory/card.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$text might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/product/inventory/card.php
|
||||
|
||||
-
|
||||
message: '#^Call to function method_exists\(\) with \$this\(Inventory\) and ''getLibStatut'' will always evaluate to true\.$#'
|
||||
identifier: function.alreadyNarrowedType
|
||||
|
|
@ -22338,18 +22284,6 @@ parameters:
|
|||
count: 2
|
||||
path: ../../../htdocs/product/list.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$perm might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 2
|
||||
path: ../../../htdocs/product/list.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$workstation_static might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 4
|
||||
path: ../../../htdocs/product/list.php
|
||||
|
||||
-
|
||||
message: '#^Loose comparison using \=\= between ''add_customer_price'' and ''add_customer_price'' will always evaluate to true\.$#'
|
||||
identifier: equal.alwaysTrue
|
||||
|
|
@ -22374,12 +22308,6 @@ parameters:
|
|||
count: 2
|
||||
path: ../../../htdocs/product/price.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#4 \$txtva of function calcul_price_total expects float, string given\.$#'
|
||||
identifier: argument.type
|
||||
count: 2
|
||||
path: ../../../htdocs/product/price.php
|
||||
|
||||
-
|
||||
message: '#^Result of && is always false\.$#'
|
||||
identifier: booleanAnd.alwaysFalse
|
||||
|
|
@ -22410,24 +22338,12 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/product/price.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$ii might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 2
|
||||
path: ../../../htdocs/product/price.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$lineid might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/product/price.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$maxpricesupplier might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 2
|
||||
path: ../../../htdocs/product/price.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$obj might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
|
|
@ -22446,12 +22362,6 @@ parameters:
|
|||
count: 2
|
||||
path: ../../../htdocs/product/price.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$soc might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/product/price.php
|
||||
|
||||
-
|
||||
message: '#^Left side of && is always true\.$#'
|
||||
identifier: booleanAnd.leftAlwaysTrue
|
||||
|
|
@ -22662,24 +22572,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/product/stats/supplier_proposal.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$formproject might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/product/stock/card.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$lastmovementdate might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/product/stock/card.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$pricemin might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/product/stock/card.php
|
||||
|
||||
-
|
||||
message: '#^Method StockMovements\:\:index\(\) return type has no value type specified in iterable type array\.$#'
|
||||
identifier: missingType.iterableValue
|
||||
|
|
@ -22866,12 +22758,6 @@ parameters:
|
|||
count: 2
|
||||
path: ../../../htdocs/product/stock/info.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$formproject might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/product/stock/info.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$socid might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
|
|
@ -22986,12 +22872,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/product/stock/movement_card.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$batch might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 2
|
||||
path: ../../../htdocs/product/stock/movement_card.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$comref might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
|
|
@ -23016,18 +22896,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/product/stock/movement_card.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$eatby might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 2
|
||||
path: ../../../htdocs/product/stock/movement_card.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$lastmovementdate might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/product/stock/movement_card.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$massaction might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
|
|
@ -23040,36 +22908,12 @@ parameters:
|
|||
count: 3
|
||||
path: ../../../htdocs/product/stock/movement_card.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$result1 might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/product/stock/movement_card.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$result2 might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/product/stock/movement_card.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$sall might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/product/stock/movement_card.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$sellby might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 2
|
||||
path: ../../../htdocs/product/stock/movement_card.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$srcwarehouseid might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/product/stock/movement_card.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$toselect might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
|
|
@ -23184,42 +23028,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/product/stock/product.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$batch might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 2
|
||||
path: ../../../htdocs/product/stock/product.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$eatby might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 2
|
||||
path: ../../../htdocs/product/stock/product.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$lastmovementdate might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/product/stock/product.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$result1 might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/product/stock/product.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$result2 might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/product/stock/product.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$sellby might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 2
|
||||
path: ../../../htdocs/product/stock/product.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$sortfield might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
|
|
@ -23232,18 +23040,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/product/stock/product.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$srcwarehouseid might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/product/stock/product.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$variants might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 3
|
||||
path: ../../../htdocs/product/stock/product.php
|
||||
|
||||
-
|
||||
message: '#^If condition is always true\.$#'
|
||||
identifier: if.alwaysTrue
|
||||
|
|
@ -23268,36 +23064,18 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/product/stock/replenish.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$lastWarehouseID might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/product/stock/replenish.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#'
|
||||
identifier: empty.variable
|
||||
count: 1
|
||||
path: ../../../htdocs/product/stock/replenishorders.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$nbofmovement might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 2
|
||||
path: ../../../htdocs/product/stock/stockatdate.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$resql might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/product/stock/stockatdate.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$virtualstock might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 4
|
||||
path: ../../../htdocs/product/stock/stockatdate.php
|
||||
|
||||
-
|
||||
message: '#^Call to function property_exists\(\) with \$this\(StockTransfer\) and ''socid'' will always evaluate to true\.$#'
|
||||
identifier: function.alreadyNarrowedType
|
||||
|
|
@ -23466,42 +23244,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/projet/activity/perday.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#11 \$isavailable of function projectLinesPerDay expects array\<int, array\{morning\: int\<0, 1\>, afternoon\: int\<0, 1\>\}\>, non\-empty\-array\<int\|string, array\{morning\: false, afternoon\: false, morning_reason\: ''public_holiday'', afternoon_reason\: ''public_holiday''\}\|array\{morning_reason\?\: string, afternoon_reason\?\: string\}\> given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: ../../../htdocs/projet/activity/perday.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#4 \$month of function dol_mktime expects int, array\<mixed\>\|string given\.$#'
|
||||
identifier: argument.type
|
||||
count: 4
|
||||
path: ../../../htdocs/projet/activity/perday.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#5 \$day of function dol_mktime expects int, array\<mixed\>\|string given\.$#'
|
||||
identifier: argument.type
|
||||
count: 4
|
||||
path: ../../../htdocs/projet/activity/perday.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#6 \$projectsrole of function projectLinesPerDay expects string, array\<int, string\>\|int given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: ../../../htdocs/projet/activity/perday.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#6 \$year of function dol_mktime expects int, array\<mixed\>\|string given\.$#'
|
||||
identifier: argument.type
|
||||
count: 4
|
||||
path: ../../../htdocs/projet/activity/perday.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#7 \$tasksrole of function projectLinesPerDay expects string, array\<int, string\>\|int given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: ../../../htdocs/projet/activity/perday.php
|
||||
|
||||
-
|
||||
message: '#^Ternary operator condition is always false\.$#'
|
||||
identifier: ternary.alwaysFalse
|
||||
|
|
@ -23538,18 +23280,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/projet/activity/permonth.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#7 \$projectsrole of function projectLinesPerMonth expects string, array\<int, string\>\|int given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: ../../../htdocs/projet/activity/permonth.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#8 \$tasksrole of function projectLinesPerMonth expects string, array\<int, string\>\|int given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: ../../../htdocs/projet/activity/permonth.php
|
||||
|
||||
-
|
||||
message: '#^Ternary operator condition is always false\.$#'
|
||||
identifier: ternary.alwaysFalse
|
||||
|
|
@ -23586,24 +23316,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/projet/activity/perweek.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#11 \$isavailable of function projectLinesPerWeek expects array\<int, array\{morning\: int\<0, 1\>, afternoon\: int\<0, 1\>\}\>, non\-empty\-array\<int, array\{morning\: false, afternoon\: false, morning_reason\: ''public_holiday'', afternoon_reason\: ''public_holiday''\}\|array\{morning_reason\?\: string, afternoon_reason\?\: string\}\> given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: ../../../htdocs/projet/activity/perweek.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#7 \$projectsrole of function projectLinesPerWeek expects string, array\<int, string\>\|int given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: ../../../htdocs/projet/activity/perweek.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#8 \$tasksrole of function projectLinesPerWeek expects string, array\<int, string\>\|int given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: ../../../htdocs/projet/activity/perweek.php
|
||||
|
||||
-
|
||||
message: '#^Ternary operator condition is always false\.$#'
|
||||
identifier: ternary.alwaysFalse
|
||||
|
|
@ -23934,12 +23646,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/projet/contact.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$formconfirmtoaddtasks might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/projet/contact.php
|
||||
|
||||
-
|
||||
message: '#^Call to function method_exists\(\) with Project and ''fetchComments'' will always evaluate to true\.$#'
|
||||
identifier: function.alreadyNarrowedType
|
||||
|
|
@ -24012,12 +23718,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/projet/ganttview.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$userWrite might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/projet/ganttview.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$colorseries might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
|
|
@ -24744,18 +24444,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/public/members/public_card.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$db might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 5
|
||||
path: ../../../htdocs/public/members/public_card.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$langs might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 17
|
||||
path: ../../../htdocs/public/members/public_card.php
|
||||
|
||||
-
|
||||
message: '#^Call to function is_numeric\(\) with int will always evaluate to true\.$#'
|
||||
identifier: function.alreadyNarrowedType
|
||||
|
|
|
|||
|
|
@ -9,15 +9,15 @@
|
|||
*/
|
||||
return [
|
||||
// # Issue statistics:
|
||||
// PhanTypeMismatchArgument : 1900+ occurrences
|
||||
// PhanTypeMismatchArgument : 1840+ occurrences
|
||||
// PhanUndeclaredProperty : 520+ occurrences
|
||||
// PhanTypeMismatchArgumentNullable : 380+ occurrences
|
||||
// PhanPluginUnknownArrayMethodReturnType : 170+ occurrences
|
||||
// PhanUndeclaredGlobalVariable : 170+ occurrences
|
||||
// PhanTypeMismatchProperty : 130+ occurrences
|
||||
// PhanPluginUnknownArrayMethodParamType : 110+ occurrences
|
||||
// PhanPossiblyUndeclaredGlobalVariable : 100+ occurrences
|
||||
// PhanTypeMismatchArgumentProbablyReal : 100+ occurrences
|
||||
// PhanPossiblyUndeclaredGlobalVariable : 95+ occurrences
|
||||
// PhanTypeMismatchArgumentProbablyReal : 90+ occurrences
|
||||
// PhanRedefineFunction : 40+ occurrences
|
||||
// PhanTypeExpectedObjectPropAccess : 40+ occurrences
|
||||
// PhanTypeInvalidDimOffset : 25+ occurrences
|
||||
|
|
@ -32,12 +32,12 @@ return [
|
|||
// PhanPluginUnknownObjectMethodCall : 6 occurrences
|
||||
// PhanTypeArraySuspiciousNull : 6 occurrences
|
||||
// PhanParamTooMany : 5 occurrences
|
||||
// PhanEmptyForeach : 4 occurrences
|
||||
// PhanPluginDuplicateArrayKey : 4 occurrences
|
||||
// PhanPluginEmptyStatementIf : 4 occurrences
|
||||
// PhanEmptyFQSENInClasslike : 3 occurrences
|
||||
// PhanInvalidFQSENInClasslike : 3 occurrences
|
||||
// PhanPluginBothLiteralsBinaryOp : 3 occurrences
|
||||
// PhanEmptyForeach : 2 occurrences
|
||||
// PhanTypeMismatchDimAssignment : 2 occurrences
|
||||
// PhanTypeMismatchDimFetchNullable : 2 occurrences
|
||||
// PhanTypeSuspiciousStringExpression : 2 occurrences
|
||||
|
|
@ -613,15 +613,7 @@ return [
|
|||
'htdocs/projet/admin/project.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/projet/card.php' => ['PhanTypeMismatchArgumentNullable', 'PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/projet/class/api_tasks.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgument'],
|
||||
'htdocs/projet/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgument'],
|
||||
'htdocs/projet/tasks.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/projet/tasks/comment.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/projet/tasks/contact.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/projet/tasks/document.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/projet/tasks/list.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/projet/tasks/note.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/projet/tasks/task.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/projet/tasks/time.php' => ['PhanEmptyForeach', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
|
||||
'htdocs/projet/tasks/time.php' => ['PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
|
||||
'htdocs/projet/tasks/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/public/agenda/agendaexport.php' => ['PhanRedefineFunction'],
|
||||
'htdocs/public/bookcal/index.php' => ['PhanRedefineFunction'],
|
||||
|
|
@ -645,7 +637,7 @@ return [
|
|||
'htdocs/public/project/new.php' => ['PhanRedefineFunction'],
|
||||
'htdocs/public/project/suggestbooth.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgument', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/public/project/suggestconference.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgument', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/public/project/viewandvote.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgument', 'PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/public/project/viewandvote.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/public/recruitment/view.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/public/stripe/ipn.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/public/test/test_arrays.php' => ['PhanPluginUndeclaredVariableIsset'],
|
||||
|
|
@ -802,7 +794,7 @@ return [
|
|||
'htdocs/webservices/server_order.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgument', 'PhanTypeSuspiciousStringExpression', 'PhanUndeclaredProperty'],
|
||||
'htdocs/webservices/server_payment.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
|
||||
'htdocs/webservices/server_productorservice.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
|
||||
'htdocs/webservices/server_project.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
|
||||
'htdocs/webservices/server_project.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/webservices/server_supplier_invoice.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/webservices/server_thirdparty.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
|
||||
'htdocs/webservices/server_user.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
|
||||
|
|
|
|||
|
|
@ -134,8 +134,6 @@ AuthorityDidntReconizeFingerprintConformity
|
|||
AuthorityReconizeFingerprintConformity
|
||||
Auto
|
||||
AutoGenerateDoc
|
||||
AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation
|
||||
Automatic
|
||||
AvailabilityType
|
||||
BAN
|
||||
BI
|
||||
|
|
@ -176,7 +174,6 @@ CalcModeLT
|
|||
CalculatedFromProductsToConsume
|
||||
CancelReception
|
||||
Candidatures
|
||||
CantBeNullOrPositive
|
||||
CantConvertToReducAnInvoiceOfThisType
|
||||
CardFichinter
|
||||
CardProduct
|
||||
|
|
|
|||
209
htdocs/admin/propal_pdf.php
Normal file
209
htdocs/admin/propal_pdf.php
Normal file
|
|
@ -0,0 +1,209 @@
|
|||
<?php
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/propal.php
|
||||
* \ingroup propale
|
||||
* \brief Setup page for commercial proposal module
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
* @var HookManager $hookmanager
|
||||
* @var Societe $mysoc
|
||||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*/
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin", "other", "errors", "propal"));
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
|
||||
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type = 'propal';
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
$error = 0;
|
||||
if ($action == "update") {
|
||||
if (GETPOSTISSET('MAIN_PDF_ADD_TERMSOFSALE_PROPAL')) {
|
||||
dolibarr_set_const($db, "MAIN_PDF_ADD_TERMSOFSALE_PROPAL", GETPOST("MAIN_PDF_ADD_TERMSOFSALE_PROPAL", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (GETPOSTISSET('MAIN_GENERATE_PROPOSALS_WITH_PICTURE')) {
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_PROPOSALS_WITH_PICTURE", GETPOST("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
// Terms of sale
|
||||
if ($_FILES['termsofsale']["name"]) {
|
||||
if (!preg_match('/(\.pdf)$/i', $_FILES['termsofsale']["name"])) { // Document can be used on a lot of different places. Only pdf can be supported.
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorBadFormat"), null, 'errors');
|
||||
} else {
|
||||
$dirforterms = $conf->propal->dir_output.'/';
|
||||
$original_file = $_FILES['termsofsale']["name"];
|
||||
$result = dol_move_uploaded_file($_FILES['termsofsale']["tmp_name"], $dirforterms.$original_file, 1, 0, $_FILES['termsofsale']['error']);
|
||||
if ($result) {
|
||||
dolibarr_set_const($db, 'MAIN_INFO_PROPAL_TERMSOFSALE', $original_file, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Terms of sale
|
||||
if ($action == 'removetermsofsale') {
|
||||
$filename = getDolGlobalString('MAIN_INFO_PROPAL_TERMSOFSALE');
|
||||
$file = $conf->propal->dir_output.'/'.$filename;
|
||||
|
||||
if ($filename != '') {
|
||||
dol_delete_file($file);
|
||||
}
|
||||
dolibarr_del_const($db, 'MAIN_INFO_PROPAL_TERMSOFSALE', $conf->entity);
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
llxHeader('', $langs->trans("PropalSetup"), '', '', 0, 0, '', '', '', 'mod-admin page-propal');
|
||||
|
||||
//if ($mesg) print $mesg;
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("PropalSetup"), $linkback, 'title_setup');
|
||||
|
||||
$head = propal_admin_prepare_head();
|
||||
|
||||
print dol_get_fiche_head($head, 'pdf', $langs->trans("Proposals"), -1, 'propal');
|
||||
|
||||
print '<form enctype="multipart/form-data" method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px"></td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("MAIN_PDF_ADD_TERMSOFSALE_PROPAL"), $langs->trans("PdfAddTermOfSaleHelp"));
|
||||
print '</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_PDF_ADD_TERMSOFSALE_PROPAL');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("MAIN_PDF_ADD_TERMSOFSALE_PROPAL", $arrval, $conf->global->MAIN_PDF_ADD_TERMSOFSALE_PROPAL);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), $langs->trans("RandomlySelectedIfSeveral"));
|
||||
print '</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_GENERATE_PROPOSALS_WITH_PICTURE');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("MAIN_GENERATE_PROPOSALS_WITH_PICTURE", $arrval, $conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print load_fiche_titre($langs->trans("Files"), '', 'file');
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px"></td></tr>';
|
||||
|
||||
// Terms of sale
|
||||
$tooltiptermsofsale = $langs->trans('AvailableFormats').' : pdf';
|
||||
$maxfilesizearray = getMaxFileSizeArray();
|
||||
$tooltiptermsofsale .= ($maxfilesizearray['maxmin'] > 0) ? '<br>'.$langs->trans('MaxSize').' : '.$maxfilesizearray['maxmin'].' '.$langs->trans('Kb') : '';
|
||||
$documenturl = DOL_URL_ROOT.'/document.php';
|
||||
if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) {
|
||||
$documenturl = $conf->global->DOL_URL_ROOT_DOCUMENT_PHP;
|
||||
}
|
||||
$modulepart = 'propal';
|
||||
|
||||
print '<tr class="oddeven"><td><label for="logo">'.$form->textwithpicto($langs->trans("TERMSOFSALE"), $tooltiptermsofsale).'</label></td><td>';
|
||||
print '<div class="centpercent nobordernopadding valignmiddle "><div class="inline-block marginrightonly">';
|
||||
print '<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="termsofsale" id="termsofsale" accept="application/pdf">';
|
||||
|
||||
if (getDolGlobalString("MAIN_INFO_PROPAL_TERMSOFSALE")) {
|
||||
$termofsale = getDolGlobalString("MAIN_INFO_PROPAL_TERMSOFSALE");
|
||||
if (file_exists($conf->propal->dir_output.'/'.$termofsale)) {
|
||||
$file = dol_dir_list($conf->propal->dir_output, 'files', 0, $termofsale);
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a href="'.$documenturl.'?modulepart='.$modulepart.'&file='.urlencode($termofsale).'">'.$termofsale.'</a>'.$formfile->showPreview($file[0], $modulepart, $termofsale, 0, '');
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removetermsofsale&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
||||
}
|
||||
}
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<center><input type="submit" class="button button-edit reposition" value="'.$langs->trans("Modify").'"></center>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
print '<br><br>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
|
@ -59,6 +59,11 @@ if ($mode == 'searchkey') {
|
|||
$transvalue = GETPOST('transvalue', 'restricthtml');
|
||||
}
|
||||
|
||||
$entity = $conf->entity;
|
||||
if (isModEnabled('multicompany') && !$user->entity) {
|
||||
$entity = GETPOST('entity', 'int');
|
||||
}
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
|
|
@ -128,10 +133,19 @@ if ($action == 'update') {
|
|||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NewTranslationStringToShow")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if ($entity == '') {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Entity")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."overwrite_trans set transkey = '".$db->escape($transkey)."', transvalue = '".$db->escape($transvalue)."' WHERE rowid = ".(GETPOSTINT('rowid'));
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "overwrite_trans set transkey = '" . $db->escape(
|
||||
$transkey
|
||||
) . "', transvalue = '" . $db->escape($transvalue) . "', entity = '" . $db->escape(
|
||||
$entity
|
||||
) . "' WHERE rowid = " . ((int) GETPOST('rowid', 'int'));
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$db->commit();
|
||||
|
|
@ -368,7 +382,9 @@ if ($mode == 'overwrite') {
|
|||
print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("TranslationKey", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("NewTranslationStringToShow", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder);
|
||||
//if (isModEnabled('multicompany') && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
if (isModEnabled('multicompany') && !$user->entity) {
|
||||
print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'Entity', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
print '<td align="center"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
|
@ -376,21 +392,36 @@ if ($mode == 'overwrite') {
|
|||
// Line to add new record
|
||||
print "\n";
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Lang
|
||||
print '<td>';
|
||||
print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, array(), 1, 0, $disablededit ? 1 : 0, 'maxwidth250', 1);
|
||||
print '</td>'."\n";
|
||||
|
||||
// Trans key
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidthonsmartphone"'.$disablededit.' name="transkey" id="transkey" value="'.(!empty($transkey) ? $transkey : "").'">';
|
||||
print '</td><td>';
|
||||
print '</td>';
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
print '<input type="text" class="quatrevingtpercent"'.$disablededit.' name="transvalue" id="transvalue" value="'.(!empty($transvalue) ? $transvalue : "").'">';
|
||||
print '</td>';
|
||||
|
||||
// Multi company
|
||||
if (isModEnabled('multicompany') && !$user->entity) {
|
||||
print '<td>';
|
||||
print '<input type="text" class="quatrevingtpercent"' . $disablededit . ' name="entity" id="entity" value="' . (!empty($entity) ? $entity : "") . '">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td class="center">';
|
||||
print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.$langs->trans("Add").'" name="add" title="'.dol_escape_htmltag($langs->trans("YouMustEnableTranslationOverwriteBefore")).'">';
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Show constants
|
||||
$sql = "SELECT rowid, entity, lang, transkey, transvalue";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."overwrite_trans";
|
||||
|
|
@ -411,7 +442,10 @@ if ($mode == 'overwrite') {
|
|||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Lang
|
||||
print '<td>'.dol_escape_htmltag($obj->lang).'</td>'."\n";
|
||||
|
||||
// Trans key
|
||||
print '<td>';
|
||||
if ($action == 'edit' && $obj->rowid == GETPOSTINT('rowid')) {
|
||||
print '<input type="text" class="quatrevingtpercent" name="transkey" value="'.dol_escape_htmltag($obj->transkey).'">';
|
||||
|
|
@ -441,6 +475,19 @@ if ($mode == 'overwrite') {
|
|||
}
|
||||
print '</td>';
|
||||
|
||||
// Entity limit to superadmin
|
||||
if (isModEnabled('multicompany') && empty($user->entity)) {
|
||||
print '<td>';
|
||||
if ($action == 'edit' && $obj->rowid == GETPOSTINT('rowid')) {
|
||||
print '<input type="text" class="flat" size="1" name="entity" value="' . ((int) $obj->entity) . '">';
|
||||
} else {
|
||||
print dol_escape_htmltag($obj->entity);
|
||||
}
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<input type="hidden" name="const[' . $i . '][entity]" value="' . ((int) $obj->entity) . '">';
|
||||
}
|
||||
|
||||
print '<td class="center">';
|
||||
if ($action == 'edit' && $obj->rowid == GETPOSTINT('rowid')) {
|
||||
print '<input type="hidden" class="button" name="rowid" value="'.$obj->rowid.'">';
|
||||
|
|
|
|||
|
|
@ -124,6 +124,8 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $permissiontoadd)
|
|||
if ($forcelangprod == $current_lang) {
|
||||
$object->label = $libelle;
|
||||
$object->description = dol_htmlcleanlastbr($desc);
|
||||
|
||||
$object->update($user);
|
||||
} else {
|
||||
$object->multilangs[$forcelangprod]["label"] = $libelle;
|
||||
$object->multilangs[$forcelangprod]["description"] = dol_htmlcleanlastbr($desc);
|
||||
|
|
|
|||
|
|
@ -2387,7 +2387,7 @@ if ($action == 'create') {
|
|||
$formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date);
|
||||
}
|
||||
// Incomplete payment. We ask if reason = discount or other
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 250, 600);
|
||||
}
|
||||
|
||||
if ($action == 'closeas') {
|
||||
|
|
|
|||
|
|
@ -827,17 +827,22 @@ class Propal extends CommonObject
|
|||
|
||||
$result = $this->line->insert();
|
||||
if ($result > 0) {
|
||||
// Reorder if child line
|
||||
if (!empty($fk_parent_line)) {
|
||||
$this->line_order(true, 'DESC');
|
||||
} elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) { // Update all rank of all other lines
|
||||
$linecount = count($this->lines);
|
||||
for ($ii = $ranktouse; $ii <= $linecount; $ii++) {
|
||||
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||
if (!isset($this->context['createfromclone'])) {
|
||||
if (!empty($fk_parent_line)) {
|
||||
// Always reorder if child line
|
||||
$this->line_order(true, 'DESC');
|
||||
} elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) {
|
||||
// Update all rank of all other lines starting from the same $ranktouse
|
||||
$linecount = count($this->lines);
|
||||
for ($ii = $ranktouse; $ii <= $linecount; $ii++) {
|
||||
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||
}
|
||||
}
|
||||
|
||||
$this->lines[] = $this->line;
|
||||
}
|
||||
|
||||
// Mise a jour information denormalisees au niveau de la propale meme
|
||||
// Update denormalized fields at the order level
|
||||
if (empty($noupdateafterinsertline)) {
|
||||
$result = $this->update_price(1, 'auto', 0, $mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) 2023-2024 Benjamin Falière <benjamin.faliere@altairis.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2025 Lenin Rivas <lenin.rivas777@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -103,6 +104,9 @@ $origin = GETPOST('origin', 'alpha');
|
|||
$originid = (GETPOSTINT('originid') ? GETPOSTINT('originid') : GETPOSTINT('origin_id')); // For backward compatibility
|
||||
$rank = (GETPOSTINT('rank') > 0) ? GETPOSTINT('rank') : -1;
|
||||
|
||||
// Type Contact default
|
||||
$type_contact_code = (getDolGlobalString('ORDER_TYPE_CONTACT_DEFAULT') ? getDolGlobalString('ORDER_TYPE_CONTACT_DEFAULT') : 'CUSTOMER');
|
||||
|
||||
// PDF
|
||||
$hidedetails = (GETPOSTINT('hidedetails') ? GETPOSTINT('hidedetails') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS') ? 1 : 0));
|
||||
$hidedesc = (GETPOSTINT('hidedesc') ? GETPOSTINT('hidedesc') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DESC') ? 1 : 0));
|
||||
|
|
@ -218,10 +222,10 @@ if (empty($reshook)) {
|
|||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('IdThirdParty')), null, 'errors');
|
||||
} else {
|
||||
if ($object->id > 0) {
|
||||
// Because createFromClone modifies the object, we must clone it so that we can restore it later
|
||||
$orig = clone $object;
|
||||
// We clone object to avoid to denaturate loaded object when setting some properties for clone or if createFromClone modifies the object.
|
||||
$objectutil = dol_clone($object, 1);
|
||||
|
||||
$result = $object->createFromClone($user, $socid);
|
||||
$result = $objectutil->createFromClone($user, $socid);
|
||||
if ($result > 0) {
|
||||
$warningMsgLineList = array();
|
||||
// check all product lines are to sell otherwise add a warning message for each product line is not to sell
|
||||
|
|
@ -243,7 +247,6 @@ if (empty($reshook)) {
|
|||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$object = $orig;
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
|
@ -549,7 +552,8 @@ if (empty($reshook)) {
|
|||
// Insert default contacts if defined
|
||||
if ($object_id > 0) {
|
||||
if (GETPOSTINT('contactid')) {
|
||||
$result = $object->add_contact(GETPOSTINT('contactid'), 'CUSTOMER', 'external');
|
||||
// $result = $object->add_contact(GETPOSTINT('contactid'), 'CUSTOMER', 'external');
|
||||
$result = $object->add_contact(GETPOSTINT('contactid'), $type_contact_code, 'external');
|
||||
if ($result < 0) {
|
||||
setEventMessages($langs->trans("ErrorFailedToAddContact"), null, 'errors');
|
||||
$error++;
|
||||
|
|
@ -1995,7 +1999,10 @@ if ($action == 'create' && $usercancreate) {
|
|||
// Contact of order
|
||||
if ($socid > 0) {
|
||||
// Contacts (ask contact only if thirdparty already defined).
|
||||
print "<tr><td>".$langs->trans("DefaultContact").'</td><td>';
|
||||
// print "<tr><td>".$langs->trans("DefaultContact").'</td><td>';
|
||||
print "<tr><td>";
|
||||
print $form->textwithpicto($langs->trans("DefaultContact"), $langs->trans("TypeContact_commande_external_".$type_contact_code));
|
||||
print '</td><td>';
|
||||
print img_picto('', 'contact', 'class="pictofixedwidth"');
|
||||
//print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, empty($srccontactslist) ? "" : $srccontactslist, '', 1, 'maxwidth300 widthcentpercentminusx');
|
||||
print $form->select_contact($soc->id, $contactid, 'contactid', 1, empty($srccontactslist) ? "" : $srccontactslist, '', 1, 'maxwidth300 widthcentpercentminusx', true);
|
||||
|
|
|
|||
|
|
@ -113,9 +113,16 @@ class Commande extends CommonOrder
|
|||
/**
|
||||
* Status of the order
|
||||
* @var int
|
||||
* @deprecated Use status
|
||||
*/
|
||||
public $statut;
|
||||
|
||||
/**
|
||||
* Status of the order
|
||||
* @var int
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* @var int Status Billed or not
|
||||
*/
|
||||
|
|
@ -793,12 +800,10 @@ class Commande extends CommonOrder
|
|||
*
|
||||
* @param User $user Object user that close
|
||||
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
* @return int Return integer <0 if KO, 0=Nothing done, >0 if OK
|
||||
*/
|
||||
public function cloture($user, $notrigger = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$error = 0;
|
||||
|
||||
$usercanclose = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('commande', 'creer'))
|
||||
|
|
@ -1098,6 +1103,7 @@ class Commande extends CommonOrder
|
|||
$line->ref_ext,
|
||||
1
|
||||
);
|
||||
|
||||
if ($result < 0) {
|
||||
if ($result != self::STOCK_NOT_ENOUGH_FOR_ORDER) {
|
||||
$this->error = $this->db->lasterror();
|
||||
|
|
@ -1541,7 +1547,7 @@ class Commande extends CommonOrder
|
|||
|
||||
$logtext = "::addline commandeid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent";
|
||||
$logtext .= ", info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start";
|
||||
$logtext .= ", date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise, ref_ext=$ref_ext";
|
||||
$logtext .= ", date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise, ref_ext=$ref_ext rang=$rang";
|
||||
dol_syslog(get_class($this).$logtext, LOG_DEBUG);
|
||||
|
||||
if ($this->statut == self::STATUS_DRAFT) {
|
||||
|
|
@ -1681,6 +1687,7 @@ class Commande extends CommonOrder
|
|||
|
||||
// Rang to use
|
||||
$ranktouse = $rang;
|
||||
|
||||
if ($ranktouse == -1) {
|
||||
$rangmax = $this->line_max($fk_parent_line);
|
||||
$ranktouse = $rangmax + 1;
|
||||
|
|
@ -1753,24 +1760,28 @@ class Commande extends CommonOrder
|
|||
|
||||
$result = $this->line->insert($user);
|
||||
if ($result > 0) {
|
||||
// Reorder if child line
|
||||
if (!empty($fk_parent_line)) {
|
||||
$this->line_order(true, 'DESC');
|
||||
} elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) { // Update all rank of all other lines
|
||||
$linecount = count($this->lines);
|
||||
for ($ii = $ranktouse; $ii <= $linecount; $ii++) {
|
||||
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Mise a jour information denormalisees au niveau de la commande meme
|
||||
// Update denormalized fields at the order level
|
||||
if (empty($noupdateafterinsertline)) {
|
||||
$result = $this->update_price(1, 'auto', 0, $mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
||||
}
|
||||
|
||||
if ($result > 0) {
|
||||
if (!isset($this->context['createfromclone'])) {
|
||||
if (!empty($fk_parent_line)) {
|
||||
// Always reorder if child line
|
||||
$this->line_order(true, 'DESC');
|
||||
} elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) {
|
||||
// Update all rank of all other lines starting from the same $ranktouse
|
||||
$linecount = count($this->lines);
|
||||
for ($ii = $ranktouse; $ii <= $linecount; $ii++) {
|
||||
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||
}
|
||||
}
|
||||
|
||||
$this->lines[] = $this->line;
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
$this->lines[] = $this->line;
|
||||
return $this->line->id;
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
|
|
@ -1899,7 +1910,7 @@ class Commande extends CommonOrder
|
|||
return -1;
|
||||
}
|
||||
|
||||
$sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_user_modif, c.fk_statut';
|
||||
$sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_user_modif, c.fk_statut as status';
|
||||
$sql .= ', c.amount_ht, c.total_ht, c.total_ttc, c.total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.deposit_percent, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason';
|
||||
$sql .= ', c.fk_account';
|
||||
$sql .= ', c.date_commande, c.date_valid, c.tms';
|
||||
|
|
@ -1955,8 +1966,8 @@ class Commande extends CommonOrder
|
|||
$this->fk_project = $obj->fk_project;
|
||||
$this->project = null; // Clear if another value was already set by fetch_projet
|
||||
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->status = $obj->fk_statut;
|
||||
$this->statut = $obj->status;
|
||||
$this->status = $obj->status;
|
||||
|
||||
$this->user_author_id = $obj->fk_user_author;
|
||||
$this->user_creation_id = $obj->fk_user_author;
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ class OrderLine extends CommonOrderLine
|
|||
}
|
||||
|
||||
/**
|
||||
* Insert line into database
|
||||
* Insert line into database. This also set $this->id.
|
||||
*
|
||||
* @param User $user User that modify
|
||||
* @param int $notrigger 1 = disable triggers
|
||||
|
|
@ -487,7 +487,7 @@ class OrderLine extends CommonOrderLine
|
|||
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
foreach ($this->errors as $errmsg) {
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ $search_deliveryyear = '';
|
|||
|
||||
$search_import_key = trim(GETPOST("search_import_key", "alpha"));
|
||||
|
||||
$diroutputmassaction = $conf->commande->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id;
|
||||
$diroutputmassaction = $conf->order->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id;
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
|
||||
|
|
@ -376,7 +376,7 @@ if (empty($reshook)) {
|
|||
$permissiontocancel = $user->hasRight("commande", "creer");
|
||||
$permissiontosendbymail = $user->hasRight("commande", "creer");
|
||||
}
|
||||
$uploaddir = $conf->commande->multidir_output[$conf->entity];
|
||||
$uploaddir = $conf->order->multidir_output[$conf->entity];
|
||||
$triggersendname = 'ORDER_SENTBYMAIL';
|
||||
$year = "";
|
||||
$month = "";
|
||||
|
|
@ -766,14 +766,16 @@ if (empty($reshook)) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'validate' && $permissiontoadd && $objectclass !== null) {
|
||||
if (GETPOST('confirm') == 'yes') {
|
||||
/** @var Commande $objecttmp */
|
||||
$objecttmp = new $objectclass($db);
|
||||
$db->begin();
|
||||
$error = 0;
|
||||
foreach ($toselect as $checked) {
|
||||
if ($objecttmp->fetch($checked)) {
|
||||
if ($objecttmp->statut == 0) {
|
||||
if ($objecttmp->status == $objecttmp::STATUS_DRAFT) {
|
||||
if (!empty($objecttmp->fk_warehouse)) {
|
||||
$idwarehouse = $objecttmp->fk_warehouse;
|
||||
} else {
|
||||
|
|
@ -804,21 +806,23 @@ if ($action == 'validate' && $permissiontoadd && $objectclass !== null) {
|
|||
}
|
||||
if ($action == 'shipped' && $permissiontoadd && $objectclass !== null) {
|
||||
if (GETPOST('confirm') == 'yes') {
|
||||
/** @var Commande $objecttmp */
|
||||
$objecttmp = new $objectclass($db);
|
||||
$db->begin();
|
||||
$error = 0;
|
||||
foreach ($toselect as $checked) {
|
||||
if ($objecttmp->fetch($checked)) {
|
||||
if ($objecttmp->statut == 1 || $objecttmp->statut == 2) {
|
||||
if ($objecttmp->cloture($user)) {
|
||||
if ($objecttmp->status == $objecttmp::STATUS_VALIDATED || $objecttmp->status == $objecttmp::STATUS_SHIPMENTONPROCESS || $objecttmp->status == $objecttmp::STATUS_CLOSED) {
|
||||
$result = $objecttmp->cloture($user);
|
||||
if ($result > 0) {
|
||||
setEventMessages($langs->trans('StatusOrderDelivered', $objecttmp->ref), null, 'mesgs');
|
||||
} else {
|
||||
} elseif ($result < 0) {
|
||||
setEventMessages($langs->trans('ErrorOrderStatusCantBeSetToDelivered'), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans('ErrorIsNotADraft', $objecttmp->ref), null, 'errors');
|
||||
setEventMessages($langs->trans('ErrorObjectHasWrongStatus', $objecttmp->ref), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -997,7 +1001,7 @@ if ($search_status != '') {
|
|||
}
|
||||
}
|
||||
if ($search_option == 'late') {
|
||||
$sql .= " AND c.date_commande < '".$db->idate(dol_now() - $conf->commande->client->warning_delay)."'";
|
||||
$sql .= " AND c.date_commande < '".$db->idate(dol_now() - $conf->order->client->warning_delay)."'";
|
||||
}
|
||||
if ($search_datecloture_start) {
|
||||
$sql .= " AND c.date_cloture >= '".$db->idate($search_datecloture_start)."'";
|
||||
|
|
@ -2294,7 +2298,7 @@ while ($i < $imaxinloop) {
|
|||
print $generic_commande->getNomUrl(1, $getNomUrlOption, 0, 0, 0, 1, 1);
|
||||
|
||||
$filename = dol_sanitizeFileName($obj->ref);
|
||||
$filedir = $conf->commande->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($obj->ref);
|
||||
$filedir = $conf->order->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($obj->ref);
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
|
||||
|
||||
|
|
@ -2882,8 +2886,10 @@ while ($i < $imaxinloop) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($nbprod) {
|
||||
if ($nbprod) { // If there is at least one product to ship, we show the shippable icon
|
||||
print '<a href="'.DOL_URL_ROOT.'/expedition/shipment.php?id='.((int) $obj->rowid).'">';
|
||||
print $form->textwithtooltip('', $text_info, 2, 1, $text_icon, '', 2);
|
||||
print '</a>';
|
||||
}
|
||||
if ($warning) { // Always false in default mode
|
||||
print $form->textwithtooltip('', $langs->trans('NotEnoughForAllOrders').'<br>'.$text_warning, 2, 1, img_picto('', 'error'), '', 2);
|
||||
|
|
|
|||
|
|
@ -3835,13 +3835,13 @@ class Facture extends CommonInvoice
|
|||
* @param string $desc Description of line
|
||||
* @param float $pu_ht Unit price without tax (> 0 even for credit note)
|
||||
* @param float $qty Quantity
|
||||
* @param float $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)')
|
||||
* @param float|string $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)')
|
||||
* @param float $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside)
|
||||
* @param float $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside)
|
||||
* @param int $fk_product Id of predefined product/service
|
||||
* @param float $remise_percent Percent of discount on line
|
||||
* @param int|string $date_start Date start of service
|
||||
* @param int|string $date_end Date end of service
|
||||
* @param int|'' $date_start Date start of service
|
||||
* @param int|'' $date_end Date end of service
|
||||
* @param int $fk_code_ventilation Code of dispatching into accountancy
|
||||
* @param int $info_bits Bits of type of lines
|
||||
* @param int $fk_remise_except Id discount used
|
||||
|
|
@ -3854,7 +3854,7 @@ class Facture extends CommonInvoice
|
|||
* @param int $origin_id Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be Id of origin object (aka line id), else object id
|
||||
* @param int $fk_parent_line Id of parent line
|
||||
* @param int $fk_fournprice Supplier price id (to calculate margin) or ''
|
||||
* @param int $pa_ht Buying price of line (to calculate margin) or ''
|
||||
* @param float|'' $pa_ht Buying price of line (to calculate margin) or ''
|
||||
* @param string $label Label of the line (deprecated, do not use)
|
||||
* @param array<string,mixed> $array_options extrafields array
|
||||
* @param int $situation_percent Situation advance percentage
|
||||
|
|
@ -4110,21 +4110,26 @@ class Facture extends CommonInvoice
|
|||
|
||||
$result = $this->line->insert();
|
||||
if ($result > 0) {
|
||||
// Reorder if child line
|
||||
if (!empty($fk_parent_line)) {
|
||||
$this->line_order(true, 'DESC');
|
||||
} elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) { // Update all rank of all other lines
|
||||
$linecount = count($this->lines);
|
||||
for ($ii = $ranktouse; $ii <= $linecount; $ii++) {
|
||||
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Mise a jour information denormalisees au niveau de la facture meme
|
||||
// Update denormalized fields at the order level
|
||||
if (empty($noupdateafterinsertline)) {
|
||||
$result = $this->update_price(1, 'auto', 0, $mysoc); // The addline method is designed to add line from user input so total calculation with update_price must be done using 'auto' mode.
|
||||
}
|
||||
|
||||
if (!isset($this->context['createfromclone'])) {
|
||||
if (!empty($fk_parent_line)) {
|
||||
// Always reorder if child line
|
||||
$this->line_order(true, 'DESC');
|
||||
} elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) {
|
||||
// Update all rank of all other lines starting from the same $ranktouse
|
||||
$linecount = count($this->lines);
|
||||
for ($ii = $ranktouse; $ii <= $linecount; $ii++) {
|
||||
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||
}
|
||||
}
|
||||
|
||||
$this->lines[] = $this->line;
|
||||
}
|
||||
|
||||
if ($result > 0) {
|
||||
$this->db->commit();
|
||||
return $this->line->id;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Copyright (C) 2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) 2021 Grégory Blémand <gregory.blemand@atm-consulting.fr>
|
||||
* Copyright (C) 2023 Lenin Rivas <lenin.rivas777@gmail.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -152,7 +152,7 @@ abstract class CommonObject
|
|||
public $array_languages = null; // Value is array() when load already tried
|
||||
|
||||
/**
|
||||
* @var array<int,array{parentId:int,source:string,socid:int,id:int,nom:string,civility:string,lastname:string,firstname:string,email:string,login:string,photo:string,statuscontact:int,rowid:int,code:string,libelle:string,status:string,fk_c_type_contact:int}> To store result of ->liste_contact()
|
||||
* @var array<int,array{parentId:int,source:string,socid:int,id:int,nom:string,civility:string,lastname:string,firstname:string,email:string,login:string,photo:string,statuscontact:int,rowid:int,code:string,libelle:string,status:int,fk_c_type_contact:int}> To store result of ->liste_contact()
|
||||
*/
|
||||
public $contacts_ids;
|
||||
|
||||
|
|
@ -270,13 +270,13 @@ abstract class CommonObject
|
|||
public $user;
|
||||
|
||||
/**
|
||||
* @var string The type of originating object. Combined with $origin_id, it allows to reload $origin_object
|
||||
* @var string The type of originating object. Combined with `$origin_type`, it allows to reload `$origin_object`
|
||||
* @see fetch_origin()
|
||||
*/
|
||||
public $origin_type;
|
||||
|
||||
/**
|
||||
* @var int The id of originating object. Combined with $origin_type, it allows to reload $origin_object
|
||||
* @var int The id of originating object. Combined with `$origin_type`, it allows to reload `$origin_object`
|
||||
* @see fetch_origin()
|
||||
*/
|
||||
public $origin_id;
|
||||
|
|
@ -1489,7 +1489,7 @@ abstract class CommonObject
|
|||
* @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...)
|
||||
* @param int $status Status of user or company
|
||||
* @param int[] $arrayoftcids Array with ID of type of contacts. If we provide this, we can filter on ec.fk_c_type_contact IN ($arrayoftcids) to avoid a link on c_type_contact table (faster).
|
||||
* @return array<int,array{parentId:int,source:string,socid:int,id:int,nom:string,civility:string,lastname:string,firstname:string,email:string,login:string,photo:string,gender:string,statuscontact:int,rowid:int,code:string,libelle:string,status:string,fk_c_type_contact:int}>|int<-1,-1> Array of contacts, -1 if error
|
||||
* @return array<int,array{parentId:int,source:string,socid:int,id:int,nom:string,civility:string,lastname:string,firstname:string,email:string,login:string,photo:string,gender:string,statuscontact:int,rowid:int,code:string,libelle:string,status:int,fk_c_type_contact:int}>|int<-1,-1> Array of contacts, -1 if error
|
||||
*/
|
||||
public function liste_contact($statusoflink = -1, $source = 'external', $list = 0, $code = '', $status = -1, $arrayoftcids = array())
|
||||
{
|
||||
|
|
@ -1580,7 +1580,7 @@ abstract class CommonObject
|
|||
'rowid' => $obj->rowid,
|
||||
'code' => $obj->code,
|
||||
'libelle' => $libelle_type,
|
||||
'status' => $obj->statuslink,
|
||||
'status' => (int) $obj->statuslink,
|
||||
'fk_c_type_contact' => $obj->fk_c_type_contact
|
||||
);
|
||||
} else {
|
||||
|
|
@ -5387,7 +5387,7 @@ abstract class CommonObject
|
|||
|
||||
// Define output language and label
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS')) {
|
||||
if (property_exists($this, 'socid') && !is_object($this->thirdparty)) {
|
||||
if (property_exists($this, 'socid') && !empty($this->socid) && !is_object($this->thirdparty)) {
|
||||
dol_print_error(null, 'Error: Method printObjectLine was called on an object and object->fetch_thirdparty was not done before');
|
||||
return;
|
||||
}
|
||||
|
|
@ -6544,8 +6544,8 @@ abstract class CommonObject
|
|||
}
|
||||
} else {
|
||||
/**
|
||||
We are in a situation where the current object has no values in its extra fields.
|
||||
We want to initialize all the values to null so that the array_option is accessible in other contexts (especially in document generation).
|
||||
* We are in a situation where the current object has no values in its extra fields.
|
||||
* We want to initialize all the values to null so that the array_option is accessible in other contexts (especially in document generation).
|
||||
**/
|
||||
if (is_array($extrafields->attributes[$this->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) {
|
||||
|
|
|
|||
|
|
@ -1408,11 +1408,11 @@ class Form
|
|||
* @param int<0,3>|string $showempty 0=no empty value, 1=add an empty value, 2=add line 'Internal' (used by user edit), 3=add an empty value only if more than one record into list
|
||||
* @param string $exclude List of contacts id to exclude
|
||||
* @param string $limitto Not used
|
||||
* @param integer $showfunction Add function into label
|
||||
* @param int<0,1> $showfunction Add function into label
|
||||
* @param string $morecss Add more class to class style
|
||||
* @param bool $nokeyifsocid When 1, we force the option "Press a key to show list" to 0 if there is a value for $socid
|
||||
* @param integer $showsoc Add company into label
|
||||
* @param int $forcecombo 1=Force to use combo box (so no ajax beautify effect)
|
||||
* @param int<0,1> $forcecombo 1=Force to use combo box (so no ajax beautify effect)
|
||||
* @param array<array{method:string,url:string,htmlname:string,params:array<string,string>}> $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
|
||||
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
|
||||
* @param string $htmlid Html id to use instead of htmlname
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class FormFile
|
|||
* @param string $htmlname HTML name
|
||||
* @param string $modulepart Module part
|
||||
* @param string $dirformainimage Main directory of module
|
||||
* @param string $subdirformainimage Subdirectory into main directory. Often ''.
|
||||
* @param string $subdirformainimage Subdirectory into main directory. Often '', can be 'logos/'.
|
||||
* @param string $fileformainimage File name of image to show
|
||||
* @return string HTML code to show and edit image
|
||||
*/
|
||||
|
|
@ -104,8 +104,8 @@ class FormFile
|
|||
|
||||
$maxfilesizearray = getMaxFileSizeArray();
|
||||
$maxmin = $maxfilesizearray['maxmin'];
|
||||
$fileformainimagesmall = getImageFileNameForSize($fileformainimage, '_small');
|
||||
$fileformainimagemini = getImageFileNameForSize($fileformainimage, '_mini');
|
||||
$fileformainimagesmall = getImageFileNameForSize($fileformainimage, '_small'); // This include the "thumbs/..." in path
|
||||
$fileformainimagemini = getImageFileNameForSize($fileformainimage, '_mini'); // This include the "thumbs/..." in path
|
||||
|
||||
$out = '';
|
||||
|
||||
|
|
@ -119,16 +119,16 @@ class FormFile
|
|||
$out .= '<div class="inline-block valignmiddle marginrightonly">';
|
||||
$out .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=remove'.$htmlname.'&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a>';
|
||||
$out .= '</div>';
|
||||
if (file_exists($dirformainimage.'/'.$subdirformainimage.'thumbs/'.$fileformainimagesmall)) {
|
||||
if (file_exists($dirformainimage.'/'.$subdirformainimage.$fileformainimagesmall)) {
|
||||
$out .= '<div class="inline-block valignmiddle marginrightonly">';
|
||||
$out .= '<img id="'.$htmlname.'" style="'.$max.'height: '.$imgheight.'px; '.$max.'width: '.$imgwidth.'px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($subdirformainimage.'thumbs/'.$fileformainimagesmall).'">';
|
||||
$out .= '<img id="'.$htmlname.'" style="'.$max.'height: '.$imgheight.'px; '.$max.'width: '.$imgwidth.'px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($subdirformainimage.$fileformainimagesmall).'">';
|
||||
$out .= '</div>';
|
||||
} elseif (!empty($fileformainimage)) {
|
||||
// Regenerate the thumbs
|
||||
if (!file_exists($dirformainimage.'/'.$subdirformainimage.'thumbs/'.$fileformainimagemini)) {
|
||||
if (!file_exists($dirformainimage.'/'.$subdirformainimage.$fileformainimagemini)) {
|
||||
$imgThumbMini = vignette($dirformainimage.'/'.$subdirformainimage.$fileformainimage, $maxwidthmini, $maxheightmini, '_mini', $quality);
|
||||
}
|
||||
$imgThumbSmall = vignette($dirformainimage.'/'.$subdirformainimage.$fileformainimage, $maxwidthmini, $maxheightmini, '_small', $quality);
|
||||
$imgThumbSmall = vignette($dirformainimage.'/'.$subdirformainimage.$fileformainimage, $maxwidthsmall, $maxheightsmall, '_small', $quality);
|
||||
$out .= '<div class="inline-block valignmiddle">';
|
||||
$out .= '<img id="'.$htmlname.'" style="'.$max.'height: '.$imgheight.'px; '.$max.'width: '.$imgwidth.'px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($subdirformainimage.'thumbs/'.basename($imgThumbSmall)).'">';
|
||||
$out .= '</div>';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2012-2013 Charles-Fr BENKE <charles.fr@benke.fr>
|
||||
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -57,11 +58,11 @@ class FormIntervention
|
|||
* @param int $selected Id intervention preselected
|
||||
* @param string $htmlname Nom de la zone html
|
||||
* @param int $maxlength Maximum length of label
|
||||
* @param int $showempty Show empty line ('1' or string to show for empty line)
|
||||
* @param string $showempty Show empty line ('1' or string to show for empty line)
|
||||
* @param bool $draftonly Show only drafts intervention
|
||||
* @return string HTML code for the select list if OK, empty if KO
|
||||
*/
|
||||
public function select_interventions($socid = -1, $selected = 0, $htmlname = 'interventionid', $maxlength = 16, $showempty = 1, $draftonly = false)
|
||||
public function select_interventions($socid = -1, $selected = 0, $htmlname = 'interventionid', $maxlength = 16, $showempty = '1', $draftonly = false)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $user, $conf, $langs;
|
||||
|
|
|
|||
|
|
@ -1941,9 +1941,9 @@ function form_constantes($tableau, $strictw3c = 2, $helptext = '', $text = 'Valu
|
|||
*/
|
||||
function showModulesExludedForExternal($modules)
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $langs;
|
||||
|
||||
$text = $langs->trans("OnlyFollowingModulesAreOpenedToExternalUsers");
|
||||
$text = $langs->transnoentitiesnoconv("OnlyFollowingModulesAreOpenedToExternalUsers");
|
||||
$listofmodules = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')); // List of modules qualified for external user management
|
||||
|
||||
$i = 0;
|
||||
|
|
@ -1967,11 +1967,11 @@ function showModulesExludedForExternal($modules)
|
|||
}
|
||||
$i++;
|
||||
|
||||
$tmptext = $langs->trans('Module'.$module->numero.'Name');
|
||||
$tmptext = $langs->transnoentitiesnoconv('Module'.$module->numero.'Name');
|
||||
if ($tmptext != 'Module'.$module->numero.'Name') {
|
||||
$text .= $langs->trans('Module'.$module->numero.'Name');
|
||||
$text .= $langs->transnoentitiesnoconv('Module'.$module->numero.'Name');
|
||||
} else {
|
||||
$text .= $langs->trans($module->name);
|
||||
$text .= $langs->transnoentitiesnoconv($module->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ function productlot_prepare_head($object)
|
|||
*/
|
||||
function product_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user, $db;
|
||||
global $langs, $conf, $db;
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label('product');
|
||||
|
|
@ -368,24 +368,31 @@ function product_admin_prepare_head()
|
|||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_price_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ProductLevelExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['product_price']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
|
||||
// Extrafields for price levels
|
||||
if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_price_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ProductLevelExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['product_price']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'levelAttributes';
|
||||
$h++;
|
||||
}
|
||||
$head[$h][2] = 'levelAttributes';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_customer_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ProductCustomerExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['product_customer_price']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
|
||||
//Extrafields for price per customer
|
||||
if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_customer_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ProductCustomerExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['product_customer_price']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'customerAttributes';
|
||||
$h++;
|
||||
}
|
||||
$head[$h][2] = 'customerAttributes';
|
||||
$h++;
|
||||
|
||||
// Supplier prices
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_supplier_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ProductSupplierExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['product_fournisseur_price']['count'];
|
||||
|
|
|
|||
|
|
@ -172,6 +172,11 @@ function propal_admin_prepare_head()
|
|||
$head[$h][2] = 'general';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/admin/propal_pdf.php';
|
||||
$head[$h][1] = $langs->trans("PDF");
|
||||
$head[$h][2] = 'pdf';
|
||||
$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
|
||||
|
|
|
|||
|
|
@ -766,10 +766,11 @@ class pdf_azur extends ModelePDFPropales
|
|||
}
|
||||
|
||||
// Add terms to sale
|
||||
if (!empty($mysoc->termsofsale) && getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_PROPAL')) {
|
||||
$termsofsale = $conf->mycompany->dir_output.'/'.$mysoc->termsofsale;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
|
||||
$termsofsale = $conf->mycompany->multidir_output[$object->entity].'/'.$mysoc->termsofsale;
|
||||
if (getDolGlobalString('MAIN_INFO_PROPAL_TERMSOFSALE') && getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_PROPAL')) {
|
||||
$termsofsalefilename = getDolGlobalString('MAIN_INFO_PROPAL_TERMSOFSALE');
|
||||
$termsofsale = $conf->propal->dir_output.'/'.$termsofsalefilename;
|
||||
if (!empty($conf->propal->multidir_output[$object->entity])) {
|
||||
$termsofsale = $conf->propal->multidir_output[$object->entity].'/'.$termsofsalefilename;
|
||||
}
|
||||
if (file_exists($termsofsale) && is_readable($termsofsale)) {
|
||||
$pagecount = $pdf->setSourceFile($termsofsale);
|
||||
|
|
|
|||
|
|
@ -887,10 +887,11 @@ class pdf_cyan extends ModelePDFPropales
|
|||
}
|
||||
|
||||
// Add terms to sale
|
||||
if (!empty($mysoc->termsofsale) && getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_PROPAL')) {
|
||||
$termsofsale = $conf->mycompany->dir_output.'/'.$mysoc->termsofsale;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
|
||||
$termsofsale = $conf->mycompany->multidir_output[$object->entity].'/'.$mysoc->termsofsale;
|
||||
if (getDolGlobalString('MAIN_INFO_PROPAL_TERMSOFSALE') && getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_PROPAL')) {
|
||||
$termsofsalefilename = getDolGlobalString('MAIN_INFO_PROPAL_TERMSOFSALE');
|
||||
$termsofsale = $conf->propal->dir_output.'/'.$termsofsalefilename;
|
||||
if (!empty($conf->propal->multidir_output[$object->entity])) {
|
||||
$termsofsale = $conf->propal->multidir_output[$object->entity].'/'.$termsofsalefilename;
|
||||
}
|
||||
if (file_exists($termsofsale) && is_readable($termsofsale)) {
|
||||
$pagecount = $pdf->setSourceFile($termsofsale);
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ if (!defined('USEDOLIBARRSERVER') && !defined('USEDOLIBARREDITOR')) {
|
|||
}
|
||||
|
||||
// Content-Security-Policy
|
||||
if (!defined('WEBSITE_MAIN_SECURITY_FORCECSP')) {
|
||||
if (!defined('WEBSITE_'.$website->id.'_SECURITY_FORCECSP')) {
|
||||
// A default security policy that keep usage of js external component like ckeditor, stripe, google, working
|
||||
// For example: to restrict to only local resources, except for css (cloudflare+google), and js (transifex + google tags) and object/iframe (youtube)
|
||||
// default-src 'self'; style-src: https://cdnjs.cloudflare.com https://fonts.googleapis.com; script-src: https://cdn.transifex.com https://www.googletagmanager.com; object-src https://youtube.com; frame-src https://youtube.com; img-src: *;
|
||||
|
|
@ -178,7 +178,7 @@ if (!defined('USEDOLIBARRSERVER') && !defined('USEDOLIBARREDITOR')) {
|
|||
//
|
||||
// $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;";
|
||||
// $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src *; script-src 'self' 'unsafe-inline' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com; style-src 'self' 'unsafe-inline'; connect-src 'self';";
|
||||
$contentsecuritypolicy = getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCECSP');
|
||||
$contentsecuritypolicy = getDolGlobalString('WEBSITE_'.$website->id.'_SECURITY_FORCECSP');
|
||||
|
||||
if (!is_object($hookmanager)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
|
|
@ -200,32 +200,32 @@ if (!defined('USEDOLIBARRSERVER') && !defined('USEDOLIBARREDITOR')) {
|
|||
}
|
||||
|
||||
// Referrer-Policy
|
||||
if (!defined('WEBSITE_MAIN_SECURITY_FORCERP')) {
|
||||
if (!defined('WEBSITE_'.$website->id.'_SECURITY_FORCERP')) {
|
||||
// The constant WEBSITE_MAIN_SECURITY_FORCERP should never be defined by page, but the variable used just after may be
|
||||
|
||||
// For public web sites, we use the same default value than "strict-origin-when-cross-origin"
|
||||
$referrerpolicy = getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCERP', "strict-origin-when-cross-origin");
|
||||
$referrerpolicy = getDolGlobalString('WEBSITE_'.$website->id.'_SECURITY_FORCERP', "strict-origin-when-cross-origin");
|
||||
|
||||
header("Referrer-Policy: ".$referrerpolicy);
|
||||
}
|
||||
|
||||
// Strict-Transport-Security
|
||||
if (!defined('WEBSITE_MAIN_SECURITY_FORCESTS')) {
|
||||
if (!defined('WEBSITE_'.$website->id.'_SECURITY_FORCESTS')) {
|
||||
// The constant WEBSITE_MAIN_SECURITY_FORCESTS should never be defined by page, but the variable used just after may be
|
||||
|
||||
// Example: "max-age=31536000; includeSubDomains"
|
||||
$sts = getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCESTS');
|
||||
$sts = getDolGlobalString('WEBSITE_'.$website->id.'_SECURITY_FORCESTS');
|
||||
if (!empty($sts)) {
|
||||
header("Strict-Transport-Security: ".$sts);
|
||||
}
|
||||
}
|
||||
|
||||
// Permissions-Policy (old name was Feature-Policy)
|
||||
if (!defined('WEBSITE_MAIN_SECURITY_FORCEPP')) {
|
||||
if (!defined('WEBSITE_'.$website->id.'_SECURITY_FORCEPP')) {
|
||||
// The constant WEBSITE_MAIN_SECURITY_FORCEPP should never be defined by page, but the variable used just after may be
|
||||
|
||||
// Example: "camera: 'none'; microphone: 'none';"
|
||||
$pp = getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCEPP');
|
||||
$pp = getDolGlobalString('WEBSITE_'.$website->id.'_SECURITY_FORCEPP');
|
||||
if (!empty($pp)) {
|
||||
header("Permissions-Policy: ".$pp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -333,6 +333,15 @@ if (empty($reshook)) {
|
|||
$object->setProject($projectid);
|
||||
}
|
||||
|
||||
if ($action == 'set_validate' && $permissiontoadd) {
|
||||
$object->fetch($id);
|
||||
if ($object->reopen($user) >= 0) {
|
||||
$action = '';
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'update_extras' && $permissiontoadd) {
|
||||
$object->oldcopy = dol_clone($object, 2);
|
||||
|
||||
|
|
@ -916,6 +925,9 @@ if (!empty($id) && $action != 'edit') {
|
|||
if ($object->status == $object::STATUS_VALIDATED && round($remaintopay) == 0 && $object->paid == 0 && $user->hasRight('don', 'creer')) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=set_paid&token='.newToken().'">'.$langs->trans("ClassifyPaid")."</a></div>";
|
||||
}
|
||||
if ($object->status == $object::STATUS_PAID && $object->paid == 1 && $user->hasRight('don', 'creer')) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=set_validate&token='.newToken().'">'.$langs->trans("ReOpen")."</a></div>";
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($user->hasRight('don', 'supprimer')) {
|
||||
|
|
|
|||
|
|
@ -859,9 +859,22 @@ class Don extends CommonObject
|
|||
public function reopen($user, $notrigger = 0)
|
||||
{
|
||||
// Protection
|
||||
if ($this->status != self::STATUS_CANCELED) {
|
||||
if ($this->status != self::STATUS_CANCELED && $this->status != self::STATUS_PAID) {
|
||||
return 0;
|
||||
}
|
||||
if ($this->statut == self::STATUS_PAID) {
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "don SET paid = 0 WHERE rowid = " . ((int) $this->id);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
if ($this->db->affected_rows($resql)) {
|
||||
$this->paid = 0;
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'DON_REOPEN');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2410,6 +2410,7 @@ if ($action == 'create') {
|
|||
|
||||
// Loop on each product to send/sent
|
||||
$conf->cache['product'] = array();
|
||||
$conf->cache['warehouse'] = array();
|
||||
for ($i = 0; $i < $num_prod; $i++) {
|
||||
$parameters = array('i' => $i, 'line' => $lines[$i], 'line_id' => $line_id, 'num' => $num_prod, 'alreadysent' => $alreadysent, 'editColspan' => !empty($editColspan) ? $editColspan : 0, 'outputlangs' => $outputlangs);
|
||||
$reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action);
|
||||
|
|
@ -2636,16 +2637,28 @@ if ($action == 'create') {
|
|||
if ($lines[$i]->product_type == Product::TYPE_SERVICE && getDolGlobalString('SHIPMENT_SUPPORTS_SERVICES')) {
|
||||
print '<span class="opacitymedium">('.$langs->trans("Service").')</span>';
|
||||
} elseif ($lines[$i]->entrepot_id > 0) {
|
||||
$entrepot = new Entrepot($db);
|
||||
$entrepot->fetch($lines[$i]->entrepot_id);
|
||||
print $entrepot->getNomUrl(1);
|
||||
$warehouse_id = $lines[$i]->entrepot_id;
|
||||
if (!isset($conf->cache['warehouse'][$warehouse_id])) {
|
||||
$warehouse = new Entrepot($db);
|
||||
$warehouse->fetch($warehouse_id);
|
||||
$conf->cache['warehouse'][$warehouse_id] = $warehouse;
|
||||
} else {
|
||||
$warehouse = $conf->cache['warehouse'][$warehouse_id];
|
||||
}
|
||||
print $warehouse->getNomUrl(1);
|
||||
} elseif (count($lines[$i]->details_entrepot) > 1) {
|
||||
$detail = '';
|
||||
foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
|
||||
if ($detail_entrepot->entrepot_id > 0) {
|
||||
$entrepot = new Entrepot($db);
|
||||
$entrepot->fetch($detail_entrepot->entrepot_id);
|
||||
$detail .= $langs->trans("DetailWarehouseFormat", $entrepot->label, $detail_entrepot->qty_shipped).'<br>';
|
||||
$warehouse_id = $detail_entrepot->entrepot_id;
|
||||
if ($warehouse_id > 0) {
|
||||
if (!isset($conf->cache['warehouse'][$warehouse_id])) {
|
||||
$warehouse = new Entrepot($db);
|
||||
$warehouse->fetch($warehouse_id);
|
||||
$conf->cache['warehouse'][$warehouse_id] = $warehouse;
|
||||
} else {
|
||||
$warehouse = $conf->cache['warehouse'][$warehouse_id];
|
||||
}
|
||||
$detail .= $langs->trans("DetailWarehouseFormat", $warehouse->label, $detail_entrepot->qty_shipped).'<br>';
|
||||
}
|
||||
}
|
||||
print $form->textwithtooltip(img_picto('', 'object_stock').' '.$langs->trans("DetailWarehouseNumber"), $detail);
|
||||
|
|
|
|||
|
|
@ -1997,7 +1997,7 @@ class CommandeFournisseur extends CommonOrder
|
|||
* @param ?int $date_end Date end of service
|
||||
* @param array<string,null|int|float|string> $array_options extrafields array
|
||||
* @param ?int $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param int|string $pu_ht_devise Amount in currency
|
||||
* @param int|string $pu_ht_devise Amount in currency
|
||||
* @param string $origin 'order', ...
|
||||
* @param int $origin_id Id of origin object
|
||||
* @param int $rang Rank
|
||||
|
|
@ -2006,7 +2006,7 @@ class CommandeFournisseur extends CommonOrder
|
|||
*/
|
||||
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $fk_prod_fourn_price = 0, $ref_supplier = '', $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $type = 0, $info_bits = 0, $notrigger = 0, $date_start = null, $date_end = null, $array_options = [], $fk_unit = null, $pu_ht_devise = 0, $origin = '', $origin_id = 0, $rang = -1, $special_code = 0)
|
||||
{
|
||||
global $langs, $mysoc, $conf;
|
||||
global $langs, $mysoc;
|
||||
|
||||
dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $fk_prod_fourn_price, $ref_supplier, $remise_percent, $price_base_type, $pu_ttc, $type, $info_bits, $notrigger, $date_start, $date_end, $fk_unit, $pu_ht_devise, $origin, $origin_id");
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
|
@ -2243,19 +2243,25 @@ class CommandeFournisseur extends CommonOrder
|
|||
|
||||
$result = $this->line->insert($notrigger);
|
||||
if ($result > 0) {
|
||||
// Reorder if child line
|
||||
if (!empty($this->line->fk_parent_line)) {
|
||||
$this->line_order(true, 'DESC');
|
||||
} elseif ($rang > 0 && $rang <= count($this->lines)) { // Update all rank of all other lines
|
||||
$linecount = count($this->lines);
|
||||
for ($ii = $rang; $ii <= $linecount; $ii++) {
|
||||
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Mise a jour information denormalisees au niveau de la commande meme
|
||||
// Update denormalized fields at the order level
|
||||
$result = $this->update_price(1, 'auto', 0, $this->thirdparty); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
||||
|
||||
if ($result > 0) {
|
||||
if (!isset($this->context['createfromclone'])) {
|
||||
if (!empty($this->line->fk_parent_line)) {
|
||||
// Always reorder if child line
|
||||
$this->line_order(true, 'DESC');
|
||||
} elseif ($rang > 0 && $rang <= count($this->lines)) {
|
||||
// Update all rank of all other lines starting from the same $ranktouse
|
||||
$linecount = count($this->lines);
|
||||
for ($ii = $rang; $ii <= $linecount; $ii++) {
|
||||
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||
}
|
||||
}
|
||||
|
||||
$this->lines[] = $this->line;
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return $this->line->id;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -2303,19 +2303,25 @@ class FactureFournisseur extends CommonInvoice
|
|||
|
||||
$result = $supplierinvoiceline->insert($notrigger);
|
||||
if ($result > 0) {
|
||||
// Reorder if child line
|
||||
if (!empty($fk_parent_line)) {
|
||||
$this->line_order(true, 'DESC');
|
||||
} elseif ($rang > 0 && $rang <= count($this->lines)) { // Update all rank of all other lines
|
||||
$linecount = count($this->lines);
|
||||
for ($ii = $rang; $ii <= $linecount; $ii++) {
|
||||
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Mise a jour information denormalisees au niveau de la facture meme
|
||||
// Update denormalized fields at the order level
|
||||
$result = $this->update_price(1, 'auto', 0, $this->thirdparty); // The addline method is designed to add line from user input so total calculation with update_price must be done using 'auto' mode.
|
||||
|
||||
if ($result > 0) {
|
||||
if (!isset($this->context['createfromclone'])) {
|
||||
if (!empty($fk_parent_line)) {
|
||||
// Always reorder if child line
|
||||
$this->line_order(true, 'DESC');
|
||||
} elseif ($rang > 0 && $rang <= count($this->lines)) {
|
||||
// Update all rank of all other lines starting from the same $ranktouse
|
||||
$linecount = count($this->lines);
|
||||
for ($ii = $rang; $ii <= $linecount; $ii++) {
|
||||
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||
}
|
||||
}
|
||||
|
||||
$this->lines[] = $supplierinvoiceline;
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return $supplierinvoiceline->id;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -2062,7 +2062,11 @@ if ($resql) {
|
|||
}
|
||||
// Billed
|
||||
if (!empty($arrayfields['cf.billed']['checked'])) {
|
||||
print '<td class="center">'.yn($obj->billed).'</td>';
|
||||
print '<td class="center">';
|
||||
if ($obj->billed) {
|
||||
print yn($obj->billed, $langs->trans("Billed"));
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@
|
|||
--
|
||||
|
||||
-- Insert first personalized report. This is a minimal default setup.
|
||||
INSERT INTO llx_c_accounting_report (code, label, fk_country, active) VALUES ('REP', 'Report personalized', 0, 1);
|
||||
INSERT INTO llx_c_accounting_report (code, label, fk_country, active, entity) VALUES ('REP', 'Report personalized', 0, 1, __ENTITY__);
|
||||
|
||||
-- Group of accounting accounts for report. This is a minimal default setup.
|
||||
INSERT INTO llx_c_accounting_category (rowid, fk_report, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1, 1, 'INCOMES', 'Income of products/services', 'Example: 7xxxxx', 0, 0, '', '10', 0, 1);
|
||||
INSERT INTO llx_c_accounting_category (rowid, fk_report, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2, 1, 'EXPENSES', 'Expenses of products/services', 'Example: 6xxxxx', 0, 0, '', '20', 0, 1);
|
||||
INSERT INTO llx_c_accounting_category (rowid, fk_report, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3, 1, 'PROFIT', 'Balance', '', 0, 1, 'INCOMES+EXPENSES', '30', 0, 1);
|
||||
INSERT INTO llx_c_accounting_category (fk_report, code, label, range_account, sens, category_type, formula, position, fk_country, active, entity) VALUES ( 1, 'INCOMES', 'Income of products/services', 'Example: 7xxxxx', 0, 0, '', '10', 0, 1, __ENTITY__);
|
||||
INSERT INTO llx_c_accounting_category (fk_report, code, label, range_account, sens, category_type, formula, position, fk_country, active, entity) VALUES ( 1, 'EXPENSES', 'Expenses of products/services', 'Example: 6xxxxx', 0, 0, '', '20', 0, 1, __ENTITY__);
|
||||
INSERT INTO llx_c_accounting_category (fk_report, code, label, range_account, sens, category_type, formula, position, fk_country, active, entity) VALUES ( 1, 'PROFIT', 'Balance', '', 0, 1, 'INCOMES+EXPENSES', '30', 0, 1, __ENTITY__);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
-- Copyright (C) Year(-Year) Author Name <email>
|
||||
--
|
||||
-- eldy
|
||||
-- frederic34
|
||||
-- dolibit-ut <dev@dolibit.de>
|
||||
-- Copyright (C) 2024 Regis Houssin <regis.houssin@inodbox.com>
|
||||
-- Copyright (C) 2024 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
-- Copyright (C) 2024 Udo Tamm <dev@dolibit.de>
|
||||
-- Copyright (C) 2024 Regis Houssin <regis.houssin@inodbox.com>
|
||||
--
|
||||
|
||||
-- License
|
||||
|
|
|
|||
|
|
@ -31,82 +31,85 @@
|
|||
-- Setup constants
|
||||
--
|
||||
|
||||
-- Visible in misc page
|
||||
-- Visible in misc page and common to all entities
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_NOT_INSTALLED','1','chaine','Setup is running',1,0);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_FEATURES_LEVEL','0','chaine','Level of features to show: -1=stable+deprecated, 0=stable only (default), 1=stable+experimental, 2=stable+experimental+development',1,0);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAILING_LIMIT_SENDBYWEB','25','chaine','Number of targets to defined packet size when sending mass email',1,0);
|
||||
--insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_ENABLE_LOG_TO_HTML','0','chaine','If this option is set to 1, it is possible to see log output at end of HTML sources by adding paramater logtohtml=1 on URL. Module log must also be enabled.',1,0);
|
||||
--insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_ENABLE_LOG_TO_HTML','0','chaine','If this option is set to 1, it is possible to see log output at end of HTML sources by adding parameter logtohtml=1 on URL. Module log must also be enabled.',1,0);
|
||||
|
||||
-- Visible in misc page but specific to one entity
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_FEATURES_LEVEL','0','chaine','Level of features to show: -1=stable+deprecated, 0=stable only (default), 1=stable+experimental, 2=stable+experimental+development',1,__ENTITY__);
|
||||
|
||||
-- Hidden and common to all entities
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('SYSLOG_HANDLERS','["mod_syslog_file"]','chaine','Which logger to use',0,0);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('SYSLOG_FILE','DOL_DATA_ROOT/dolibarr.log','chaine','Directory where to write log file',0,0);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('SYSLOG_LEVEL','7','chaine','Level of debug info to show',0,0);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_UPLOAD_DOC','2048','chaine','Max size for file upload (0 means no upload allowed)',0,0);
|
||||
|
||||
-- Hidden but specific to one entity
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_ENABLE_OVERWRITE_TRANSLATION','1','chaine','Enable translation overwrite',0,1);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_ENABLE_DEFAULT_VALUES','1','chaine','Enable default value overwrite',0,1);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MONNAIE','EUR','chaine','Currency',0,1);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_UPLOAD_DOC','2048','chaine','Max size for file upload (0 means no upload allowed)',0,__ENTITY__);
|
||||
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MAIL_SMTP_SERVER','','chaine','Host or ip address for SMTP server',0,1);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MAIL_SMTP_PORT','','chaine','Port for SMTP server',0,1);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MAIL_EMAIL_FROM','robot@domain.tld','chaine','email emitter for Dolibarr automatic emails',0,1);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_ENABLE_OVERWRITE_TRANSLATION','1','chaine','Enable translation overwrite',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_ENABLE_DEFAULT_VALUES','1','chaine','Enable default value overwrite',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MONNAIE','EUR','chaine','Currency',0,__ENTITY__);
|
||||
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MAIL_SMTP_SERVER','','chaine','Host or ip address for SMTP server',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MAIL_SMTP_PORT','','chaine','Port for SMTP server',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MAIL_EMAIL_FROM','robot@domain.com','chaine','email emitter for Dolibarr automatic emails',0,__ENTITY__);
|
||||
|
||||
--
|
||||
-- IHM
|
||||
--
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_SIZE_LISTE_LIMIT','20','chaine','Maximum length of lists',0,0);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_SIZE_SHORTLIST_LIMIT','3','chaine','Maximum length of short lists',0,0);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_SIZE_LISTE_LIMIT','20','chaine','Maximum length of lists',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_SIZE_SHORTLIST_LIMIT','3','chaine','Maximum length of short lists',0,__ENTITY__);
|
||||
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MENU_STANDARD','eldy_menu.php','chaine','Menu manager for internal users',0,0);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MENUFRONT_STANDARD','eldy_menu.php','chaine','Menu manager for external users',0,0);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MENU_SMARTPHONE','eldy_menu.php','chaine','Menu manager for internal users using smartphones',0,0);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MENUFRONT_SMARTPHONE','eldy_menu.php','chaine','Menu manager for external users using smartphones',0,0);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MENU_STANDARD','eldy_menu.php','chaine','Menu manager for internal users',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MENUFRONT_STANDARD','eldy_menu.php','chaine','Menu manager for external users',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MENU_SMARTPHONE','eldy_menu.php','chaine','Menu manager for internal users using smartphones',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_MENUFRONT_SMARTPHONE','eldy_menu.php','chaine','Menu manager for external users using smartphones',0,__ENTITY__);
|
||||
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('THEME_ELDY_USEBORDERONTABLE', '1', 'chaine', 'Enable the border in theme',0,0);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('THEME_ELDY_USEBORDERONTABLE', '1', 'chaine', 'Enable the border in theme',0,__ENTITY__);
|
||||
|
||||
|
||||
--
|
||||
-- Warning delays
|
||||
--
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_ACTIONS_TODO','7','chaine','Tolérance de retard avant alerte (en jours) sur actions planifiées non réalisées',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_ORDERS_TO_PROCESS','2','chaine','Tolérance de retard avant alerte (en jours) sur commandes clients non traitées',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS','7','chaine','Tolérance de retard avant alerte (en jours) sur commandes fournisseurs non traitées',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_PROPALS_TO_CLOSE','31','chaine','Tolérance de retard avant alerte (en jours) sur propales à cloturer',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_PROPALS_TO_BILL','7','chaine','Tolérance de retard avant alerte (en jours) sur propales non facturées',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_CUSTOMER_BILLS_UNPAYED','31','chaine','Tolérance de retard avant alerte (en jours) sur factures client impayées',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_SUPPLIER_BILLS_TO_PAY','2','chaine','Tolérance de retard avant alerte (en jours) sur factures fournisseur impayées',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_NOT_ACTIVATED_SERVICES','0','chaine','Tolérance de retard avant alerte (en jours) sur services à activer',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_RUNNING_SERVICES','0','chaine','Tolérance de retard avant alerte (en jours) sur services expirés',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_MEMBERS','31','chaine','Tolérance de retard avant alerte (en jours) sur cotisations adhérent en retard',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE','62','chaine','Tolérance de retard avant alerte (en jours) sur rapprochements bancaires à faire',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_EXPENSEREPORTS_TO_PAY','31','chaine','Tolérance de retard avant alerte (en jours) sur les notes de frais impayées',0);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_DELAY_ACTIONS_TODO','7','chaine','Tolérance de retard avant alerte (en jours) sur actions planifiées non réalisées',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_DELAY_ORDERS_TO_PROCESS','2','chaine','Tolérance de retard avant alerte (en jours) sur commandes clients non traitées',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS','7','chaine','Tolérance de retard avant alerte (en jours) sur commandes fournisseurs non traitées',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_DELAY_PROPALS_TO_CLOSE','31','chaine','Tolérance de retard avant alerte (en jours) sur propales à cloturer',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_DELAY_PROPALS_TO_BILL','7','chaine','Tolérance de retard avant alerte (en jours) sur propales non facturées',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_DELAY_CUSTOMER_BILLS_UNPAYED','31','chaine','Tolérance de retard avant alerte (en jours) sur factures client impayées',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_DELAY_SUPPLIER_BILLS_TO_PAY','2','chaine','Tolérance de retard avant alerte (en jours) sur factures fournisseur impayées',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_DELAY_NOT_ACTIVATED_SERVICES','0','chaine','Tolérance de retard avant alerte (en jours) sur services à activer',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_DELAY_RUNNING_SERVICES','0','chaine','Tolérance de retard avant alerte (en jours) sur services expirés',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_DELAY_MEMBERS','31','chaine','Tolérance de retard avant alerte (en jours) sur cotisations adhérent en retard',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE','62','chaine','Tolérance de retard avant alerte (en jours) sur rapprochements bancaires à faire',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_DELAY_EXPENSEREPORTS_TO_PAY','31','chaine','Tolérance de retard avant alerte (en jours) sur les notes de frais impayées',0,__ENTITY__);
|
||||
|
||||
|
||||
--
|
||||
-- Mail Mailing
|
||||
--
|
||||
--insert into llx_const (name, value, type, note, visible) values ('MAIN_FIX_FOR_BUGGED_MTA','1','chaine','Set constant to fix email ending from PHP with some linux like system',1);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAILING_EMAIL_FROM','no-reply@mydomain.tld','chaine','EMail emmetteur pour les envois d emailings',0);
|
||||
--insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_FIX_FOR_BUGGED_MTA','1','chaine','Set constant to fix email ending from PHP with some linux like system',1,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAILING_EMAIL_FROM','no-reply@mydomain.tld','chaine','EMail emmetteur pour les envois d emailings',0, __ENTITY__);
|
||||
|
||||
|
||||
--
|
||||
-- ODT Path
|
||||
--
|
||||
insert into llx_const (name, value, type, visible, entity) VALUES ('PRODUCT_ADDON_PDF_ODT_PATH', 'DOL_DATA_ROOT/doctemplates/products', 'chaine', 0, 1);
|
||||
insert into llx_const (name, value, type, visible, entity) VALUES ('CONTRACT_ADDON_PDF_ODT_PATH', 'DOL_DATA_ROOT/doctemplates/contracts', 'chaine', 0, 1);
|
||||
insert into llx_const (name, value, type, visible, entity) VALUES ('USERGROUP_ADDON_PDF_ODT_PATH', 'DOL_DATA_ROOT/doctemplates/usergroups', 'chaine', 0, 1);
|
||||
insert into llx_const (name, value, type, visible, entity) VALUES ('USER_ADDON_PDF_ODT_PATH', 'DOL_DATA_ROOT/doctemplates/users', 'chaine', 0, 1);
|
||||
insert into llx_const (name, value, type, visible, entity) VALUES ('PRODUCT_ADDON_PDF_ODT_PATH', 'DOL_DATA_ROOT/doctemplates/products', 'chaine', 0, __ENTITY__);
|
||||
insert into llx_const (name, value, type, visible, entity) VALUES ('CONTRACT_ADDON_PDF_ODT_PATH', 'DOL_DATA_ROOT/doctemplates/contracts', 'chaine', 0, __ENTITY__);
|
||||
insert into llx_const (name, value, type, visible, entity) VALUES ('USERGROUP_ADDON_PDF_ODT_PATH', 'DOL_DATA_ROOT/doctemplates/usergroups', 'chaine', 0, __ENTITY__);
|
||||
insert into llx_const (name, value, type, visible, entity) VALUES ('USER_ADDON_PDF_ODT_PATH', 'DOL_DATA_ROOT/doctemplates/users', 'chaine', 0, __ENTITY__);
|
||||
|
||||
|
||||
--
|
||||
-- PRODUCTS
|
||||
--
|
||||
INSERT INTO llx_const (name, entity, value, type, visible) VALUES ('PRODUCT_PRICE_BASE_TYPE', 0, 'HT', 'string', 0);
|
||||
INSERT INTO llx_const (name, value, type, visible, entity) VALUES ('PRODUCT_PRICE_BASE_TYPE', 'HT', 'string', 0, __ENTITY__);
|
||||
|
||||
|
||||
--
|
||||
-- Membership
|
||||
--
|
||||
INSERT INTO llx_const (name, entity, value, type, visible) VALUES ('ADHERENT_LOGIN_NOT_REQUIRED', 0, '1', 'string', 0);
|
||||
INSERT INTO llx_const (name, value, type, visible, entity) VALUES ('ADHERENT_LOGIN_NOT_REQUIRED', '1', 'string', 0, __ENTITY__);
|
||||
|
||||
|
|
|
|||
|
|
@ -612,6 +612,7 @@ DisabledBecauseNotLastInCycle=The next situation already exists.
|
|||
DisabledBecauseFinal=This situation is final.
|
||||
situationInvoiceShortcode_AS=AS
|
||||
situationInvoiceShortcode_S=S
|
||||
CantBeNullOrPositive=The progress of a credit note invoice can't be null or positive
|
||||
CantBeLessThanMinPercent=The progress can't be smaller than its value in the previous situation.
|
||||
NoSituations=No open situations
|
||||
InvoiceSituationLast=Final and general invoice
|
||||
|
|
|
|||
|
|
@ -232,6 +232,7 @@ ErrorBadLinkSourceSetButBadValueForRef=The link you use is not valid. A 'source'
|
|||
ErrorTooManyErrorsProcessStopped=Too many errors. Process was stopped.
|
||||
ErrorMassValidationNotAllowedWhenStockIncreaseOnAction=Mass validation is not possible when option to increase/decrease stock is set on this action (you must validate one by one so you can define the warehouse to increase/decrease)
|
||||
ErrorObjectMustHaveStatusDraftToBeValidated=Object %s must have status 'Draft' to be validated.
|
||||
ErrorObjectHasWrongStatus=Object %s must have another status for this operation.
|
||||
ErrorObjectMustHaveLinesToBeValidated=Object %s must have lines to be validated.
|
||||
ErrorOnlyInvoiceValidatedCanBeSentInMassAction=Only validated invoices can be sent using the "Send by email" mass action.
|
||||
ErrorChooseBetweenFreeEntryOrPredefinedProduct=You must choose if article is a predefined product or not
|
||||
|
|
|
|||
|
|
@ -1351,3 +1351,4 @@ GroupingLine=Grouping line
|
|||
AllTime=From start
|
||||
Transferred=Transferred
|
||||
Anonymous=Anonymous
|
||||
Automatic=Automatic
|
||||
|
|
|
|||
|
|
@ -53,3 +53,4 @@ RestoreWithCurrentQtySaved=Fill quantities with latest saved values
|
|||
ReceptionsRecorded=Receptions recorded
|
||||
ReceptionUpdated=Reception successfully updated
|
||||
ReceptionDistribution=Reception distribution
|
||||
AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation=Automatic validation is not possible when stock is decreased on invoice validation
|
||||
|
|
|
|||
|
|
@ -368,3 +368,11 @@ WebPortalSetupNotComplete=Web portal setup is not complete
|
|||
DeleteWebsiteAccount=Delete website account
|
||||
ConfirmDeleteWebsiteAccount=Are you sure you want to delete this account.
|
||||
ConfirmDeleteWebsiteAccount2=If this account was used to login on the public portal or any otherweb site powered by Dolibarr, the login may be no more possible.
|
||||
ContentSecurityPolicy=Content Security Policy
|
||||
WebsiteSecurityForceRP=Website Security RP
|
||||
WebsiteSecurityForceSTS=Website Security STS
|
||||
WebsiteSecurityForcePP=Website Security PP
|
||||
SecurityPolicySucesfullyRemoved=Content Security Policy successfully removed
|
||||
ErrorRemovingSecurityPolicy=An error occurred when trying to remove a Content Security Policy
|
||||
SecurityPolicySucesfullyAdded=Content Security Policy successfully added
|
||||
ErrorAddingSecurityPolicy=An error occurred when trying to add a Content Security Policy
|
||||
|
|
@ -122,9 +122,11 @@ if ($action == 'other') {
|
|||
if ($tmprule == $princingrules) { // We are on selected rule, we enable it
|
||||
if ($princingrules == 'PRODUCT_PRICE_UNIQ') { // For this case, we disable entries manually
|
||||
$res = dolibarr_set_const($db, 'PRODUIT_MULTIPRICES', 0, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_BY_QTY', 0, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES', 0, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES', 0, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_BY_QTY', 0, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES', 0, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, 'PRODUCT_PRICE_UNIQ', 1, 'chaine', 0, '', $conf->entity);
|
||||
} else {
|
||||
$multirule = explode('&', $princingrules);
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ class ProjectStats extends Stats
|
|||
* @param int $startyear End year
|
||||
* @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save)
|
||||
* @param int $wonlostfilter Add a filter on status won/lost
|
||||
* @return int<-1,-1>|array<array<int<0,11>,array{0:int<1,12>,1:int|float}>> Array of values or <0 if error
|
||||
* @return int<-1,-1>|array<int<0,11>,array{0:string,1:int,2?:int,3?:int,4?:int}> Array of values or <0 if error
|
||||
*/
|
||||
public function getWeightedAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $wonlostfilter = 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2248,16 +2248,16 @@ class Task extends CommonObjectLine
|
|||
|
||||
/** Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param User $user User making the clone
|
||||
* @param int $fromid Id of object to clone
|
||||
* @param int $project_id Id of project to attach clone task
|
||||
* @param int $parent_task_id Id of task to attach clone task
|
||||
* @param bool $clone_change_dt recalculate date of task regarding new project start date
|
||||
* @param bool $clone_affectation clone affectation of project
|
||||
* @param bool $clone_time clone time of project
|
||||
* @param bool $clone_file clone file of project
|
||||
* @param bool $clone_note clone note of project
|
||||
* @param bool $clone_prog clone progress of project
|
||||
* @param User $user User making the clone
|
||||
* @param int $fromid Id of object to clone
|
||||
* @param int $project_id Id of project to attach clone task
|
||||
* @param int $parent_task_id Id of task to attach clone task
|
||||
* @param bool|int<0,1> $clone_change_dt recalculate date of task regarding new project start date
|
||||
* @param bool|int<0,1> $clone_affectation clone affectation of project
|
||||
* @param bool|int<0,1> $clone_time clone time of project
|
||||
* @param bool|int<0,1> $clone_file clone file of project
|
||||
* @param bool|int<0,1> $clone_note clone note of project
|
||||
* @param bool|int<0,1> $clone_prog clone progress of project
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone(User $user, $fromid, $project_id, $parent_task_id, $clone_change_dt = false, $clone_affectation = false, $clone_time = false, $clone_file = false, $clone_note = false, $clone_prog = false)
|
||||
|
|
|
|||
|
|
@ -1513,7 +1513,7 @@ if (!empty($arrayfields['s.name_alias']['checked'])) {
|
|||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['co.country_code']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['co.country_code']['label'], $_SERVER["PHP_SELF"], "co.country_code", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['co.country_code']['label'], $_SERVER["PHP_SELF"], "country.code", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['commercial']['checked'])) {
|
||||
|
|
@ -1889,7 +1889,7 @@ while ($i < $imaxinloop) {
|
|||
}
|
||||
// Country code
|
||||
if (!empty($arrayfields['co.country_code']['checked'])) {
|
||||
print '<td class="tdoverflowmax125">';
|
||||
print '<td class="tdoverflowmax125 center">';
|
||||
print $obj->country_code;
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2014-2015 Florian HENRY <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015-2021 Laurent Destailleur <ldestailleur@users.sourceforge.net>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -134,6 +134,7 @@ if (!$mesg) {
|
|||
}
|
||||
|
||||
|
||||
$px2 = null;
|
||||
if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) {
|
||||
// Build graphic amount of object
|
||||
$data = $stats_project->getAmountByMonthWithPrevYear($endyear, $startyear);
|
||||
|
|
@ -170,6 +171,7 @@ if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) {
|
|||
}
|
||||
}
|
||||
|
||||
$px3 = null;
|
||||
if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) {
|
||||
// Build graphic with transformation rate
|
||||
$data = $stats_project->getWeightedAmountByMonthWithPrevYear($endyear, $startyear, 0, 0);
|
||||
|
|
@ -326,7 +328,7 @@ if ($mesg) {
|
|||
} else {
|
||||
$stringtoshow .= $px1->show();
|
||||
$stringtoshow .= "<br>\n";
|
||||
if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) {
|
||||
if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') && $px2 !== null && $px3 !== null) {
|
||||
//$stringtoshow .= $px->show();
|
||||
//$stringtoshow .= "<br>\n";
|
||||
$stringtoshow .= $px2->show();
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -172,25 +172,25 @@ if (GETPOSTISSET('planned_workloadhour') || GETPOSTISSET('planned_workloadmin'))
|
|||
|
||||
// Definition of fields for list
|
||||
$arrayfields = array(
|
||||
't.ref' => array('label' => "RefTask", 'checked' => 1, 'position' => 1),
|
||||
't.label' => array('label' => "LabelTask", 'checked' => 1, 'position' => 2),
|
||||
't.description' => array('label' => "Description", 'checked' => 0, 'position' => 3),
|
||||
't.dateo' => array('label' => "DateStart", 'checked' => 1, 'position' => 4),
|
||||
't.datee' => array('label' => "Deadline", 'checked' => 1, 'position' => 5),
|
||||
't.planned_workload' => array('label' => "PlannedWorkload", 'checked' => 1, 'position' => 6),
|
||||
't.duration_effective' => array('label' => "TimeSpent", 'checked' => 1, 'position' => 7),
|
||||
't.progress_calculated' => array('label' => "ProgressCalculated", 'checked' => 1, 'position' => 8),
|
||||
't.progress' => array('label' => "ProgressDeclared", 'checked' => 1, 'position' => 9),
|
||||
't.progress_summary' => array('label' => "TaskProgressSummary", 'checked' => 1, 'position' => 10),
|
||||
't.fk_statut' => array('label' => "Status", 'checked' => 1, 'position' => 11),
|
||||
't.budget_amount' => array('label' => "Budget", 'checked' => 0, 'position' => 12),
|
||||
'c.assigned' => array('label' => "TaskRessourceLinks", 'checked' => 1, 'position' => 13),
|
||||
't.ref' => array('label' => "RefTask", 'checked' => '1', 'position' => 1),
|
||||
't.label' => array('label' => "LabelTask", 'checked' => '1', 'position' => 2),
|
||||
't.description' => array('label' => "Description", 'checked' => '0', 'position' => 3),
|
||||
't.dateo' => array('label' => "DateStart", 'checked' => '1', 'position' => 4),
|
||||
't.datee' => array('label' => "Deadline", 'checked' => '1', 'position' => 5),
|
||||
't.planned_workload' => array('label' => "PlannedWorkload", 'checked' => '1', 'position' => 6),
|
||||
't.duration_effective' => array('label' => "TimeSpent", 'checked' => '1', 'position' => 7),
|
||||
't.progress_calculated' => array('label' => "ProgressCalculated", 'checked' => '1', 'position' => 8),
|
||||
't.progress' => array('label' => "ProgressDeclared", 'checked' => '1', 'position' => 9),
|
||||
't.progress_summary' => array('label' => "TaskProgressSummary", 'checked' => '1', 'position' => 10),
|
||||
't.fk_statut' => array('label' => "Status", 'checked' => '1', 'position' => 11),
|
||||
't.budget_amount' => array('label' => "Budget", 'checked' => '0', 'position' => 12),
|
||||
'c.assigned' => array('label' => "TaskRessourceLinks", 'checked' => '1', 'position' => 13),
|
||||
|
||||
);
|
||||
if ($object->usage_bill_time) {
|
||||
$arrayfields['t.tobill'] = array('label' => $langs->trans("TimeToBill"), 'checked' => 0, 'position' => 11);
|
||||
$arrayfields['t.billed'] = array('label' => $langs->trans("TimeBilled"), 'checked' => 0, 'position' => 12);
|
||||
$arrayfields['t.billable'] = array('label' => $langs->trans("Billable"), 'checked' => 1, 'position' => 13);
|
||||
$arrayfields['t.tobill'] = array('label' => $langs->trans("TimeToBill"), 'checked' => '0', 'position' => 11);
|
||||
$arrayfields['t.billed'] = array('label' => $langs->trans("TimeBilled"), 'checked' => '0', 'position' => 12);
|
||||
$arrayfields['t.billable'] = array('label' => $langs->trans("Billable"), 'checked' => '1', 'position' => 13);
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
|
|
@ -199,7 +199,7 @@ $extrafieldsobjectprefix = 'efpt.';
|
|||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
|
||||
// '@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
|
||||
|
|
@ -456,6 +456,7 @@ llxHeader("", $title, $help_url, '', 0, 0, '', '', '', 'mod-project page-card_ta
|
|||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
$param = '';
|
||||
$userWrite = 0;
|
||||
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$result = $object->fetch($id, $ref);
|
||||
|
|
@ -810,9 +811,9 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object-
|
|||
print '<tr><td class="fieldrequired">'.$langs->trans("ChildOfProjectTask").'</td><td>';
|
||||
print img_picto('', 'project', 'class="pictofixedwidth"');
|
||||
if ($projectoktoentertime) {
|
||||
$formother->selectProjectTasks(GETPOST('task_parent'), empty($projectid) ? $object->id : $projectid, 'task_parent', 0, 0, 1, 1, 0, '0,1', 'maxwidth500 widthcentpercentminusxx');
|
||||
$formother->selectProjectTasks(GETPOSTINT('task_parent'), empty($projectid) ? $object->id : $projectid, 'task_parent', 0, 0, 1, 1, 0, '0,1', 'maxwidth500 widthcentpercentminusxx');
|
||||
} else {
|
||||
$formother->selectProjectTasks(GETPOST('task_parent'), empty($projectid) ? $object->id : $projectid, 'task_parent', 0, 0, 1, 1, 0, '', 'maxwidth500 widthcentpercentminusxx');
|
||||
$formother->selectProjectTasks(GETPOSTINT('task_parent'), empty($projectid) ? $object->id : $projectid, 'task_parent', 0, 0, 1, 1, 0, '', 'maxwidth500 widthcentpercentminusxx');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
|
@ -822,12 +823,12 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object-
|
|||
print '<tr><td>'.$langs->trans("AffectedTo").'</td><td>';
|
||||
print img_picto('', 'user', 'class="pictofixedwidth"');
|
||||
if (is_array($contactsofproject) && count($contactsofproject)) {
|
||||
print $form->select_dolusers($user->id, 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, '', 'maxwidth500 widthcentpercentminusx');
|
||||
print $form->select_dolusers($user->id, 'userid', 0, null, 0, '', $contactsofproject, '0', 0, 0, '', 0, '', 'maxwidth500 widthcentpercentminusx');
|
||||
} else {
|
||||
if ((isset($projectid) && $projectid > 0) || $object->id > 0) {
|
||||
print '<span class="opacitymedium">'.$langs->trans("NoUserAssignedToTheProject").'</span>';
|
||||
} else {
|
||||
print $form->select_dolusers($user->id, 'userid', 0, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth500 widthcentpercentminusx');
|
||||
print $form->select_dolusers($user->id, 'userid', 0, null, 0, '', '', '0', 0, 0, '', 0, '', 'maxwidth500 widthcentpercentminusx');
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
|
@ -942,7 +943,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object-
|
|||
// Get list of tasks in tasksarray and taskarrayfiltered
|
||||
// We need all tasks (even not limited to a user because a task to user can have a parent that is not affected to him).
|
||||
$filteronthirdpartyid = $socid;
|
||||
$tasksarray = $taskstatic->getTasksArray(0, 0, $object->id, $filteronthirdpartyid, 0, '', -1, $morewherefilter, 0, 0, $extrafields, 1, $search_array_options, 1, 1, $sortfield, $sortorder);
|
||||
$tasksarray = $taskstatic->getTasksArray(null, null, $object->id, $filteronthirdpartyid, 0, '', '-1', $morewherefilter, 0, 0, $extrafields, 1, $search_array_options, 1, 1, $sortfield, $sortorder);
|
||||
|
||||
// We load also tasks limited to a particular user
|
||||
$tmpuser = new User($db);
|
||||
|
|
@ -950,7 +951,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object-
|
|||
$tmpuser->fetch($search_user_id);
|
||||
}
|
||||
|
||||
$tasksrole = ($tmpuser->id > 0 ? $taskstatic->getUserRolesForProjectsOrTasks(null, $tmpuser, $object->id, 0) : '');
|
||||
$tasksrole = ($tmpuser->id > 0 ? $taskstatic->getUserRolesForProjectsOrTasks(null, $tmpuser, (string) $object->id, 0) : '');
|
||||
//var_dump($tasksarray);
|
||||
//var_dump($tasksrole);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -76,7 +76,7 @@ $socid = 0;
|
|||
// Retrieve First Task ID of Project if withprojet is on to allow project prev next to work
|
||||
if (!empty($project_ref) && !empty($withproject)) {
|
||||
if ($projectstatic->fetch(0, $project_ref) > 0) {
|
||||
$objectsarray = $object->getTasksArray(0, 0, $projectstatic->id, $socid, 0);
|
||||
$objectsarray = $object->getTasksArray(null, null, $projectstatic->id, $socid, 0);
|
||||
if (count($objectsarray) > 0) {
|
||||
$id = $objectsarray[0]->id;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
* Copyright (C) 2006-2024 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -136,7 +137,7 @@ if ($action == 'deleteline' && $user->hasRight('projet', 'creer')) {
|
|||
// Retrieve First Task ID of Project if withprojet is on to allow project prev next to work
|
||||
if (!empty($project_ref) && !empty($withproject)) {
|
||||
if ($projectstatic->fetch(0, $project_ref) > 0) {
|
||||
$tasksarray = $object->getTasksArray(0, 0, $projectstatic->id, $socid, 0);
|
||||
$tasksarray = $object->getTasksArray(null, null, $projectstatic->id, $socid, 0);
|
||||
if (count($tasksarray) > 0) {
|
||||
$id = $tasksarray[0]->id;
|
||||
} else {
|
||||
|
|
@ -426,7 +427,7 @@ if ($id > 0 || !empty($ref)) {
|
|||
} else {
|
||||
$contactsofproject = $projectstatic->getListContactId('internal');
|
||||
}
|
||||
print $form->select_dolusers((GETPOSTISSET('userid') ? GETPOSTINT('userid') : $user->id), 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 1, $langs->trans("ResourceNotAssignedToProject"));
|
||||
print $form->select_dolusers((GETPOSTISSET('userid') ? GETPOSTINT('userid') : $user->id), 'userid', 0, null, 0, '', $contactsofproject, '0', 0, 0, '', 1, $langs->trans("ResourceNotAssignedToProject"));
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$formcompany->selectTypeContact($object, '', 'type', 'internal', 'position');
|
||||
|
|
@ -451,7 +452,7 @@ if ($id > 0 || !empty($ref)) {
|
|||
print '<td>';
|
||||
$contactofproject = $projectstatic->getListContactId('external');
|
||||
//print $form->selectcontacts($selectedCompany, '', 'contactid', 0, '', $contactofproject, 0, '', false, 0, 0);
|
||||
print $form->select_contact($selectedCompany, '', 'contactid', 0, '', $contactofproject, 0, 'maxwidth300 widthcentpercentminusx', true);
|
||||
print $form->select_contact($selectedCompany, '', 'contactid', 0, '', ''/* arg not used - $contactofproject */, 0, 'maxwidth300 widthcentpercentminusx', true);
|
||||
$nbofcontacts = $form->num;
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -94,7 +95,7 @@ $permissiontoadd = $user->hasRight('projet', 'creer'); // Used by the include of
|
|||
// Retrieve First Task ID of Project if withprojet is on to allow project prev next to work
|
||||
if (!empty($project_ref) && !empty($withproject)) {
|
||||
if ($projectstatic->fetch(0, $project_ref) > 0) {
|
||||
$tasksarray = $object->getTasksArray(0, 0, $projectstatic->id, $socid, 0);
|
||||
$tasksarray = $object->getTasksArray(null, null, $projectstatic->id, $socid, 0);
|
||||
if (count($tasksarray) > 0) {
|
||||
$id = $tasksarray[0]->id;
|
||||
$object->fetch($id);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -165,28 +165,28 @@ if (empty($user->socid)) {
|
|||
}
|
||||
|
||||
$arrayfields = array(
|
||||
't.ref' => array('label' => "RefTask", 'checked' => 1, 'position' => 50),
|
||||
't.fk_task_parent' => array('label' => "RefTaskParent", 'checked' => 0, 'position' => 70),
|
||||
't.label' => array('label' => "LabelTask", 'checked' => 1, 'position' => 75),
|
||||
't.description' => array('label' => "Description", 'checked' => 0, 'position' => 80),
|
||||
't.dateo' => array('label' => "DateStart", 'checked' => 1, 'position' => 100),
|
||||
't.datee' => array('label' => "Deadline", 'checked' => 1, 'position' => 101),
|
||||
'p.ref' => array('label' => "ProjectRef", 'checked' => 1, 'position' => 151),
|
||||
'p.title' => array('label' => "ProjectLabel", 'checked' => 0, 'position' => 152),
|
||||
's.nom' => array('label' => "ThirdParty", 'checked' => -1, 'csslist' => 'tdoverflowmax125', 'position' => 200),
|
||||
's.name_alias' => array('label' => "AliasNameShort", 'checked' => 0, 'csslist' => 'tdoverflowmax125', 'position' => 201),
|
||||
'p.fk_statut' => array('label' => "ProjectStatus", 'checked' => 1, 'position' => 205),
|
||||
't.planned_workload' => array('label' => "PlannedWorkload", 'checked' => 1, 'position' => 302),
|
||||
't.duration_effective' => array('label' => "TimeSpent", 'checked' => 1, 'position' => 303),
|
||||
't.progress_calculated' => array('label' => "ProgressCalculated", 'checked' => -1, 'position' => 304),
|
||||
't.progress' => array('label' => "ProgressDeclared", 'checked' => 1, 'position' => 305),
|
||||
't.progress_summary' => array('label' => "TaskProgressSummary", 'checked' => 1, 'position' => 306),
|
||||
't.budget_amount' => array('label' => "Budget", 'checked' => 0, 'position' => 307),
|
||||
't.fk_statut' => array('label' => "TaskStatus", 'checked' => 0, 'position' => 308),
|
||||
't.tobill' => array('label' => "TimeToBill", 'checked' => 0, 'position' => 310),
|
||||
't.billed' => array('label' => "TimeBilled", 'checked' => 0, 'position' => 311),
|
||||
't.datec' => array('label' => "DateCreation", 'checked' => 0, 'position' => 500),
|
||||
't.tms' => array('label' => "DateModificationShort", 'checked' => 0, 'position' => 501),
|
||||
't.ref' => array('label' => "RefTask", 'checked' => '1', 'position' => 50),
|
||||
't.fk_task_parent' => array('label' => "RefTaskParent", 'checked' => '0', 'position' => 70),
|
||||
't.label' => array('label' => "LabelTask", 'checked' => '1', 'position' => 75),
|
||||
't.description' => array('label' => "Description", 'checked' => '0', 'position' => 80),
|
||||
't.dateo' => array('label' => "DateStart", 'checked' => '1', 'position' => 100),
|
||||
't.datee' => array('label' => "Deadline", 'checked' => '1', 'position' => 101),
|
||||
'p.ref' => array('label' => "ProjectRef", 'checked' => '1', 'position' => 151),
|
||||
'p.title' => array('label' => "ProjectLabel", 'checked' => '0', 'position' => 152),
|
||||
's.nom' => array('label' => "ThirdParty", 'checked' => '-1', 'csslist' => 'tdoverflowmax125', 'position' => 200),
|
||||
's.name_alias' => array('label' => "AliasNameShort", 'checked' => '0', 'csslist' => 'tdoverflowmax125', 'position' => 201),
|
||||
'p.fk_statut' => array('label' => "ProjectStatus", 'checked' => '1', 'position' => 205),
|
||||
't.planned_workload' => array('label' => "PlannedWorkload", 'checked' => '1', 'position' => 302),
|
||||
't.duration_effective' => array('label' => "TimeSpent", 'checked' => '1', 'position' => 303),
|
||||
't.progress_calculated' => array('label' => "ProgressCalculated", 'checked' => '-1', 'position' => 304),
|
||||
't.progress' => array('label' => "ProgressDeclared", 'checked' => '1', 'position' => 305),
|
||||
't.progress_summary' => array('label' => "TaskProgressSummary", 'checked' => '1', 'position' => 306),
|
||||
't.budget_amount' => array('label' => "Budget", 'checked' => '0', 'position' => 307),
|
||||
't.fk_statut' => array('label' => "TaskStatus", 'checked' => '0', 'position' => 308),
|
||||
't.tobill' => array('label' => "TimeToBill", 'checked' => '0', 'position' => 310),
|
||||
't.billed' => array('label' => "TimeBilled", 'checked' => '0', 'position' => 311),
|
||||
't.datec' => array('label' => "DateCreation", 'checked' => '0', 'position' => 500),
|
||||
't.tms' => array('label' => "DateModificationShort", 'checked' => '0', 'position' => 501),
|
||||
//'t.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
|
||||
);
|
||||
// Extra fields
|
||||
|
|
@ -194,7 +194,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
|||
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
|
||||
// '@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
|
||||
|
||||
$permissiontoread = $user->hasRight('projet', 'lire');
|
||||
$permissiontocreate = $user->hasRight('projet', 'creer');
|
||||
|
|
@ -296,10 +296,10 @@ $morejs = array();
|
|||
$morecss = array();
|
||||
|
||||
if ($search_project_user > 0) {
|
||||
$puser->fetch($search_project_user);
|
||||
$puser->fetch((int) $search_project_user);
|
||||
}
|
||||
if ($search_task_user > 0) {
|
||||
$tuser->fetch($search_task_user);
|
||||
$tuser->fetch((int) $search_task_user);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -802,7 +802,7 @@ if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) {
|
|||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$tmptitle = $langs->trans('ProjectCategories');
|
||||
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('project', $search_categ, 'search_categ', 1, $tmptitle, 'maxwidth300');
|
||||
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('project', (int) $search_categ, 'search_categ', 1, $tmptitle, 'maxwidth300');
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
|
||||
|
|
@ -813,7 +813,7 @@ $includeonly = '';
|
|||
if (!$user->hasRight('user', 'user', 'lire')) {
|
||||
$includeonly = array($user->id);
|
||||
}
|
||||
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user : '', 'search_project_user', $tmptitle, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth250');
|
||||
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user : '', 'search_project_user', $tmptitle, null, 0, $includeonly, '', '0', 0, 0, '', 0, '', 'maxwidth250');
|
||||
$moreforfilter .= '</div>';
|
||||
|
||||
// If the user can view users
|
||||
|
|
@ -823,7 +823,7 @@ $includeonly = '';
|
|||
if (!$user->hasRight('user', 'user', 'lire')) {
|
||||
$includeonly = array($user->id);
|
||||
}
|
||||
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_task_user, 'search_task_user', $tmptitle, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth250');
|
||||
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_task_user, 'search_task_user', $tmptitle, null, 0, $includeonly, '', '0', 0, 0, '', 0, '', 'maxwidth250');
|
||||
$moreforfilter .= '</div>';
|
||||
|
||||
// Filter on customer categories
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -83,7 +84,7 @@ if ($id > 0 || !empty($ref)) {
|
|||
// Retrieve First Task ID of Project if withprojet is on to allow project prev next to work
|
||||
if (!empty($project_ref) && !empty($withproject)) {
|
||||
if ($projectstatic->fetch(0, $project_ref) > 0) {
|
||||
$tasksarray = $object->getTasksArray(0, 0, $projectstatic->id, $socid, 0);
|
||||
$tasksarray = $object->getTasksArray(null, null, $projectstatic->id, $socid, 0);
|
||||
if (count($tasksarray) > 0) {
|
||||
$id = $tasksarray[0]->id;
|
||||
$object->fetch($id);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Vincent de Grandpré <vincent@de-grandpre.quebec>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -633,7 +633,7 @@ if ($id > 0 || !empty($ref)) {
|
|||
'name' => 'task_origin',
|
||||
'label' => $langs->trans('MergeOriginTask'),
|
||||
'type' => 'other',
|
||||
'value' => $formproject->selectTasks(-1, '', 'task_origin', 24, 0, $langs->trans('SelectTask'), 0, 0, 0, 'maxwidth500 minwidth200', '', '', null, 1)
|
||||
'value' => $formproject->selectTasks(-1, 0, 'task_origin', 24, 0, $langs->trans('SelectTask'), 0, 0, 0, 'maxwidth500 minwidth200', '', '', null, 1)
|
||||
)
|
||||
);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id.(GETPOST('withproject') ? "&withproject=1" : ""), $langs->trans("MergeTasks"), $langs->trans("ConfirmMergeTasks"), "confirm_merge", $formquestion, 'yes', 1, 250);
|
||||
|
|
@ -830,7 +830,7 @@ if ($id > 0 || !empty($ref)) {
|
|||
$htmltoenteralink = $tmparray['htmltoenteralink'];
|
||||
print $htmltoenteralink;
|
||||
|
||||
$compatibleImportElementsList = false;
|
||||
$compatibleImportElementsList = array();
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList);
|
||||
|
||||
print '</div><div class="fichehalfright">';
|
||||
|
|
|
|||
|
|
@ -378,10 +378,10 @@ if ($action == 'confirm_deleteline' && $confirm == "yes" && ($user->hasRight('pr
|
|||
}
|
||||
}
|
||||
|
||||
// Retrieve First Task ID of Project if withprojet is on to allow project prev next to work
|
||||
// Retrieve First Task ID of Project if withproject is on to allow project prev next to work
|
||||
if (!empty($project_ref) && !empty($withproject)) {
|
||||
if ($projectstatic->fetch(0, $project_ref) > 0) {
|
||||
$tasksarray = $object->getTasksArray(0, 0, $projectstatic->id, $socid, 0);
|
||||
$tasksarray = $object->getTasksArray(null, null, $projectstatic->id, $socid, 0);
|
||||
if (count($tasksarray) > 0) {
|
||||
$id = $tasksarray[0]->id;
|
||||
} else {
|
||||
|
|
@ -410,6 +410,7 @@ if (GETPOSTINT('projectid') > 0) {
|
|||
$result = $projectstatic->fetch($object->fk_project);
|
||||
}
|
||||
// If not task selected and no project selected
|
||||
$allprojectforuser = 0;
|
||||
if ($id <= 0 && $projectidforalltimes == 0) {
|
||||
$allprojectforuser = $user->id;
|
||||
}
|
||||
|
|
@ -495,7 +496,7 @@ if ($action == 'confirm_generateinvoice') {
|
|||
$arrayoftasks[$object->timespent_fk_user][(int) $object->timespent_fk_product]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm);
|
||||
}
|
||||
|
||||
foreach ($arrayoftasks as $userid => $data) {
|
||||
foreach ($arrayoftasks as $userid => $data) { // @phan-suppress-current-line PhanEmptyForeach
|
||||
$fuser->fetch($userid);
|
||||
$username = $fuser->getFullName($langs);
|
||||
|
||||
|
|
@ -563,7 +564,7 @@ if ($action == 'confirm_generateinvoice') {
|
|||
}
|
||||
|
||||
// Add lines
|
||||
$lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username) . ' : ' . $qtyhourtext, $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), $remiseproject);
|
||||
$lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username) . ' : ' . $qtyhourtext, $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), (float) $remiseproject);
|
||||
if ($lineid < 0) {
|
||||
$error++;
|
||||
setEventMessages(null, $tmpinvoice->errors, 'errors');
|
||||
|
|
@ -662,7 +663,7 @@ if ($action == 'confirm_generateinvoice') {
|
|||
}
|
||||
$idprodline = $value['fk_product'];
|
||||
}
|
||||
$lineid = $tmpinvoice->addline($value['note'], $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), $remiseproject);
|
||||
$lineid = $tmpinvoice->addline($value['note'], $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), (float) $remiseproject);
|
||||
if ($lineid < 0) {
|
||||
$error++;
|
||||
setEventMessages(null, $tmpinvoice->errors, 'errors');
|
||||
|
|
@ -683,13 +684,13 @@ if ($action == 'confirm_generateinvoice') {
|
|||
$arrayoftasks = array();
|
||||
foreach ($toselect as $key => $value) {
|
||||
// Get userid, timepent
|
||||
$object->fetchTimeSpent($value); // Call method to get list of timespent for a timespent line id (We use the utiliy method found into Task object)
|
||||
$object->fetchTimeSpent($value); // Call method to get list of timespent for a timespent line id (We use the utility method found into Task object)
|
||||
// $object->id is now the task id
|
||||
$arrayoftasks[$object->id][(int) $object->timespent_fk_product]['timespent'] += $object->timespent_duration;
|
||||
$arrayoftasks[$object->id][(int) $object->timespent_fk_product]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm);
|
||||
}
|
||||
|
||||
foreach ($arrayoftasks as $task_id => $data) {
|
||||
foreach ($arrayoftasks as $task_id => $data) { // @phan-suppress-current-line PhanEmptyForeach
|
||||
$ftask = new Task($db);
|
||||
$ftask->fetch($task_id);
|
||||
|
||||
|
|
@ -760,7 +761,7 @@ if ($action == 'confirm_generateinvoice') {
|
|||
$date_start = '';
|
||||
$date_end = '';
|
||||
$lineName = $ftask->ref . ' - ' . $ftask->label;
|
||||
$lineid = $tmpinvoice->addline($lineName, $pu_ht_for_task, price2num($qtyhour / $prodDurationHours, 'MS'), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), $remiseproject, $date_start, $date_end, 0, 0, '', 'HT', 0, 1, -1, 0, '', 0, 0, null, $pa_ht);
|
||||
$lineid = $tmpinvoice->addline($lineName, (float) $pu_ht_for_task, (float) price2num($qtyhour / $prodDurationHours, 'MS'), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), (float) $remiseproject, $date_start, $date_end, 0, 0, 0, 'HT', 0, 1, -1, 0, '', 0, 0, 0, $pa_ht);
|
||||
if ($lineid < 0) {
|
||||
$error++;
|
||||
setEventMessages($tmpinvoice->error, $tmpinvoice->errors, 'errors');
|
||||
|
|
@ -1281,30 +1282,30 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||
|
||||
// Definition of fields for list
|
||||
$arrayfields = array();
|
||||
$arrayfields['t.element_date'] = array('label' => $langs->trans("Date"), 'checked' => 1);
|
||||
$arrayfields['p.fk_soc'] = array('label' => $langs->trans("ThirdParty"), 'type' => 'integer:Societe:/societe/class/societe.class.php:1','checked' => 1);
|
||||
$arrayfields['t.element_date'] = array('label' => $langs->trans("Date"), 'checked' => '1');
|
||||
$arrayfields['p.fk_soc'] = array('label' => $langs->trans("ThirdParty"), 'type' => 'integer:Societe:/societe/class/societe.class.php:1','checked' => '1');
|
||||
$arrayfields['s.name_alias'] = array('label' => $langs->trans("AliasNameShort"), 'type' => 'integer:Societe:/societe/class/societe.class.php:1');
|
||||
if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) { // Not a dedicated task
|
||||
if (! empty($allprojectforuser)) {
|
||||
$arrayfields['p.project_ref'] = ['label' => $langs->trans('RefProject'), 'checked' => 1];
|
||||
$arrayfields['p.project_label'] = ['label' => $langs->trans('ProjectLabel'), 'checked' => 1];
|
||||
$arrayfields['p.project_ref'] = ['label' => $langs->trans('RefProject'), 'checked' => '1'];
|
||||
$arrayfields['p.project_label'] = ['label' => $langs->trans('ProjectLabel'), 'checked' => '1'];
|
||||
}
|
||||
$arrayfields['t.element_ref'] = array('label' => $langs->trans("RefTask"), 'checked' => 1);
|
||||
$arrayfields['t.element_label'] = array('label' => $langs->trans("LabelTask"), 'checked' => 1);
|
||||
$arrayfields['t.element_ref'] = array('label' => $langs->trans("RefTask"), 'checked' => '1');
|
||||
$arrayfields['t.element_label'] = array('label' => $langs->trans("LabelTask"), 'checked' => '1');
|
||||
}
|
||||
$arrayfields['author'] = array('label' => $langs->trans("By"), 'checked' => 1);
|
||||
$arrayfields['t.note'] = array('label' => $langs->trans("Note"), 'checked' => 1);
|
||||
$arrayfields['author'] = array('label' => $langs->trans("By"), 'checked' => '1');
|
||||
$arrayfields['t.note'] = array('label' => $langs->trans("Note"), 'checked' => '1');
|
||||
if (isModEnabled('service') && !empty($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0 && $projectstatic->usage_bill_time) {
|
||||
$arrayfields['t.fk_product'] = array('label' => $langs->trans("Product"), 'checked' => 1);
|
||||
$arrayfields['t.fk_product'] = array('label' => $langs->trans("Product"), 'checked' => '1');
|
||||
}
|
||||
$arrayfields['t.element_duration'] = array('label' => $langs->trans("Duration"), 'checked' => 1);
|
||||
$arrayfields['value'] = array('label' => $langs->trans("Value"), 'checked' => 1, 'enabled' => isModEnabled("salaries"));
|
||||
$arrayfields['valuebilled'] = array('label' => $langs->trans("Billed"), 'checked' => 1, 'enabled' => (((getDolGlobalInt('PROJECT_HIDE_TASKS') || !getDolGlobalInt('PROJECT_BILL_TIME_SPENT')) ? 0 : 1) && $projectstatic->usage_bill_time));
|
||||
$arrayfields['t.element_duration'] = array('label' => $langs->trans("Duration"), 'checked' => '1');
|
||||
$arrayfields['value'] = array('label' => $langs->trans("Value"), 'checked' => '1', 'enabled' => (string) (int) isModEnabled("salaries"));
|
||||
$arrayfields['valuebilled'] = array('label' => $langs->trans("Billed"), 'checked' => '1', 'enabled' => (string) (int) (((getDolGlobalInt('PROJECT_HIDE_TASKS') || !getDolGlobalInt('PROJECT_BILL_TIME_SPENT')) ? 0 : 1) && $projectstatic->usage_bill_time));
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
|
||||
// '@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
|
||||
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
|
|
@ -1478,7 +1479,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||
print $langs->trans('ServiceToUseOnLines');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$form->select_produits('', 'productid', '1', 0, $projectstatic->thirdparty->price_level, 1, 2, '', 0, array(), $projectstatic->thirdparty->id, 'None', 0, 'maxwidth500');
|
||||
$form->select_produits(0, 'productid', '1', 0, $projectstatic->thirdparty->price_level, 1, 2, '', 0, array(), $projectstatic->thirdparty->id, 'None', 0, 'maxwidth500');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
|
@ -1625,7 +1626,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||
$sql .= " AND t.fk_element =".((int) $object->id);
|
||||
} elseif (!empty($projectidforalltimes)) {
|
||||
// Limit on one project
|
||||
$sql .= " AND pt.fk_projet IN (" . $db->sanitize($projectidforalltimes) . ")";
|
||||
$sql .= " AND pt.fk_projet IN (" . $db->sanitize((string) $projectidforalltimes) . ")";
|
||||
} elseif (!empty($allprojectforuser)) {
|
||||
// Limit on on user
|
||||
if (empty($search_user)) {
|
||||
|
|
@ -1819,7 +1820,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||
$nboftasks = 0;
|
||||
if (empty($id)) {
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
$nboftasks = $formproject->selectTasks(-1, GETPOSTINT('taskid'), 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, 'progress');
|
||||
$nboftasks = $formproject->selectTasks(-1, GETPOSTINT('taskid'), 'taskid', 0, 0, '1', 1, 0, 0, 'maxwidth300', (string) $projectstatic->id, 'progress');
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
|
@ -1837,7 +1838,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||
if ($projectstatic->public) {
|
||||
$contactsofproject = array();
|
||||
}
|
||||
print $form->select_dolusers((GETPOSTINT('userid') ? GETPOSTINT('userid') : $userid), 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, $langs->trans("ResourceNotAssignedToProject"), 'minwidth150imp maxwidth200');
|
||||
print $form->select_dolusers((GETPOSTINT('userid') ? GETPOSTINT('userid') : $userid), 'userid', 0, null, 0, '', $contactsofproject, '0', 0, 0, '', 0, $langs->trans("ResourceNotAssignedToProject"), 'minwidth150imp maxwidth200');
|
||||
} else {
|
||||
if ($nboftasks) {
|
||||
print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . ' ' . $langs->trans('FirstAddRessourceToAllocateTime');
|
||||
|
|
@ -1967,7 +1968,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||
}
|
||||
// Author
|
||||
if (!empty($arrayfields['author']['checked'])) {
|
||||
print '<td class="liste_titre">'.$form->select_dolusers(($search_user > 0 ? $search_user : -1), 'search_user', 1, null, 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth125').'</td>';
|
||||
print '<td class="liste_titre">'.$form->select_dolusers(($search_user > 0 ? $search_user : -1), 'search_user', 1, null, 0, '', '', '0', 0, 0, '', 0, '', 'maxwidth125').'</td>';
|
||||
}
|
||||
// Note
|
||||
if (!empty($arrayfields['t.note']['checked'])) {
|
||||
|
|
@ -2228,6 +2229,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||
|
||||
// Thirdparty alias
|
||||
if (!empty($arrayfields['s.name_alias']['checked'])) {
|
||||
$valtoshow = '';
|
||||
if ($task_time->fk_soc > 0) {
|
||||
if (empty($conf->cache['thirdparty'][$task_time->fk_soc])) {
|
||||
$tmpsociete = new Societe($db);
|
||||
|
|
@ -2285,7 +2287,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||
if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) { // Not a dedicated task
|
||||
print '<td class="nowrap">';
|
||||
if ($action == 'editline' && GETPOSTINT('lineid') == $task_time->rowid) {
|
||||
$formproject->selectTasks(-1, GETPOSTINT('taskid') ? GETPOSTINT('taskid') : $task_time->fk_element, 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth250', $projectstatic->id, '');
|
||||
$formproject->selectTasks(-1, GETPOSTINT('taskid') ? GETPOSTINT('taskid') : $task_time->fk_element, 'taskid', 0, 0, '1', 1, 0, 0, 'maxwidth250', (string) $projectstatic->id, '');
|
||||
} else {
|
||||
$tasktmp->id = $task_time->fk_element;
|
||||
$tasktmp->ref = $task_time->ref;
|
||||
|
|
@ -2633,7 +2635,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||
}
|
||||
if (count($contactsoftask) > 0) {
|
||||
print img_object('', 'user', 'class="hideonsmartphone"');
|
||||
print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, '', 0, '', $contactsoftask);
|
||||
print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, null, 0, '', $contactsoftask);
|
||||
} else {
|
||||
print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . $langs->trans('FirstAddRessourceToAllocateTime');
|
||||
}
|
||||
|
|
@ -2798,7 +2800,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||
}
|
||||
if (count($contactsoftask) > 0) {
|
||||
print img_object('', 'user', 'class="hideonsmartphone"');
|
||||
print $form->select_dolusers($task_time->fk_user, 'userid_line_2', 0, '', 0, '', $contactsoftask);
|
||||
print $form->select_dolusers($task_time->fk_user, 'userid_line_2', 0, null, 0, '', $contactsoftask);
|
||||
} else {
|
||||
print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . $langs->trans('FirstAddRessourceToAllocateTime');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -52,6 +52,10 @@ require '../../main.inc.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
/**
|
||||
* @var DoliDB $db
|
||||
* @var Translate $langs
|
||||
*/
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('member')) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2021 Dorian Vabre <dorian.vabre@gmail.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -86,7 +86,7 @@ $dateend = dol_mktime(23, 59, 59, GETPOSTINT('dateendmonth'), GETPOSTINT('dateen
|
|||
$id = GETPOST('id');
|
||||
|
||||
$project = new Project($db);
|
||||
$resultproject = $project->fetch($id);
|
||||
$resultproject = $project->fetch((int) $id);
|
||||
if ($resultproject < 0) {
|
||||
$error++;
|
||||
$errmsg .= $project->error;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2021 Dorian Vabre <dorian.vabre@gmail.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -86,7 +86,7 @@ $dateend = dol_mktime(23, 59, 59, GETPOSTINT('dateendmonth'), GETPOSTINT('dateen
|
|||
$id = GETPOST('id');
|
||||
|
||||
$project = new Project($db);
|
||||
$resultproject = $project->fetch($id);
|
||||
$resultproject = $project->fetch((int) $id);
|
||||
if ($resultproject < 0) {
|
||||
$error++;
|
||||
$errmsg .= $project->error;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2021 Dorian Vabre <dorian.vabre@gmail.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -97,7 +98,7 @@ $listofvotes = explode(',', $_SESSION["savevotes"]);
|
|||
$urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost.
|
||||
|
||||
$project = new Project($db);
|
||||
$resultproject = $project->fetch($id);
|
||||
$resultproject = $project->fetch((int) $id);
|
||||
if ($resultproject < 0) {
|
||||
$error++;
|
||||
$errmsg .= $project->error;
|
||||
|
|
|
|||
|
|
@ -888,7 +888,7 @@ if ($action == 'create') {
|
|||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Project").'</td><td colspan="2">';
|
||||
print img_picto('', 'project', 'class="paddingright"');
|
||||
print $formproject->select_projects((!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500');
|
||||
print $formproject->select_projects((!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $soc->id : -1), (string) $projectid, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500');
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -245,7 +245,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref .= $formproject->select_projects($object->socid, (string) $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref .= '</form>';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -345,7 +345,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref .= $formproject->select_projects($object->socid, (string) $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref .= '</form>';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) 2023 Maxime Nicolas <maxime@oarces.com>
|
||||
* Copyright (C) 2023 Benjamin GREMBI <benjamin@oarces.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -615,7 +615,7 @@ if ($action == 'create' && $permissiontoadd) {
|
|||
|
||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||
print img_picto('', 'project', 'class="pictofixedwidth"');
|
||||
print $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 1);
|
||||
print $formproject->select_projects(-1, (string) $projectid, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -19,6 +19,7 @@
|
|||
* @var Canvas $this
|
||||
* @var Conf $conf
|
||||
* @var CommonObject $this
|
||||
* @var DoliDB $db
|
||||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2933,7 +2933,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
|
|||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
|
||||
$morehtmlref = '<a href="'.DOL_URL_ROOT.'/societe/vcard.php?id='.$object->id.'" class="refid">';
|
||||
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
|
||||
$morehtmlref .= '</a>';
|
||||
|
||||
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', $morehtmlref);
|
||||
|
||||
// Call Hook tabContentViewThirdparty
|
||||
$parameters = array();
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@
|
|||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -125,7 +126,7 @@ if (!$user->hasRight('societe', 'contact', 'lire')) {
|
|||
* Actions
|
||||
*/
|
||||
|
||||
$parameters = array('id'=>$socid, 'objcanvas'=>$objcanvas);
|
||||
$parameters = array('id' => $socid, 'objcanvas' => $objcanvas);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
|
@ -205,7 +206,11 @@ print dol_get_fiche_head($head, 'contact', $langs->trans("ThirdParty"), 0, 'comp
|
|||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', '', '', 0, '', '', 1);
|
||||
$morehtmlref = '<a href="'.DOL_URL_ROOT.'/societe/vcard.php?id='.$socid.'" class="refid">';
|
||||
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
|
||||
$morehtmlref .= '</a>';
|
||||
|
||||
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', $morehtmlref, '', 0, '', '', 1);
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
|
|
|||
120
htdocs/societe/vcard.php
Normal file
120
htdocs/societe/vcard.php
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/societe/vcard.php
|
||||
* \ingroup societe
|
||||
* \brief Third party vcard download
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/vcard.class.php';
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
* @var HookManager $hookmanager
|
||||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*/
|
||||
|
||||
$company = new Societe($db);
|
||||
|
||||
|
||||
$socid = GETPOSTINT('id');
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'societe', $socid, '&societe');
|
||||
|
||||
|
||||
$result = $company->fetch($socid);
|
||||
if ($result <= 0) {
|
||||
dol_print_error($db, $company->error);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// Compute VCard
|
||||
$v = new vCard();
|
||||
$v->setProdId('Dolibarr '.DOL_VERSION);
|
||||
|
||||
$v->setUid('DOLIBARR-THIRDPARTYID-'.$company->id);
|
||||
|
||||
|
||||
// Data from company
|
||||
if (!empty($company->url)) {
|
||||
$v->setURL($company->url, "TYPE=WORK");
|
||||
}
|
||||
if (!empty($company->phone)) {
|
||||
$v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE");
|
||||
}
|
||||
if (!empty($company->phone_mobile)) {
|
||||
$v->setPhoneNumber($company->phone_mobile, "TYPE=CELL;VOICE");
|
||||
}
|
||||
if (!empty($company->fax)) {
|
||||
$v->setPhoneNumber($company->fax, "TYPE=WORK;FAX");
|
||||
}
|
||||
$v->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK;POSTAL");
|
||||
if (!empty(trim($company->email))) {
|
||||
$v->setEmail($company->email);
|
||||
}
|
||||
|
||||
// If the company is not a private person
|
||||
if ($company->typent_code != 'TE_PRIVATE') {
|
||||
$v->setOrg($company->name);
|
||||
$v->filename = $company->name.'.vcf';
|
||||
|
||||
$v->setFormattedName($company->name.(!empty($company->name_alias) ? ' ('.$company->name_alias.')' : ''));
|
||||
} else {
|
||||
$civility = (string) $company->civility_code;
|
||||
if (!empty($civility)) {
|
||||
$transKey = "Civility".$civility;
|
||||
$trans = $langs->transnoentitiesnoconv($transKey);
|
||||
if ($trans !== $transKey) {
|
||||
$civility = $trans;
|
||||
}
|
||||
}
|
||||
$v->setName($company->lastname, $company->firstname, "", $civility, "");
|
||||
$v->setFormattedName($company->getFullName($langs));
|
||||
}
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
// Send the vCard to the web client
|
||||
|
||||
$output = $v->getVCard();
|
||||
|
||||
$filename = trim(urldecode($v->getFileName())); // "Nom prenom.vcf"
|
||||
$filenameurlencoded = dol_sanitizeFileName(urlencode($filename));
|
||||
//$filename = dol_sanitizeFileName($filename);
|
||||
|
||||
|
||||
header("Content-Disposition: attachment; filename=\"".$filename."\"");
|
||||
header("Content-Length: ".dol_strlen($output));
|
||||
header("Connection: close");
|
||||
header("Content-Type: text/x-vcard; name=\"".$filename."\"");
|
||||
|
||||
print $output;
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2021 Thibault FOUCART <support@ptibogxiv.net>
|
||||
* Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -364,7 +364,7 @@ if (isModEnabled('project')) {
|
|||
print img_picto('', 'project', 'class="pictofixedwidth"');
|
||||
// select_projects($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 16, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $morecss = '', $htmlid = '', $morefilter = '')
|
||||
$projectid = getDolGlobalInt('CASHDESK_ID_PROJECT'.$terminaltouse);
|
||||
print $formproject->select_projects(-1, $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 1, 'maxwidth500 widthcentpercentminusxx');
|
||||
print $formproject->select_projects(-1, (string) $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 1, 'maxwidth500 widthcentpercentminusxx');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
|||
$category = GETPOST('category', 'alphanohtml'); // Can be id of category or 'supplements'
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$term = GETPOST('term', 'alpha');
|
||||
$search_term = GETPOST('search_term', 'alpha');
|
||||
$id = GETPOSTINT('id');
|
||||
$search_start = GETPOSTINT('search_start');
|
||||
$search_limit = GETPOSTINT('search_limit');
|
||||
|
|
@ -130,11 +131,11 @@ if ($action == 'getProducts' && $user->hasRight('takepos', 'run')) {
|
|||
} else {
|
||||
echo 'Failed to load category with id='.dol_escape_htmltag($category);
|
||||
}
|
||||
} elseif ($action == 'search' && $term != '' && $user->hasRight('takepos', 'run')) {
|
||||
} elseif ($action == 'search' && $search_term != '' && $user->hasRight('takepos', 'run')) {
|
||||
top_httphead('application/json');
|
||||
|
||||
// Search barcode into thirdparties. If found, it means we want to change thirdparties.
|
||||
$result = $thirdparty->fetch('', '', '', $term);
|
||||
$result = $thirdparty->fetch('', '', '', $search_term);
|
||||
|
||||
if ($result && $thirdparty->id > 0) {
|
||||
$rows = array();
|
||||
|
|
@ -187,7 +188,7 @@ if ($action == 'getProducts' && $user->hasRight('takepos', 'run')) {
|
|||
|
||||
$barcode_value_list = array();
|
||||
$barcode_offset = 0;
|
||||
$barcode_length = dol_strlen($term);
|
||||
$barcode_length = dol_strlen($search_term);
|
||||
if ($barcode_length == $barcode_char_nb) {
|
||||
$rows = array();
|
||||
|
||||
|
|
@ -195,7 +196,7 @@ if ($action == 'getProducts' && $user->hasRight('takepos', 'run')) {
|
|||
foreach ($barcode_rules_list as $barcode_rule_arr) {
|
||||
$code = $barcode_rule_arr['code'];
|
||||
$char_nb = $barcode_rule_arr['char_nb'];
|
||||
$barcode_value_list[$code] = substr($term, $barcode_offset, $char_nb);
|
||||
$barcode_value_list[$code] = substr($search_term, $barcode_offset, $char_nb);
|
||||
$barcode_offset += $char_nb;
|
||||
}
|
||||
|
||||
|
|
@ -209,7 +210,7 @@ if ($action == 'getProducts' && $user->hasRight('takepos', 'run')) {
|
|||
$sql .= " AND EXISTS (SELECT cp.fk_product FROM " . $db->prefix() . "categorie_product as cp WHERE cp.fk_product = p.rowid AND cp.fk_categorie IN (".$db->sanitize($filteroncategids)."))";
|
||||
}
|
||||
$sql .= " AND tosell = 1";
|
||||
$sql .= " AND (barcode IS NULL OR barcode <> '" . $db->escape($term) . "')";
|
||||
$sql .= " AND (barcode IS NULL OR barcode <> '" . $db->escape($search_term) . "')";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql && $db->num_rows($resql) == 1) {
|
||||
|
|
@ -249,7 +250,7 @@ if ($action == 'getProducts' && $user->hasRight('takepos', 'run')) {
|
|||
'label' => $obj->label,
|
||||
'tosell' => $obj->tosell,
|
||||
'tobuy' => $obj->tobuy,
|
||||
'barcode' => $term, // there is only one product matches the barcode rule and so the term is considered as the barcode of this product
|
||||
'barcode' => $search_term, // there is only one product matches the barcode rule and so the term is considered as the barcode of this product
|
||||
'price' => empty($objProd->multiprices[$pricelevel]) ? $obj->price : $objProd->multiprices[$pricelevel],
|
||||
'price_ttc' => empty($objProd->multiprices_ttc[$pricelevel]) ? $obj->price_ttc : $objProd->multiprices_ttc[$pricelevel],
|
||||
'object' => 'product',
|
||||
|
|
@ -317,7 +318,7 @@ if ($action == 'getProducts' && $user->hasRight('takepos', 'run')) {
|
|||
if (getDolGlobalInt('TAKEPOS_PRODUCT_IN_STOCK') == 1 && getDolGlobalInt('CASHDESK_ID_WAREHOUSE'.$_SESSION['takeposterminal'])) {
|
||||
$sql .= ' AND ps.reel > 0';
|
||||
}
|
||||
$sql .= natural_search(array('ref', 'label', 'barcode'), $term);
|
||||
$sql .= natural_search(array('ref', 'label', 'barcode'), $search_term);
|
||||
// Add where from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters);
|
||||
|
|
|
|||
|
|
@ -750,7 +750,7 @@ function Search2(keyCodeForEnter, moreorless) {
|
|||
pageproducts = 0;
|
||||
jQuery(".wrapper2 .catwatermark").hide();
|
||||
var nbsearchresults = 0;
|
||||
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&token=<?php echo newToken();?>&term=' + search_term + '&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&search_start=' + search_start + '&search_limit=' + search_limit, function (data) {
|
||||
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&token=<?php echo newToken();?>&search_term=' + search_term + '&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&search_start=' + search_start + '&search_limit=' + search_limit, function (data) {
|
||||
for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) {
|
||||
if (typeof (data[i]) == "undefined") {
|
||||
$("#prowatermark" + i).html("");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/* Copyright (C) 2006-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2016 Ion Agorria <ion@agorria.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -385,7 +385,7 @@ function getProject($authentication, $id = '', $ref = '')
|
|||
|
||||
if ($fuser->hasRight('projet', 'lire')) {
|
||||
$project = new Project($db);
|
||||
$result = $project->fetch($id, $ref);
|
||||
$result = $project->fetch((int) $id, $ref);
|
||||
if ($result > 0) {
|
||||
$project_result_fields = array(
|
||||
'id' => $project->id,
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ if (!defined('DISABLE_JS_GRAHP')) {
|
|||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/website/lib/website.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/website2.lib.php';
|
||||
|
|
@ -265,6 +266,8 @@ $filereadme = $pathofwebsite.'/README.md';
|
|||
$filelicense = $pathofwebsite.'/LICENSE';
|
||||
$filemaster = $pathofwebsite.'/master.inc.php';
|
||||
|
||||
$forceCSP = getDolGlobalString("WEBSITE_".$object->id."_SECURITY_FORCECSP");
|
||||
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
|
|
@ -1939,6 +1942,124 @@ if ($action == 'updatecss' && $usercanedit) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == "updatesecurity" && $usercanedit && GETPOST("btn_WEBSITE_SECURITY_FORCECSP")) {
|
||||
$directivecsp = GETPOST("select_identifier_WEBSITE_SECURITY_FORCECSP");
|
||||
$sourcecsp = GETPOST("select_source_WEBSITE_SECURITY_FORCECSP");
|
||||
$sourcedatacsp = GETPOST("input_data_WEBSITE_SECURITY_FORCECSP");
|
||||
|
||||
$forceCSPArr = websiteGetContentPolicyToArray($forceCSP);
|
||||
$directivesarray = websiteGetContentPolicyDirectives();
|
||||
$sourcesarray = websiteGetContentPolicySources();
|
||||
if (empty($directivecsp)) {
|
||||
$error++;
|
||||
}
|
||||
if ($error || (isset($sourcecsp) && $directivesarray[$directivecsp]["data-directivetype"] != "none")) {
|
||||
$error++;
|
||||
}
|
||||
if (!$error) {
|
||||
$directivetype = $directivesarray[$directivecsp]["data-directivetype"];
|
||||
if (isset($sourcecsp)) {
|
||||
$sourcetype = $sourcesarray[$directivetype][$sourcecsp]["data-sourcetype"];
|
||||
}
|
||||
$securityspstring = "";
|
||||
if (isset($sourcetype) && $sourcetype == "data") {
|
||||
if (empty($forceCSPArr[$directivecsp]["data"])) {
|
||||
$forceCSPArr[$directivecsp]["data"] = array();
|
||||
}
|
||||
$forceCSPArr[$directivecsp]["data"][] = $sourcedatacsp;
|
||||
} elseif (isset($sourcetype) && $sourcetype == "input") {
|
||||
if (empty($forceCSPArr[$directivecsp])) {
|
||||
$forceCSPArr[$directivecsp] = array();
|
||||
}
|
||||
$forceCSPArr[$directivecsp] = array_merge(explode(" ", $sourcedatacsp), $forceCSPArr[$directivecsp]);
|
||||
} else {
|
||||
if (empty($forceCSPArr[$directivecsp])) {
|
||||
$forceCSPArr[$directivecsp] = array();
|
||||
}
|
||||
if (!isset($sourcecsp)) {
|
||||
$sourcecsp = "";
|
||||
}
|
||||
array_unshift($forceCSPArr[$directivecsp], $sourcecsp);
|
||||
}
|
||||
foreach ($forceCSPArr as $directive => $sourcekeys) {
|
||||
if ($securityspstring != "") {
|
||||
$securityspstring .= "; ";
|
||||
}
|
||||
$sourcestring = "";
|
||||
foreach ($sourcekeys as $key => $source) {
|
||||
if (is_array($source)) {
|
||||
$sourcestring .= " data: ". implode(" ", $source);
|
||||
} else {
|
||||
$directivetype = $directivesarray[$directive]["data-directivetype"];
|
||||
$sourcetype = $sourcesarray[$directivetype][$source]["data-sourcetype"];
|
||||
if (isset($sourcetype) && $sourcetype == "quoted") {
|
||||
$sourcestring .= " '".$source."'";
|
||||
} elseif ($directivetype != "none") {
|
||||
$sourcestring .= " ".$source;
|
||||
}
|
||||
}
|
||||
}
|
||||
$securityspstring .= $directive . $sourcestring;
|
||||
}
|
||||
$res = dolibarr_set_const($db, 'WEBSITE_'.$object->id.'_SECURITY_FORCECSP', $securityspstring, 'chaine', 0, '', $conf->entity);
|
||||
if ($res <= 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SecurityPolicySucesfullyAdded"), null, 'mesgs');
|
||||
} else {
|
||||
$db->rollback();
|
||||
setEventMessages($langs->trans("ErrorAddingSecurityPolicy"), null, 'errors');
|
||||
}
|
||||
header("Location: ".$_SERVER["PHP_SELF"].'?websiteid='.$websiteid."&action=editsecurity");
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($action == "updatesecurity" && $usercanedit) {
|
||||
$db->begin();
|
||||
$res1 = $res2 = $res3 = $res4 = 0;
|
||||
$securityrp = GETPOST('WEBSITE_'.$object->id.'_SECURITY_FORCERP', 'alpha');
|
||||
$securitysts = GETPOST('WEBSITE_'.$object->id.'_SECURITY_FORCESTS', 'alpha');
|
||||
$securitypp = GETPOST('WEBSITE_'.$object->id.'_SECURITY_FORCEPP', 'alpha');
|
||||
$securitysp = GETPOST('WEBSITE_'.$object->id.'_SECURITY_FORCECSP', 'alpha');
|
||||
|
||||
if (!empty($securityrp)) {
|
||||
$res1 = dolibarr_set_const($db, 'WEBSITE_'.$object->id.'_SECURITY_FORCERP', $securityrp, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (!empty($securitysts)) {
|
||||
$res2 = dolibarr_set_const($db, 'WEBSITE_'.$object->id.'_SECURITY_FORCESTS', $securitysts, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (!empty($securitypp)) {
|
||||
$res3 = dolibarr_set_const($db, 'WEBSITE_'.$object->id.'_SECURITY_FORCEPP', $securitypp, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (!empty($securitysp)) {
|
||||
$res4 = dolibarr_set_const($db, 'WEBSITE_'.$object->id.'_SECURITY_FORCECSP', $securitysp, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
if ($res1 >= 0 && $res2 >= 0 && $res3 >= 0 && $res4 >= 0 ) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("Saved"), null, 'mesgs');
|
||||
} else {
|
||||
$db->rollback();
|
||||
setEventMessages($langs->trans("ErrorSavingChanges"), null, 'errors');
|
||||
}
|
||||
|
||||
if (!GETPOSTISSET('updateandstay')) { // If we click on "Save And Stay", we don not make the redirect
|
||||
$action = 'preview';
|
||||
if ($backtopage) {
|
||||
$backtopage = preg_replace('/searchstring=[^&]*/', '', $backtopage); // Clean backtopage url
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$action = 'editsecurity';
|
||||
$forceCSP = getDolGlobalString("WEBSITE_".$object->id."_SECURITY_FORCECSP");
|
||||
}
|
||||
}
|
||||
|
||||
// Update page
|
||||
if ($action == 'setashome' && $usercanedit) {
|
||||
$db->begin();
|
||||
|
|
@ -2859,6 +2980,85 @@ if ($action == 'generatesitemaps' && $usercanedit) {
|
|||
$action = 'preview';
|
||||
}
|
||||
|
||||
if ($action == 'removecspsource' && $usercanedit) {
|
||||
$db->begin();
|
||||
|
||||
$sourcetype = "";
|
||||
$sourcecsp = explode("_", GETPOST("sourcecsp"));
|
||||
$directive = $sourcecsp[0];
|
||||
$sourcekey = !empty($sourcecsp[1]) ? $sourcecsp[1] : null;
|
||||
$sourcedata = !empty($sourcecsp[2]) ? $sourcecsp[2] : null;
|
||||
$forceCSPArr = websiteGetContentPolicyToArray($forceCSP);
|
||||
$directivesarray = websiteGetContentPolicyDirectives();
|
||||
$sourcesarray = websiteGetContentPolicySources();
|
||||
if (empty($directive)) {
|
||||
$error++;
|
||||
}
|
||||
if ($error || (!isset($sourcekey) && $directivesarray[$directive]["data-directivetype"] != "none")) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$directivetype = (string) $directivesarray[$directive]["data-directivetype"];
|
||||
if (isset($sourcekey)) {
|
||||
$sourcetype = $sourcesarray[$directivetype][$sourcekey]["data-sourcetype"];
|
||||
}
|
||||
|
||||
$securityspstring = "";
|
||||
if (!$error && !empty($forceCSPArr)) {
|
||||
if (isset($sourcekey) && !empty($forceCSPArr[$directive][$sourcekey])) {
|
||||
if ($sourcetype == "data") {
|
||||
$keydata = array_search($sourcedata, $forceCSPArr[$directive][$sourcekey]);
|
||||
if ($keydata !== false) {
|
||||
unset($forceCSPArr[$directive][$sourcekey][$keydata]);
|
||||
}
|
||||
if (count($forceCSPArr[$directive][$sourcekey]) == 0) {
|
||||
unset($forceCSPArr[$directive][$sourcekey]);
|
||||
}
|
||||
} else {
|
||||
unset($forceCSPArr[$directive][$sourcekey]);
|
||||
}
|
||||
}
|
||||
if (count($forceCSPArr[$directive]) == 0) {
|
||||
unset($forceCSPArr[$directive]);
|
||||
}
|
||||
foreach ($forceCSPArr as $directive => $sourcekeys) {
|
||||
if ($securityspstring != "") {
|
||||
$securityspstring .= "; ";
|
||||
}
|
||||
$sourcestring = "";
|
||||
foreach ($sourcekeys as $key => $source) {
|
||||
if (is_array($source)) {
|
||||
$sourcestring .= " data: ". implode(" ", $source);
|
||||
} else {
|
||||
$directivetype = $directivesarray[$directive]["data-directivetype"];
|
||||
$sourcetype = $sourcesarray[$directivetype][$source]["data-sourcetype"];
|
||||
if ($sourcetype == "quoted") {
|
||||
$sourcestring .= " '".$source."'";
|
||||
} else {
|
||||
$sourcestring .= " ".$source;
|
||||
}
|
||||
}
|
||||
}
|
||||
$securityspstring .= $directive . $sourcestring;
|
||||
}
|
||||
$res = dolibarr_set_const($db, 'WEBSITE_'.$object->id.'_SECURITY_FORCECSP', $securityspstring, 'chaine', 0, '', $conf->entity);
|
||||
if ($res <= 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SecurityPolicySucesfullyRemoved"), null, 'mesgs');
|
||||
} else {
|
||||
$db->rollback();
|
||||
setEventMessages($langs->trans("ErrorRemovingSecurityPolicy"), null, 'errors');
|
||||
}
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"].'?websiteid='.$websiteid."&action=editsecurity");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
|
|
@ -2944,6 +3144,9 @@ if ($action == 'file_manager') {
|
|||
if ($mode) {
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
}
|
||||
if ($action == 'editsecurity') {
|
||||
print '<input type="hidden" name="action" value="updatesecurity">';
|
||||
}
|
||||
|
||||
print '<div>'."\n";
|
||||
|
||||
|
|
@ -3256,8 +3459,8 @@ if (!GETPOST('hide_websitemenu')) {
|
|||
print '</span>';
|
||||
}
|
||||
|
||||
if (in_array($action, array('editcss', 'editmenu', 'file_manager', 'replacesiteconfirm')) || in_array($mode, array('replacesite'))) {
|
||||
if ($action == 'editcss') {
|
||||
if (in_array($action, array('editcss', 'editmenu', 'file_manager', 'replacesiteconfirm', 'editsecurity')) || in_array($mode, array('replacesite'))) {
|
||||
if ($action == 'editcss' || $action == 'editsecurity') {
|
||||
// accesskey is for Windows or Linux: ALT + key for chrome, ALT + SHIFT + KEY for firefox
|
||||
// accesskey is for Mac: CTRL + key for all browsers
|
||||
$stringforfirstkey = $langs->trans("KeyboardShortcut");
|
||||
|
|
@ -3288,8 +3491,8 @@ if (!GETPOST('hide_websitemenu')) {
|
|||
// Toolbar for pages
|
||||
//
|
||||
|
||||
if ($websitekey && $websitekey != '-1' && (!in_array($action, array('editcss', 'editmenu', 'importsite', 'file_manager', 'replacesite', 'replacesiteconfirm'))) && (!in_array($mode, array('replacesite'))) && !$file_manager) {
|
||||
print '</div>'."\n"; // Close current websitebar to open a new one
|
||||
if ($websitekey && $websitekey != '-1' && (!in_array($action, array('editcss', 'editmenu', 'importsite', 'file_manager', 'replacesite', 'replacesiteconfirm', 'editsecurity'))) && (!in_array($mode, array('replacesite'))) && !$file_manager) {
|
||||
print '</div>'; // Close current websitebar to open a new one
|
||||
|
||||
print '<!-- Toolbar for websitepage -->';
|
||||
print '<div class="centpercent websitebar"'.($style ? ' style="'.$style.'"' : '').'>'."\n";
|
||||
|
|
@ -3752,7 +3955,7 @@ if (!GETPOST('hide_websitemenu')) {
|
|||
|
||||
// TODO Add js to save alias like we save virtual host name and use dynamic virtual host for url of id=previewpageext
|
||||
}
|
||||
if (!in_array($mode, array('replacesite')) && !in_array($action, array('editcss', 'editmenu', 'file_manager', 'replacesiteconfirm', 'createsite', 'createcontainer', 'createfromclone', 'createpagefromclone', 'deletesite'))) {
|
||||
if (!in_array($mode, array('replacesite')) && !in_array($action, array('editcss', 'editmenu', 'file_manager', 'replacesiteconfirm', 'createsite', 'createcontainer', 'createfromclone', 'createpagefromclone', 'deletesite', 'editsecurity'))) {
|
||||
if ($action == 'editsource' || $action == 'editmeta') {
|
||||
// accesskey is for Windows or Linux: ALT + key for chrome, ALT + SHIFT + KEY for firefox
|
||||
// accesskey is for Mac: CTRL + key for all browsers
|
||||
|
|
@ -3967,7 +4170,8 @@ if ($action == 'editcss') {
|
|||
//$readmecontent.="";
|
||||
//}
|
||||
|
||||
print dol_get_fiche_head();
|
||||
$head = websiteconfigPrepareHead($object);
|
||||
print dol_get_fiche_head($head, 'general', $langs->trans("General"), 0, 'website');
|
||||
|
||||
print '<!-- Edit Website properties -->'."\n";
|
||||
print '<table class="border centpercent">';
|
||||
|
|
@ -4164,6 +4368,144 @@ if ($action == 'editcss') {
|
|||
print '<br>';
|
||||
}
|
||||
|
||||
if ($action == 'editsecurity') {
|
||||
$selectarrayCSPDirectives = websiteGetContentPolicyDirectives();
|
||||
$selectarrayCSPSources = websiteGetContentPolicySources();
|
||||
$forceCSPArr = websiteGetContentPolicyToArray($forceCSP);
|
||||
print '<div class="fiche">';
|
||||
print '<br>';
|
||||
|
||||
$head = websiteconfigPrepareHead($object);
|
||||
print dol_get_fiche_head($head, 'security', $langs->trans("General"), 0, 'website');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td></td>'."\n";
|
||||
print '</tr>';
|
||||
|
||||
// Force RP
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans('WebsiteSecurityForceRP').'</td>';
|
||||
print '<td><input class="minwidth500" name="WEBSITE_'.$object->id.'_SECURITY_FORCERP" id="WEBSITE_'.$object->id.'_SECURITY_FORCERP" value="'.getDolGlobalString("WEBSITE_".$object->id."_SECURITY_FORCERP").'"></td>';
|
||||
print '</tr>';
|
||||
// Force STS
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans('WebsiteSecurityForceSTS').'</td>';
|
||||
print '<td><input class="minwidth500" name="WEBSITE_'.$object->id.'_SECURITY_FORCESTS" id="WEBSITE_'.$object->id.'_SECURITY_FORCESTS" value="'.getDolGlobalString("WEBSITE_".$object->id."_SECURITY_FORCESTS").'"></td>';
|
||||
print '</tr>';
|
||||
// Force PP
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans('WebsiteSecurityForcePP').'</td>';
|
||||
print '<td><input class="minwidth500" name="WEBSITE_'.$object->id.'_SECURITY_FORCEPP" id="WEBSITE_'.$object->id.'_SECURITY_FORCEPP" value="'.getDolGlobalString("WEBSITE_".$object->id."_SECURITY_FORCEPP").'"></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
// Content Security Policy
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="centpercent">';
|
||||
print '<tr><td>'.$langs->trans("ContentSecurityPolicy").'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Value").':</span></td><td colspan=2><input style="width:90%;" class="minwidth500" name="WEBSITE_'.$object->id.'_SECURITY_FORCECSP" id="WEBSITE_'.$object->id.'_SECURITY_FORCECSP" value="'.$forceCSP.'"></td></tr>';
|
||||
|
||||
print '<tr><td></td></tr>';
|
||||
|
||||
print '<tr><td></td>';
|
||||
print '<td>'.$form->selectarray("select_identifier_WEBSITE_SECURITY_FORCECSP", $selectarrayCSPDirectives, "select_identifier_WEBSITE_SECURITY_FORCECSP", 1, 0, 0, '', 0, 0, 0, '', 'minwidth300').'</td>';
|
||||
print '<td>';
|
||||
print '<input type="hidden" id="select_source_WEBSITE_SECURITY_FORCECSP" name="select_source_WEBSITE_SECURITY_FORCECSP">';
|
||||
foreach ($selectarrayCSPSources as $key => $values) {
|
||||
print '<div class="div_WEBSITE_SECURITY_FORCECSP hidden" id="div_'.$key.'_WEBSITE_SECURITY_FORCECSP">';
|
||||
print $form->selectarray("select_".$key."_WEBSITE_SECURITY_FORCECSP", $values, "select_".$key."_WEBSITE_SECURITY_FORCECSP", 1, 0, 0, '', 0, 0, 0, '', 'minwidth300 select_WEBSITE_SECURITY_FORCECSP');
|
||||
print '</div>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td><div class="div_input_data_WEBSITE_SECURITY_FORCECSP hidden"><input id="input_data_WEBSITE_SECURITY_FORCECSP" name="input_data_WEBSITE_SECURITY_FORCECSP"></div></td>';
|
||||
print '<td><div class="div_btn_class_WEBSITE_SECURITY_FORCECSP hidden"><input type="submit" id="btn_WEBSITE_SECURITY_FORCECSP" name="btn_WEBSITE_SECURITY_FORCECSP" class="butAction" value="'.$langs->trans("Add").'"></div></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
// Content Security Policy list of selected rules
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<ul>';
|
||||
foreach ($forceCSPArr as $directive => $sources) {
|
||||
print '<li><span>'.$directive.'</span>';
|
||||
if (!empty($sources)) {
|
||||
print '<ul>';
|
||||
foreach ($sources as $key => $source) {
|
||||
if (is_array($source)) {
|
||||
print '<li><span>'.$key.'</span>';
|
||||
print '<ul>';
|
||||
foreach ($source as $keysource => $sourcedata) {
|
||||
print '<li><span>'.$sourcedata.'</span> <a href="'.$_SERVER["PHP_SELF"].'?websiteid='.$websiteid.'&action=removecspsource&sourcecsp='.$directive.'_'.$key.'_'.$sourcedata.'&token='.newToken().'">'.img_delete().'</a></li>';
|
||||
}
|
||||
print '</ul>';
|
||||
print '</li>';
|
||||
} else {
|
||||
print '<li><span>'.$source.'</span> <a href="'.$_SERVER["PHP_SELF"].'?websiteid='.$websiteid.'&action=removecspsource&sourcecsp='.$directive.'_'.$key.'&token='.newToken().'">'.img_delete().'</a></li>';
|
||||
}
|
||||
}
|
||||
print '</ul>';
|
||||
} else {
|
||||
print ' <a href="'.$_SERVER["PHP_SELF"].'?websiteid='.$websiteid.'&action=removecspsource&sourcecsp='.$directive.'&token='.newToken().'">'.img_delete().'</a>';
|
||||
}
|
||||
print '</li>';
|
||||
}
|
||||
print '</ul>';
|
||||
print '</div>';
|
||||
|
||||
print '<script>
|
||||
$(document).ready(function() {
|
||||
$("#select_identifier_WEBSITE_SECURITY_FORCECSP").on("change", function() {
|
||||
key = $(this).find(":selected").data("directivetype");
|
||||
console.log("We hide all select div");
|
||||
$(".div_WEBSITE_SECURITY_FORCECSP").hide();
|
||||
$(".select_WEBSITE_SECURITY_FORCECSP").val(null).trigger("change");
|
||||
$(".div_input_data_WEBSITE_SECURITY_FORCECSP").hide();
|
||||
$(".div_btn_class_WEBSITE_SECURITY_FORCECSP").hide();
|
||||
if (key == "none"){
|
||||
$(".div_btn_class_WEBSITE_SECURITY_FORCECSP").show();
|
||||
} else {
|
||||
console.log("We show div select with key "+key);
|
||||
$("#div_"+key+"_WEBSITE_SECURITY_FORCECSP").show();
|
||||
}
|
||||
});
|
||||
|
||||
$(".select_WEBSITE_SECURITY_FORCECSP").on("change", function() {
|
||||
keysource = $(this).find(":selected").data("sourcetype");
|
||||
$("#select_source_WEBSITE_SECURITY_FORCECSP").val($(this).val());
|
||||
console.log("We hide and show fields");
|
||||
if (keysource == "data" || keysource == "input") {
|
||||
$(".div_input_data_WEBSITE_SECURITY_FORCECSP").show();
|
||||
} else {
|
||||
$("#input_data_WEBSITE_SECURITY_FORCECSP").val("");
|
||||
$(".div_input_data_WEBSITE_SECURITY_FORCECSP").hide();
|
||||
if (keysource != undefined) {
|
||||
$(".div_btn_class_WEBSITE_SECURITY_FORCECSP").show();
|
||||
} else {
|
||||
$(".div_btn_class_WEBSITE_SECURITY_FORCECSP").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("#input_data_WEBSITE_SECURITY_FORCECSP").on("change", function(){
|
||||
if ($(this).val() != undefined) {
|
||||
console.log("We show add button");
|
||||
$(".div_btn_class_WEBSITE_SECURITY_FORCECSP").show();
|
||||
} else {
|
||||
console.log("We hide add button");
|
||||
$(".div_btn_class_WEBSITE_SECURITY_FORCECSP").hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'createsite') {
|
||||
print '<div class="fiche">';
|
||||
|
|
|
|||
254
htdocs/website/lib/website.lib.php
Normal file
254
htdocs/website/lib/website.lib.php
Normal file
|
|
@ -0,0 +1,254 @@
|
|||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/website/lib/website.lib.php
|
||||
* \ingroup website
|
||||
* \brief Library files with common functions for WebsiteAccount
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Prepare array of tabs for Website
|
||||
*
|
||||
* @param Website $object Website
|
||||
* @return array<array{0:string,1:string,2:string}> Array of tabs
|
||||
*/
|
||||
function websiteconfigPrepareHead($object)
|
||||
{
|
||||
global $db, $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/website/index.php?websiteid='.$object->id.'&action=editcss';
|
||||
$head[$h][1] = $langs->trans("General");
|
||||
$head[$h][2] = 'general';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/website/index.php?websiteid='.$object->id.'&action=editsecurity';
|
||||
$head[$h][1] = $langs->trans("Security");
|
||||
$head[$h][2] = 'security';
|
||||
$h++;
|
||||
|
||||
/*if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) {
|
||||
$nbNote = 0;
|
||||
if(!empty($object->fields['note_private'])) $nbNote++;
|
||||
if(!empty($object->fields['note_public'])) $nbNote++;
|
||||
$head[$h][0] = dol_buildpath('/monmodule/websiteaccount_note.php', 1).'?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
if ($nbNote > 0) $head[$h][1].= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}*/
|
||||
|
||||
/*
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->monmodule->dir_output . "/websiteaccount/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = dol_buildpath("/monmodule/websiteaccount_document.php", 1).'?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>' : '');
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = dol_buildpath("/monmodule/websiteaccount_agenda.php", 1).'?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Events");
|
||||
$head[$h][2] = 'agenda';
|
||||
$h++;
|
||||
*/
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
//$this->tabs = array(
|
||||
// 'entity:+tabname:Title:@monmodule:/monmodule/mypage.php?id=__ID__'
|
||||
//); // to add new tab
|
||||
//$this->tabs = array(
|
||||
// 'entity:-tabname:Title:@monmodule:/monmodule/mypage.php?id=__ID__'
|
||||
//); // to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'websiteaccount@website');
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'websiteaccount@website', 'remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare array of directives for Website
|
||||
*
|
||||
* @return array<string,array<string,string>> Array of directives
|
||||
*/
|
||||
function websiteGetContentPolicyDirectives()
|
||||
{
|
||||
return array(
|
||||
// Fetch directives
|
||||
"child-src" => array("label" => "child-src", "data-directivetype" => "fetch"),
|
||||
"connect-src" => array("label" => "connect-src", "data-directivetype" => "fetch"),
|
||||
"default-src" => array("label" => "default-src", "data-directivetype" => "fetch"),
|
||||
"fenced-frame-src" => array("label" => "fenced-frame-src", "data-directivetype" => "fetch"),
|
||||
"font-src" => array("label" => "font-src", "data-directivetype" => "fetch"),
|
||||
"frame-src" => array("label" => "frame-src", "data-directivetype" => "fetch"),
|
||||
"img-src" => array("label" => "img-src", "data-directivetype" => "fetch"),
|
||||
"manifest-src" => array("label" => "manifest-src", "data-directivetype" => "fetch"),
|
||||
"media-src" => array("label" => "media-src", "data-directivetype" => "fetch"),
|
||||
"object-src" => array("label" => "object-src", "data-directivetype" => "fetch"),
|
||||
"prefetch-src" => array("label" => "prefetch-src", "data-directivetype" => "fetch"),
|
||||
"script-src" => array("label" => "script-src", "data-directivetype" => "fetch"),
|
||||
"script-src-elem" => array("label" => "script-src-elem", "data-directivetype" => "fetch"),
|
||||
"script-src-attr" => array("label" => "script-src-attr", "data-directivetype" => "fetch"),
|
||||
"style-src" => array("label" => "style-src","data-directivetype" => "fetch"),
|
||||
"style-src-elem" => array("label" => "style-src-elem", "data-directivetype" => "fetch"),
|
||||
"style-src-attr" => array("label" => "style-src-attr", "data-directivetype" => "fetch"),
|
||||
"worker-src" => array("label" => "worker-src", "data-directivetype" => "fetch"),
|
||||
// Document directives
|
||||
"base-uri" => array("label" => "base-uri", "data-directivetype" => "document"),
|
||||
"sandbox" => array("label" => "sandbox", "data-directivetype" => "document"),
|
||||
// Navigation directives
|
||||
"form-action" => array("label" => "form-action", "data-directivetype" => "navigation"),
|
||||
"frame-ancestors" => array("label" => "frame-ancestors", "data-directivetype" => "navigation"),
|
||||
// Reporting directives
|
||||
"report-to" => array("label" => "report-to", "data-directivetype" => "reporting"),
|
||||
// Other directives
|
||||
"require-trusted-types-for" => array("label" => "require-trusted-types-for", "data-directivetype" => "require-trusted-types-for"),
|
||||
"trusted-types" => array("label" => "trusted-types", "data-directivetype" => "trusted-types"),
|
||||
"upgrade-insecure-requests" => array("label" => "upgrade-insecure-requests", "data-directivetype" => "none"),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare array of sources for Website
|
||||
*
|
||||
* @return array<string,array<string,array<string,string>>> Array of sources
|
||||
*/
|
||||
function websiteGetContentPolicySources()
|
||||
{
|
||||
return array(
|
||||
// Fetch directives
|
||||
"fetch" => array(
|
||||
"*" => array("label" => "*", "data-sourcetype" => "select"),
|
||||
"data" => array("label" => "data", "data-sourcetype" => "data"),
|
||||
"self" => array("label" => "self", "data-sourcetype" => "quoted"),
|
||||
"unsafe-eval" => array("label" => "unsafe-eval", "data-sourcetype" => "quoted"),
|
||||
"wasm-unsafe-eval" => array("label" => "wasm-unsafe-eval", "data-sourcetype" => "quoted"),
|
||||
"unsafe-inline" => array("label" => "unsafe-inline", "data-sourcetype" => "quoted"),
|
||||
"unsafe-hashes" => array("label" => "unsafe-hashes", "data-sourcetype" => "quoted"),
|
||||
"inline-speculation-rules" => array("label" => "inline-speculation-rules", "data-sourcetype" => "quoted"),
|
||||
"strict-dynamic" => array("label" => "strict-dynamic", "data-sourcetype" => "quoted"),
|
||||
"report-sample" => array("label" => "report-sample", "data-sourcetype" => "quoted"),
|
||||
"host-source" => array("label" => "host-source", "data-sourcetype" => "input"),
|
||||
"scheme-source" => array("label" => "scheme-source", "data-sourcetype" => "input"),
|
||||
),
|
||||
// Document directives
|
||||
"document" => array(
|
||||
"none" => array("label" => "self", "data-sourcetype" => "quoted"),
|
||||
"self" => array("label" => "self", "data-sourcetype" => "quoted"),
|
||||
"host-source" => array("label" => "host-source", "data-sourcetype" => "input"),
|
||||
"scheme-source" => array("label" => "scheme-source", "data-sourcetype" => "input"),
|
||||
),
|
||||
// Navigation directives
|
||||
"navigation" => array(
|
||||
"none" => array("label" => "self", "data-sourcetype" => "quoted"),
|
||||
"self" => array("label" => "self", "data-sourcetype" => "quoted"),
|
||||
"host-source" => array("label" => "host-source", "data-sourcetype" => "input"),
|
||||
"scheme-source" => array("label" => "scheme-source", "data-sourcetype" => "input"),
|
||||
),
|
||||
// Reporting directives
|
||||
"reporting" => array(
|
||||
"report-to" => array("label" => "report-to", "data-sourcetype" => "input"),
|
||||
),
|
||||
// Other directives
|
||||
"require-trusted-types-for" => array(
|
||||
"script" => array("label" => "script", "data-sourcetype" => "select"),
|
||||
),
|
||||
"trusted-types" => array(
|
||||
"policyName" => array("label" => "policyName", "data-sourcetype" => "input"),
|
||||
"none" => array("label" => "none", "data-sourcetype" => "quoted"),
|
||||
"allow-duplicates" => array("label" => "allow-duplicates", "data-sourcetype" => "quoted"),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform a Content Security Policy to an array
|
||||
*
|
||||
* @param string $forceCSP Content security policy string
|
||||
* @return array<string,array<string|int,array<string|int,string>|string>> Array of sources
|
||||
*/
|
||||
function websiteGetContentPolicyToArray($forceCSP)
|
||||
{
|
||||
$forceCSPArr = array();
|
||||
$sourceCSPArr = websiteGetContentPolicySources();
|
||||
$sourceCSPArrflatten = array();
|
||||
|
||||
// We remove a level for sources array
|
||||
foreach ($sourceCSPArr as $key => $arr) {
|
||||
$sourceCSPArrflatten = array_merge($sourceCSPArrflatten, array_keys($arr));
|
||||
}
|
||||
$securitypolicies = explode(";", $forceCSP);
|
||||
|
||||
// Loop on each security policy to create an array
|
||||
foreach ($securitypolicies as $key => $securitypolicy) {
|
||||
if ($securitypolicy == "") {
|
||||
continue;
|
||||
}
|
||||
$securitypolicyarr = explode(" ", $securitypolicy);
|
||||
$directive = array_shift($securitypolicyarr);
|
||||
// Remove unwanted spaces
|
||||
while ($directive == "") {
|
||||
$directive = array_shift($securitypolicyarr);
|
||||
}
|
||||
if (empty($directive)) {
|
||||
continue;
|
||||
}
|
||||
$sources = $securitypolicyarr;
|
||||
$issourcedata = 0;
|
||||
if (empty($sources)) {
|
||||
$forceCSPArr[$directive] = array();
|
||||
} else {
|
||||
//Loop on each sources to add to the right directive array key
|
||||
foreach ($sources as $key2 => $source) {
|
||||
$source = str_replace(":", "", $source);
|
||||
$source = str_replace("'", "", $source);
|
||||
|
||||
if ($source == "data") {
|
||||
$issourcedata = 1;
|
||||
if (empty($forceCSPArr[$directive])) {
|
||||
$forceCSPArr[$directive] = array($source => array());
|
||||
} else {
|
||||
$forceCSPArr[$directive][$source] = array();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if ($issourcedata && !in_array($source, $sourceCSPArrflatten)) {
|
||||
$forceCSPArr[$directive]["data"][] = $source;
|
||||
} else {
|
||||
$issourcedata = 0;
|
||||
if (empty($forceCSPArr[$directive])) {
|
||||
$forceCSPArr[$directive] = array($source);
|
||||
} else {
|
||||
$forceCSPArr[$directive][] = $source;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $forceCSPArr;
|
||||
}
|
||||
Loading…
Reference in a new issue