Compare commits

...

345 Commits

Author SHA1 Message Date
Molkobain
6c4289a491 Tests: Rename file to match conventions 2023-02-17 15:33:09 +01:00
Eric Espie
8940051c3d N°5906 - CRUD Event - fire event EVENT_DB_LINKS_CHANGED when an n-n link is created/updated/deleted 2023-02-17 14:25:01 +01:00
Eric Espie
72dad5dd07 N°5891 - Make CSV import unit tests work 2023-02-16 16:14:37 +01:00
Molkobain
dc38db1c3d PHP 8.1: Reduce time interval to something more pragmatic for quicker test execution 2023-02-16 11:40:59 +01:00
Molkobain
45df1002ec N°5388 - PHP 8.2: Fix dynamic properties to standard declared properties 2023-02-15 23:02:40 +01:00
Molkobain
737388053f PHP 8.1: Fix FunctionExpression::Evaluate() "TO_DAYS" misalignment due to PHP 8.1 bug fix 2023-02-15 21:31:11 +01:00
dariocodes
d0b000d125 Update README.md to improve grammar
- Using hyphens to combine "web-based" ensures that the reader understands that it is a compound modifier.
- Adding a comma after "platform" helps to separate the list of items that follows and improve readability.
- Using commas to separate the list of items in the series (CMDB, helpdesk system, and document management tool) helps to clarify that each item is a distinct element.
- Fixed a typo where "adds-on" was written instead of "add-ons".
- Uses the wrong form of the verb "be." In this context, the correct form of the verb to use is "become," not "being." 
- Adding a comma after led is grammatically better as is referenced here: https://github.com/Combodo/combodo-workflow-graphical-view/pull/1
2023-02-15 18:02:54 +01:00
Eric Espie
1d0ce1862d N°4756 - Ease extensibility for CRUD operations : Event Service - Fix unit tests 2023-02-14 15:53:12 +01:00
Eric Espie
c0589715c1 N°4756 - Ease extensibility for CRUD operations : Event Service - Fix RegisterListener() signature and calls 2023-02-14 11:26:47 +01:00
Eric Espie
8b18fd7cc0 Merge remote-tracking branch 'origin/support/3.0' into develop 2023-02-14 09:35:59 +01:00
Eric Espie
9f81e4875a Merge branch 'hotfix/5944_GetClassesForInterface_filter' into support/3.0 2023-02-14 09:16:49 +01:00
Molkobain
33717b9610 N°5951 - Fix crash when creating a user with a non valid password
/!\ Mind that this could have impact on DoCheckToWrite() overloads for people using \DBObject::GetKey() instead of \DBObject::IsNew()
2023-02-13 20:22:39 +01:00
Molkobain
b97a464bb1 N°2783 - Initialize property correctly (highlighted by 58c0da7e) 2023-02-13 19:36:46 +01:00
Pierre Goiffon
58c0da7e87 N°2783 Fix setup crashing because of a php warning (#389) 2023-02-13 17:09:24 +01:00
Molkobain
4203382920 N°2783 - Add support for custom zlists (#389) 2023-02-13 16:13:51 +01:00
Molkobain
825e402dd6 N°5279 - Improve DBBackup::MakeName() unit test by evaluating placeholders 2023-02-13 15:57:29 +01:00
Molkobain
fa75c8964a Tests: Improve REST API tests robustness when output JSON is not always ordered the same (even though the content is semantically the same) 2023-02-13 10:27:28 +01:00
Pierre Goiffon
fc58c6f4ce N°4577 setup params : add itop-bridge-cmdb-services 2023-02-13 09:23:19 +01:00
Molkobain
ef4e38f6b9 Merge remote-tracking branch 'origin/support/3.0' into develop 2023-02-11 09:55:15 +01:00
Molkobain
4f102d764a Merge remote-tracking branch 'origin/support/2.7' into support/3.0 2023-02-10 23:18:37 +01:00
Molkobain
dbd58cfeb6 Tests: Force RestAPI unit tests not to verify SSL certificate as most dev / test envs are self-signed 2023-02-10 23:07:27 +01:00
Molkobain
1086eaaffe N°3190 - Fix XML conversion unit test 2023-02-10 22:37:24 +01:00
Molkobain
f7ee21f1d7 N°5279 - PHP 8.1: Migrate usages of deprecated strftime() function
In the end we made an adapter to keep using the strftime() format (https://www.php.net/manual/fr/function.strftime.php); not to ease migration but because we couldn't use \DateTime::format().
We can't use \DateTime::format() directly on the whole filename as it would also format characters that are not supposed to be. eg. "__DB__-Y-m-d-production" would become "itopdb-2023-02-09-+01:00Thu, 09 Feb 2023 11:34:01 +0100202309", mind the "production" part being converted.
2023-02-10 22:15:18 +01:00
Pierre Goiffon
35b0b16e20 N°4756 Add listenerId to register call for debug purposes 2023-02-10 17:31:48 +01:00
Pierre Goiffon
ca72ec736e N°4756 DBObject Rename Event* methods to FireEvent* 2023-02-10 15:22:33 +01:00
Pierre Goiffon
e63d66aa5d N°4756 Fix TypeError on EventData::$aCallbackData 2023-02-10 15:01:56 +01:00
bdalsass
2803f0be49 N°3190 - Add iTop design format compatibility converter
- Add converter for  for display_style property
- Update php unit test to control conversion
2023-02-10 13:47:10 +01:00
BenGrenoble
278b0d643f N°5968 - Add structural data for Brand, OSFamily and OSVersion
Refactor file model.itop-bridge-cmdb-services.php
2023-02-10 11:21:19 +01:00
vdumas
569045f675 N°5946 - Error in a french translation - user preference 2023-02-09 17:30:17 +01:00
vdumas
25989bc00f N°5947 - Typos in french translation for incident 2023-02-09 17:25:25 +01:00
vdumas
fc60759db5 N°5920 - Align icon, title and tooltip for extra tabs in standard DM 2023-02-09 17:13:07 +01:00
BenGrenoble
3a931ff79e N°5968 - Add structural data for Brand, OSFamily and OSVersion
Change path and correct osversion id
2023-02-09 11:32:57 +01:00
BenGrenoble
f6bd380ad0 N°5968 - Add structural data for Brand, OSFamily and OSVersion
Remove sample brand
2023-02-09 11:10:00 +01:00
BenGrenoble
97c4ecf8bc N°5968 - Add structural data for Brand, OSFamily and OSVersion
Correct brand id
2023-02-09 10:50:59 +01:00
BenGrenoble
5f4ef74d34 N°5968 - Add structural data for Brand, OSFamily and OSVersion
Move data to config-mgmt
2023-02-09 10:45:10 +01:00
BenGrenoble
6184dbafff N°4577 - Move service dependencies from "itop-bridge-cmdb-ticket" to another module 2023-02-09 10:32:39 +01:00
BenGrenoble
630c1dcdc8 N°5968 - Add structural data for Brand, Model, OSFamily and OSVersion 2023-02-09 09:59:06 +01:00
vdumas
cb84cbf7a8 N°5106 - Add Associated User tab on Person 2023-02-09 09:40:19 +01:00
vdumas
b025f86b21 N°5106 - Add Associated User tab on Person 2023-02-09 09:06:48 +01:00
vdumas
5a76175ec1 N°5908 - add a description on "known error" tab on UserRequest and Incident 2023-02-09 09:03:18 +01:00
vdumas
ce162f05da N°5908 - add a description on "known error" tab on UserRequest and Incident 2023-02-08 19:00:57 +01:00
Molkobain
d358c9e8fa N°5920 - Tab manager: Fallback on dict entry code convention (tab code followed by "+" sign) for tab's description / tooltip if none given 2023-02-08 18:23:20 +01:00
bdalsass
86a208a86d N°5904 - Use attribute linked set edit mode to enable actions in view (improvement) 2023-02-08 14:34:46 +01:00
vdumas
372888c7a7 N°5106 - Add Associated User tab on Person 2023-02-08 13:01:41 +01:00
Molkobain
547a520ab1 N°5951 - Temporary fix to unblock 3.1.0-alpha1, we need to discuss the DBObject::DBInsertNoReload() sequence before going further 2023-02-07 19:41:03 +01:00
Molkobain
8bf788dcb9 N°5904 - PHP 8.1: Migrate usage of deprecated FILTER_SANITIZE_STRING constant 2023-02-07 14:57:24 +01:00
Molkobain
a157e754a9 N°5074 - Clean up of dynamically created class properties due to bdb29fd99 2023-02-07 14:51:42 +01:00
Molkobain
eae84ab399 N°5074 - Clean up of dynamically created class properties due to bdb29fd99 2023-02-07 14:51:00 +01:00
Molkobain
4d4d3bd9a2 N°5904 - Fix crash when adding a 1:n link item in object edition 2023-02-07 14:35:49 +01:00
Benjamin Dalsass
9f9630d011 N°5904 - remove link as tagset add button 2023-02-07 09:42:41 +01:00
Benjamin Dalsass
de1c58a84c N°5904 - Use attribute linked set edit mode to enable actions in view 2023-02-06 17:22:30 +01:00
bdalsass
1fe9520b7e N°5904 - Use attribute linked set edit mode to enable actions (#440)
* Add corresponding buttons depending on old edit mode (need to check with piR pour récuperer l'ancienne valeur.

* N°5904 - Handle attribute linked set edit_mode

* N°5904 Move calls to private jquery widget methods to public

* N°5904 - Worker improvements add button on link tagset

* Change itop set widget to new set block UI (5)

* Change itop set widget to new set block UI (5)

* Renommage variables JS avec le prefix combodo

* Search dialog block id conflict with form id

* add moved js files in iTopWebPage compatibility list

---------

Co-authored-by: Stephen Abello <stephen.abello@combodo.com>
2023-02-06 16:07:55 +01:00
Stephen Abello
3fbc5e1ce0 N°5904 Hide decorative plus icon on attribute set edit 2023-02-06 14:24:44 +01:00
Molkobain
786e7d647c N°5388 - PHP 8.2: Fix partially supported callable 2023-02-03 23:01:24 +01:00
Eric Espie
99b7d66cf2 N°5944 - Wrong filter for utils::GetClassesForInterface() 2023-02-03 11:10:37 +01:00
Molkobain
1768274aaf N°5943 - Fix undefined array key "Remote" in AjaxRenderController.php with DokuWiki extension 2023-02-03 09:38:28 +01:00
Stephen Abello
7cc1e33950 N°5904 Fix attribute set / linkset wrapping 2023-02-02 10:05:55 +01:00
Molkobain
72a586e490 N°5905 - Fix linkset panel description still in an alert when editing host object 2023-02-01 18:09:46 +01:00
Stephen Abello
0cce58e0cf N°5904 Fix hardcoded string when existing dict entry was available 2023-02-01 09:40:38 +01:00
Stephen Abello
53b68f88b8 Fix typo in dictionaries 2023-02-01 09:39:33 +01:00
Stephen Abello
7fb10da013 N°5904 Fix hardcoded strings when existing dict entries were available 2023-02-01 09:33:58 +01:00
Stephen Abello
0b1352fe37 N°5904 Move dict entries 2023-01-31 09:57:06 +01:00
acognet
e0cc00e772 N°5849 - Fix wrong encoding of external keys in "Header with statstics" dashlet - fix for 3.1 2023-01-30 17:29:51 +01:00
Molkobain
002e52cc3e N°5929 - Fix parse error due to not closed array from bbea9782 2023-01-30 17:21:41 +01:00
Thomas Casteleyn
bbea978259 N°5929 - Update hungarian translations thanks to @tacsaby (#438)
Co-authored-by: tacsaby
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
2023-01-30 17:15:08 +01:00
Molkobain
bddfa4cd7a Merge remote-tracking branch 'origin/support/3.0' into develop 2023-01-30 17:09:36 +01:00
Anne-Catherine
12ef74ec42 N°5849 - Fix wrong encoding of external keys in "Header with statstics" dashlet (#384)
N°5849 - Fix wrong encoding of external keys in "Header with statstics" dashlet #384
2023-01-30 16:06:10 +01:00
Eric Espie
cd1b441025 N°4756 - Ease extensibility for CRUD operations: 🎨 add log 2023-01-30 14:45:58 +01:00
Pierre Goiffon
0f97b93617 N°5856 Fix object lists always ajax loaded
Regression introduced in N°3200 with 4f7a1ea9
2023-01-30 09:31:10 +01:00
Molkobain
b61c8ea4ca N°5388 - PHP 8.2: Fix dynamic properties to standard declared properties 2023-01-27 19:00:59 +01:00
Molkobain
f48df74933 N°5388 - PHP 8.2: Fix dynamic properties that were actually just case-sensitive typos 2023-01-27 17:57:50 +01:00
Molkobain
6fb00cbbf3 N°5388 - PHP 8.2: Fix dynamic properties to standard declared properties 2023-01-27 17:56:55 +01:00
Molkobain
af2421a2cb N°5905 - Move tab description to a tooltip on the panel's title instead of a big blue alert 2023-01-27 17:25:03 +01:00
Molkobain
0374e303e4 N°5905 - Refactor CSS class .ibo-has-description so it can be used on any element 2023-01-27 17:25:03 +01:00
Molkobain
27bd78d76b Refactor SCSS misc. partial to dedicated partials as it was growing too much 2023-01-27 17:25:03 +01:00
Stephen Abello
bc3b43958c N°5904 When getting an error in a popup (e.g. uniqueness rule), remove submit state, so we can submit the form again 2023-01-27 14:33:49 +01:00
Molkobain
fd4a2f17d2 N°4481 - Fix CSS class name 2023-01-27 13:24:54 +01:00
vdumas
d741656028 N°5904 - Linksets: tooltip & pop-up title 2023-01-27 11:00:08 +01:00
Molkobain
f7e8bd31f5 N°5905 - Fix "+" button displayed twice on linksets with 1 item 2023-01-26 17:49:17 +01:00
Eric Espie
1e37370789 N°4756 - Ease extensibility for CRUD operations : 🎨 refactor after code review with PG 2023-01-26 17:32:08 +01:00
Tarjányi Csaba
5844717980 Update hu.dict.authent-local.php
a small fix
2023-01-26 16:20:11 +01:00
Vincent Dumas
9437968d0e N°5825 - Add friendlyname & uniqueness rule on Links (#416)
* N°5825 - Add label, friendlyname, filter, details view, uniqueness rules on Link classes
* N°5825 - Add label, friendlyname, details view, uniqueness rules on Link classes
2023-01-26 14:26:31 +01:00
Molkobain
e72ed33a40 N°5920 - Add linkset's description as corresponding tab's tooltip in object details 2023-01-26 12:01:56 +01:00
Molkobain
2a825c6ba0 N°5905 - Fix "+" button displayed twice on linksets with no item 2023-01-26 11:03:01 +01:00
vdumas
6b8d9ea08d N°5915 - Complementary Name on Trigger and Action 2023-01-26 09:03:52 +01:00
vdumas
52d57293c9 N°5825 - Add label, friendlyname, details view (on LnkPersonToTeam) 2023-01-25 18:37:38 +01:00
Molkobain
40cebf1eb7 N°5923 - Align panel's header within another panel when it has no icon 2023-01-25 16:50:21 +01:00
Molkobain
f1d6f3e5c2 N°5905 - Harmonize how known errors are displayed in an object 2023-01-25 15:33:44 +01:00
Pierre Goiffon
834c4a2654 N°5563 Restore edit_mode getter
Woops forgot in 13550fd6
2023-01-25 14:57:30 +01:00
Molkobain
ed1a076ebb N°5905 - Harmonize how notifications are displayed in an object 2023-01-25 10:41:18 +01:00
Molkobain
1dcf38f2ea N°5905 - Harmonize how linksets are displayed in edition part I
* Always display a table and its actions to ease link creation
* Display linkset description in an alert block
2023-01-25 10:29:48 +01:00
odain
2f034253e7 N°5891 - Make CSV import unit tests work-use another password for user authentication 2023-01-25 08:56:15 +01:00
Molkobain
a10ac7fdcb N°5905 - Harmonize how linksets are displayed part I
* Always display a table and its actions to ease link creation
* Display linkset description in an alert block
2023-01-24 21:12:49 +01:00
vdumas
3775ccea74 N°5915 - Display n:n in Trigger and Action using tagset widget 2023-01-24 17:23:44 +01:00
bdalsass
f743971c93 N°5914 - Wrong encoding in modules configuration editor (#392) 2023-01-24 16:33:02 +01:00
Stephen Abello
dd213df9c4 N°5822 Fix 7127b192 SCSS rule 2023-01-24 14:33:41 +01:00
Molkobain
96825c646e N°4756 - Move event register to dedicated folder 2023-01-24 14:20:35 +01:00
Stephen Abello
1152b2f401 N°5904 Hide transitions in modals 2023-01-24 11:21:35 +01:00
Stephen Abello
8f7003c694 N°5904 Change dict entry value 2023-01-24 11:21:33 +01:00
bdalsass
fb1ceebaa4 N°3190 - Edit n:n LinkedSetIndirect in object details using a tagset-like widget
- Add generic set block ui component
- Add model link set (direct and indirect) attribute (display style)
- Add model link set direct allowed values
- Create link set viewer block UI (BlockLinksSetDisplayAsProperty)
- Add set block ui factory for linkset
- Add object factory and create new endpoint in object controller (with data binder)
- Add link set model, link set repository and link set data transformer services
2023-01-24 10:03:10 +01:00
Stephen Abello
9482139b5a N°5904 Fix undefined attribute when refreshing Datatables 2023-01-23 16:42:43 +01:00
Stephen Abello
7ea2315323 Fix php warning and missing dict entry for 1-n (3d9a85d follow-up) 2023-01-23 16:36:13 +01:00
Stephen Abello
9487d63b9c N°5904 When detaching/deleting a linked object, refresh datatable or display an error message 2023-01-23 16:16:23 +01:00
Stephen Abello
3d9a85d577 Fix php warning and missing dict entry 2023-01-23 15:36:38 +01:00
Molkobain
b2397fc570 N°4517 - Fix missing use statement from 7ec12f1e1 2023-01-20 15:30:53 +01:00
Molkobain
0d15b01b3f Merge remote-tracking branch 'origin/support/3.0' into develop
# Conflicts:
#	pages/UI.php
2023-01-20 11:59:26 +01:00
vdumas
f7e87c1ea1 N°5347 - Change default value of allow_menu_on_linkset 2023-01-20 11:30:55 +01:00
Molkobain
3ca4122673 N°5834 - Fix activity panel disappearing when creating a Ticket in 'resolved' state 2023-01-20 11:30:05 +01:00
Stephen Abello
f21f6aec30 Missing class import 2023-01-20 10:10:05 +01:00
Pierre Goiffon
c76d351379 Merge remote-tracking branch 'origin/support/3.0' into develop
# Conflicts:
#	datamodels/2.x/combodo-db-tools/module.combodo-db-tools.php
2023-01-19 17:54:29 +01:00
Pierre Goiffon
efa20e77d0 N°3769 Add data-input-id HTML attribute to fields in a transition form
Was only present in object edit mode :(
2023-01-19 17:53:14 +01:00
Eric Espie
effc4141c7 N°5900 - DB integrity analysis crashes when too many errors - module version 2023-01-19 09:30:37 +01:00
Eric Espie
b4813de0a5 Merge branch 'support/3.0' into develop
# Conflicts:
#	datamodels/2.x/combodo-db-tools/module.combodo-db-tools.php
2023-01-19 08:52:47 +01:00
Eric Espie
f75a51d59e N°5900 - DB integrity analysis crashes when too many errors - limit the results to 100 to avoid memory errors 2023-01-19 08:51:02 +01:00
Molkobain
8e3bad11ae N°5563 - Fix XML conversion XPaths 2023-01-18 19:35:59 +01:00
Pierre Goiffon
13550fd643 N°5563 Relations XML : restore edit_mode node
There are (yet !) not change in the relations UI when in object is in edit mode, so we need to keep previous behaviors.
2023-01-18 18:11:02 +01:00
Molkobain
44977d69b6 N°5608 - Fix event service unit tests namespace 2023-01-18 17:50:22 +01:00
Molkobain
15f108152c N°5608 - Fix Twig unit test and re-enable all tests under /sources dir that were not run! (Application/Helper, Application/Service, Application/TwigBase, Composer, Router) 2023-01-18 17:41:47 +01:00
Molkobain
9be167cf5e N°5608 - Rename unit tests dirs "sources/application" to match counter-part dirs name 2023-01-18 17:39:55 +01:00
Eric Espie
34688c2bf6 Merge branch 'support/3.0' into develop 2023-01-18 16:42:30 +01:00
Eric Espie
9dc54d6e4c N°5901 - Warnings in Details part of file system Tab 2023-01-18 16:39:40 +01:00
Eric Espie
640b1b9176 ✏️ Added missing use of class Toolbar 2023-01-18 16:38:16 +01:00
Stephen Abello
c1922e2b3f N°3300 - Add creation and modification of 1-n objects in object details (#385)
* Rebase onto develop

* Use exit condition instead of englobing condition

* Add informative modals that can be called from modal toolbox

* Refactor "apply_modify" and "apply_new" into own controller, handle ajax requests with a json response and handle these responses in linkset creation/edition

* Fix merge issues

* Remove inverted condition

* Move linkset create button to a better place, still needs to fix duplicate "New" button caused by a refactor

* Handle "Cancel" button in modals

* Do not display relations when editing an object in a modal

* More elegant way to add "New" button to relations lists

* Factorize vertical highlights in alerts and modal in a single mixin

* Replace button name with dict entry code

* Change route name to snake case

* More elegant way to add "Create in modal" button to relations lists

* Replace triple if with in_array

* Move listener to body

* Rename variable to match boolean rules

* Rename event

* Rename extra param

* Add phpdoc

* Revert changes

* Check indirect linkset rights before allowing creation in modal

* Allow to modify linked object from 1-n relation in modal

* Add "New" button to 1-n relations

* Fix "new" button on 1-n

* Add todo

* Handle multiple classes choice

* Rework multiple classes choice and only allow LinksetController to be called from an ajax context

* PhpDoc

* Update sources/Application/UI/Links/Direct/BlockDirectLinksViewTable.php

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
2023-01-18 15:43:31 +01:00
Stephen Abello
e1ffa65d8b N°3136 - Add creation and modification of n-n objects in object details (#378)
* Rebase onto develop

* Use exit condition instead of englobing condition

* Add informative modals that can be called from modal toolbox

* Refactor "apply_modify" and "apply_new" into own controller, handle ajax requests with a json response and handle these responses in linkset creation/edition

* Fix merge issues

* Remove inverted condition

* Move linkset create button to a better place, still needs to fix duplicate "New" button caused by a refactor

* Handle "Cancel" button in modals

* Do not display relations when editing an object in a modal

* More elegant way to add "New" button to relations lists

* Factorize vertical highlights in alerts and modal in a single mixin

* Replace button name with dict entry code

* Change route name to snake case

* More elegant way to add "Create in modal" button to relations lists

* Replace triple if with in_array

* Move listener to body

* Rename variable to match boolean rules

* Rename event

* Rename extra param

* Add phpdoc

* Revert changes

* Check indirect linkset rights before allowing creation in modal
2023-01-18 13:35:48 +01:00
Molkobain
cc2881a7b0 Merge remote-tracking branch 'origin/support/3.0' into develop 2023-01-17 19:21:52 +01:00
Molkobain
0d8a21f6ef N°5897 - Improve deprecated logs relevance for PHP "trigger_deprecation" 2023-01-17 16:30:35 +01:00
Molkobain
3459dc5997 N°5897 - Improve deprecated logs relevance for PHP "trigger_deprecation" 2023-01-17 16:29:25 +01:00
Pierre Goiffon
01d9d34118 Merge remote-tracking branch 'origin/support/3.0' into develop 2023-01-17 15:37:43 +01:00
Pierre Goiffon
de7c9d965e 💡 PHPDoc in \DeprecatedCallsLog 2023-01-17 15:37:23 +01:00
Eric Espie
6549c95d4f N°4756 - Ease extensibility for CRUD operations : XML format migration 2023-01-17 10:17:11 +01:00
Molkobain
da07fadfb3 N°5302 - PHP 8.1: Migrate some strlen() usages to internal method 2023-01-16 16:47:26 +01:00
Molkobain
b2c256e51e Merge remote-tracking branch 'origin/support/3.0' into develop 2023-01-16 16:37:22 +01:00
Pierre Goiffon
7305a30b50 N°3200 Remove "Filter list" icon
The link is still here but on objects total (see c693d03a)
2023-01-16 15:29:18 +01:00
Molkobain
4c127b6f61 Revert "N°4517 - PHP 8.1: Fix return type hint for iterable classes"
This reverts commit 61be903eb2.
2023-01-16 14:38:20 +01:00
Molkobain
61be903eb2 N°4517 - PHP 8.1: Fix return type hint for iterable classes 2023-01-16 14:21:00 +01:00
Pierre Goiffon
59792b2a3d N°4660 Remove useless chmod 2023-01-16 11:55:18 +01:00
Pierre Goiffon
19dda61d4f Merge remote-tracking branch 'origin/support/3.0' into develop
# Conflicts:
#	tests/php-unit-tests/unitary-tests/webservices/RestTest.php
2023-01-16 11:54:24 +01:00
Pierre Goiffon
a50ed02057 N°4660 Fix OQLTest 2023-01-16 11:39:38 +01:00
Pierre Goiffon
0a7c8f9fd1 Merge remote-tracking branch 'origin/support/2.7' into support/3.0
# Conflicts:
#	tests/php-unit-tests/unitary-tests/core/OQLTest.php
#	tests/php-unit-tests/unitary-tests/core/iTopConfigParserTest.php
#	tests/php-unit-tests/unitary-tests/webservices/RestTest.php
2023-01-16 11:36:02 +01:00
Pierre Goiffon
f65e14397c N°4660 Fix permissions changes in tests 2023-01-16 11:22:23 +01:00
Eric Espie
06a5d645da N°4756 - Ease extensibility for CRUD operations : Add unit tests 2023-01-12 17:40:17 +01:00
Pierre Goiffon
5d1852fe45 Merge remote-tracking branch 'origin/support/3.0' into develop 2023-01-12 16:43:41 +01:00
Pierre Goiffon
d7b94fb123 N°3769 Add data-input-type HTML attribute to fields in a transition form
Was only present in object edit mode :(
2023-01-12 16:40:31 +01:00
Eric Espie
ced4f82585 N°5412 - Upgrade to PHPUnit 9 to fix PHPUnit 8.5 error with PHP 8.1 - replaced removed function 2023-01-12 16:34:14 +01:00
Pierre Goiffon
de0110abc6 RestTest : test json_decode return value 2023-01-12 15:50:57 +01:00
Molkobain
a53bea5eb9 Add @jf-cbd to the sample data, welcome! 👋 2023-01-12 14:41:41 +01:00
Pierre Goiffon
47435869b3 Merge remote-tracking branch 'origin/support/3.0' into develop 2023-01-12 10:43:31 +01:00
Pierre Goiffon
80a9ded404 Merge remote-tracking branch 'origin/support/2.7' into support/3.0 2023-01-12 10:43:09 +01:00
Pierre Goiffon
c696a81c3a N°5821 JenkinsFile : introduce buildDiscarder 2023-01-12 10:42:06 +01:00
Molkobain
e04ea2d178 N°5608 - Fix status unit tests for PHPUNit 9 2023-01-11 18:22:48 +01:00
Molkobain
42ce397e13 N°5608 - Fix event service unit tests suite 2023-01-11 18:22:48 +01:00
Pierre Goiffon
22162aa55f Merge remote-tracking branch 'origin/support/3.0' into develop 2023-01-11 18:09:49 +01:00
Pierre Goiffon
c693d03a77 N°3200 Add "Filter list" link on datatable count 2023-01-11 17:19:49 +01:00
Pierre Goiffon
b9ed00d53f N°4660 Fix iTopConfigParserTest setting permissions of iTop config file
Alternative method to restore config file
chmod cannot be used with +w
In \Config::WriteToFile we are using fopen with mode=w, so using the same
In consequence we are not modifying anymore the iTop config file permissions \o/
2023-01-11 16:04:21 +01:00
Molkobain
29e0df9bbc Merge remote-tracking branch 'origin/support/3.0' into develop
# Conflicts:
#	test/sources/application/Helper/WebResourcesHelperTest.php
#	tests/php-unit-tests/ItopTestCase.php
#	tests/php-unit-tests/composer.lock
#	tests/php-unit-tests/unitary-tests/.make/release/DatamodelsXmlFilesTest.php
#	tests/php-unit-tests/unitary-tests/application/UI/Base/Layout/NavigationMenuTest.php
#	tests/php-unit-tests/unitary-tests/application/query/QueryTest.php
#	tests/php-unit-tests/unitary-tests/core/DBSearchTest.php
#	tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/BulkChangeExtKeyTest.inc.php
#	tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/CRUD/DBObjectTest.php
#	tests/php-unit-tests/unitary-tests/service/EventTest.php
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/Convert-samples/3.0_to_3.1.expected.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/Convert-samples/3.0_to_3.1.input.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/Convert-samples/3.1_to_3.0.expected.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/Convert-samples/3.1_to_3.0.input.xml
#	tests/php-unit-tests/unitary-tests/sources/Application/Helper/WebResourcesHelperTest.php
#	tests/php-unit-tests/unitary-tests/sources/Router/RouterTest.php
#	tests/php-unit-tests/unitary-tests/sources/application/Helper/WebResourcesHelperTest.php
#	tests/php-unit-tests/unitary-tests/webservices/ImportTest.inc.php
#	tests/php-unit-tests/unitary-tests/webservices/RestTest.php
2023-01-11 15:55:08 +01:00
Molkobain
c4508ea80c N°4660 - Fix data synchro unit test failure due to another test not restoring correct user permissions on conf file 2023-01-11 14:26:23 +01:00
Molkobain
16390c9b00 N°5857 - PHPUnit: Replace usage of deprecated assetContains with assertStringContainsString 2023-01-11 13:26:54 +01:00
Molkobain
1271a895d1 N°5857 - PHPUnit: Replace usage of deprecated assetContains with assertStringContainsString 2023-01-11 11:59:01 +01:00
Eric Espie
030f1e2463 Fix Status test 2023-01-11 10:28:32 +01:00
Molkobain
ec90c0b6cd N°5872 - Navigation menu: Wrap menu group label instead of ellipsis in drawer 2023-01-11 10:21:46 +01:00
Molkobain
7b79da3f32 N°5871 - Navigation menu: Show ellipsis on long menu group labels 2023-01-11 10:18:15 +01:00
Pierre Goiffon
5729d6a9cd 🎨 StatusIncTest : fix phpdoc, replace @expectedException 2023-01-11 10:02:59 +01:00
acognet
4d7bac89f3 N°3805 - Collectors not working on itop 3.0 2023-01-11 09:47:53 +01:00
Molkobain
a5efef900c N°5608 - Harmonize namespaces and merge duplicated test files 2023-01-10 23:02:54 +01:00
Molkobain
c851a10982 Merge remote-tracking branch 'origin/support/2.7' into support/3.0 2023-01-10 22:49:13 +01:00
Molkobain
845adf43c6 N°5608 - Harmonize namespaces and merge duplicated test files 2023-01-10 22:36:35 +01:00
Molkobain
5916e4ea39 N°5608 - Ensure both old & new tests structure are ran for extensions for backward compatibility 2023-01-10 22:03:40 +01:00
Molkobain
7f37de777e N°5608 - Fix unit tests following restructuring Part III
* Missed a usage of "use_legacy_search" conf param on the last commit
* Fix log tests which didn't moved correctly from Git PoV 😕
2023-01-10 21:11:10 +01:00
Molkobain
bcf880f327 N°5608 - Fix unit tests following restructuring Part II
"use_legacy_search" conf param was removed some time ago
2023-01-10 19:23:54 +01:00
Thomas Casteleyn
b593beb8c7 N°5867 Display binary data size in SynchroReplica details (#286) 2023-01-10 18:53:00 +01:00
Lars Kaltefleiter
57ab3a0336 N°1350 - link audit catecories to domains and evaluate only categories of a given domain via interactive audit 2023-01-10 18:20:15 +01:00
Lars Kaltefleiter
4a54b2f8ff N°1350 - Configurable error tolerance for report color of audit categories 2023-01-10 18:20:15 +01:00
Molkobain
6aa9aa2831 N°5608 - Fix unit tests following restructuring Part I 2023-01-10 18:15:53 +01:00
Eric Espie
9b47ee12e7 N°4307 - Replace SwiftMailer by laminas-mail - Fix connecting to server without password 2023-01-10 17:58:03 +01:00
Molkobain
d177ee4a7f Merge remote-tracking branch 'origin/support/2.7' into support/3.0
# Conflicts:
#	tests/manual-visual-tests/Backoffice/RenderAllUiBlocks.php
#	tests/php-unit-tests/ItopDataTestCase.php
#	tests/php-unit-tests/ItopTestCase.php
#	tests/php-unit-tests/integration-tests/dictionaries-test/fr.dictionary.itop.core.KO.wrong_php
#	tests/php-unit-tests/integration-tests/dictionaries-test/fr.dictionary.itop.core.OK.php
#	tests/php-unit-tests/integration-tests/iTopModulesPhpVersionChecklistTest.php
#	tests/php-unit-tests/integration-tests/iTopXmlVersionChecklistTest.php
#	tests/php-unit-tests/phpunit.xml.dist
#	tests/php-unit-tests/unitary-tests/application/SCSSCompilationTest.php
#	tests/php-unit-tests/unitary-tests/application/Session/SessionTest.php
#	tests/php-unit-tests/unitary-tests/application/ThemeHandlerTest.php
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/css/DO_NOT_CHANGE.css-variables.scss
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/css/DO_NOT_CHANGE.light-grey.scss
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/css/README.md
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/css/_included_file3.scss
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/css/cross_reference1.scss
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/css/cross_reference2.scss
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/css/feature1/_feature1.scss
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/css/included_file1.scss
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/css/included_scss/included_file2.scss
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/css/included_scss/included_file4.scss
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/css/multi_imports.scss
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/css/shortcut.scss
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/css/shortcut2.scss
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/css/simple_import.scss
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/css/simple_import2.scss
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/css/typography.scss
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/css/ui-lightness/DO_NOT_CHANGE.jqueryui.scss
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/css/ui-lightness/images/ui-icons_1c94c4_256x240.png
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/css/ui-lightness/images/ui-icons_222222_256x240.png
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/css/ui-lightness/images/ui-icons_E87C1E_256x240.png
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/css/ui-lightness/images/ui-icons_F26522_256x240.png
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/css/ui-lightness/images/ui-icons_ffd27a_256x240.png
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/css/ui-lightness/images/ui-icons_ffffff_256x240.png
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/ac-background.gif
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/actions_right.png
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/bg.gif
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/breadcrumb-separator.png
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/calendar.png
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/delete.png
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/desc.gif
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/error.png
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/eye-closed-555.png
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/eye-closed-fff.png
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/eye-open-555.png
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/eye-open-fff.png
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/full-screen.png
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/green-header.gif
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/green-square.gif
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/indicator.gif
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/info-mini.png
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/minus.gif
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/ok.png
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/orange-header.gif
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/plus.gif
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/red-header.gif
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/truncated.png
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/tv-collapsable-last.gif
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/tv-collapsable.gif
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/tv-expandable-last.gif
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/tv-expandable.gif
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/tv-item-last.gif
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/testimages/images/tv-item.gif
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/main.css
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/main_imagemodified.css
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/main_importmodified.css
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/main_stylesheet.css
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/main_testcompilethemes.css
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/main_varchanged.css
#	tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/theme-parameters.json
#	tests/php-unit-tests/unitary-tests/application/theme-handler/getimages/expected-getimages.json
#	tests/php-unit-tests/unitary-tests/application/theme-handler/getimages/test-getimages.scss
#	tests/php-unit-tests/unitary-tests/core/ActionEmailTest.php
#	tests/php-unit-tests/unitary-tests/core/AttributeDefTest.inc.php
#	tests/php-unit-tests/unitary-tests/core/AttributeURLDefaultPattern.php
#	tests/php-unit-tests/unitary-tests/core/AttributeURLTest.php
#	tests/php-unit-tests/unitary-tests/core/BulkChangeTest.inc.php
#	tests/php-unit-tests/unitary-tests/core/CSVParserTest.php
#	tests/php-unit-tests/unitary-tests/core/DBObjectTest.php
#	tests/php-unit-tests/unitary-tests/core/DBSearchAddConditionPointingTo.php
#	tests/php-unit-tests/unitary-tests/core/ExpressionEvaluateTest.php
#	tests/php-unit-tests/unitary-tests/core/GetSelectFilterTest.php
#	tests/php-unit-tests/unitary-tests/core/InlineImageTest.php
#	tests/php-unit-tests/unitary-tests/core/Log/ExceptionLogTest.php
#	tests/php-unit-tests/unitary-tests/core/Log/ExceptionLogTest/Exceptions.php
#	tests/php-unit-tests/unitary-tests/core/Log/LogAPITest.php
#	tests/php-unit-tests/unitary-tests/core/Log/LogFileNameBuilderTest.php
#	tests/php-unit-tests/unitary-tests/core/LogAPITest.php
#	tests/php-unit-tests/unitary-tests/core/LogFileNameBuilderTest.php
#	tests/php-unit-tests/unitary-tests/core/MetaModelTest.php
#	tests/php-unit-tests/unitary-tests/core/OQLTest.php
#	tests/php-unit-tests/unitary-tests/core/UniquenessConstraintTest.php
#	tests/php-unit-tests/unitary-tests/core/XMLDataLoaderTest.php
#	tests/php-unit-tests/unitary-tests/core/dictApcuTest.php
#	tests/php-unit-tests/unitary-tests/core/dictTest.php
#	tests/php-unit-tests/unitary-tests/core/ormCaseLogTest.php
#	tests/php-unit-tests/unitary-tests/core/ormPasswordTest.php
#	tests/php-unit-tests/unitary-tests/core/ormStyleTest.php
#	tests/php-unit-tests/unitary-tests/setup/MFCompilerTest.php
#	tests/php-unit-tests/unitary-tests/setup/SubMFCompiler.php
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/1.7_to_1.6.expected.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/1.7_to_1.6.input.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/Convert-samples/1.6_to_1.7_2.expected.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/Convert-samples/1.6_to_1.7_2.input.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/Convert-samples/1.7.input.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/Convert-samples/1.7_to_1.6.expected.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/Convert-samples/1.7_to_1.6.input.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/Convert-samples/1.7_to_1.6_2.expected.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/Convert-samples/1.7_to_1.6_2.input.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/Convert-samples/1.7_to_3.0.expected.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/Convert-samples/1.7_to_3.0.input.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/Convert-samples/3.0_to_1.7.expected.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/Convert-samples/3.0_to_1.7.input.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/Convert-samples/Bug_4569.expected.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/Convert-samples/Bug_4569.input.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/MoveNode-samples/from_deleted_to_deleted.expected.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/MoveNode-samples/from_deleted_to_deleted.input.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/MoveNode-samples/from_deleted_to_in-definition.expected.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/MoveNode-samples/from_deleted_to_in-definition.input.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/MoveNode-samples/from_deleted_to_not-in-definition.expected.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/MoveNode-samples/from_deleted_to_not-in-definition.input.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/MoveNode-samples/from_in-definition_to_deleted.expected.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/MoveNode-samples/from_in-definition_to_deleted.input.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/MoveNode-samples/from_in-definition_to_in-definition.expected.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/MoveNode-samples/from_in-definition_to_in-definition.input.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/MoveNode-samples/from_in-definition_to_not-in-definition.expected.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/MoveNode-samples/from_in-definition_to_not-in-definition.input.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/MoveNode-samples/from_not-in-definition_to_deleted.expected.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/MoveNode-samples/from_not-in-definition_to_deleted.input.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/MoveNode-samples/from_not-in-definition_to_in-definition.expected.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/MoveNode-samples/from_not-in-definition_to_in-definition.input.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/MoveNode-samples/from_not-in-definition_to_not-in-definition.expected.xml
#	tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/MoveNode-samples/from_not-in-definition_to_not-in-definition.input.xml
#	tests/php-unit-tests/unitary-tests/setup/ressources/datamodels/datamodel-branding.xml
#	tests/php-unit-tests/unitary-tests/sources/application/Helper/WebResourcesHelperTest.php
#	tests/php-unit-tests/unitary-tests/sources/application/status/StatusIncTest.php
#	tests/php-unit-tests/unitary-tests/sources/application/status/status.php
#	tests/php-unit-tests/unitary-tests/synchro/DataSynchroTest.php
2023-01-10 15:27:44 +01:00
Lars Kaltefleiter
b354058eb5 N°5622 Fix backup cannot be done if TLS enabled with no CA (#354) 2023-01-10 12:13:33 +01:00
Molkobain
fbc0a898ae N°5608 - Move test files to corresponding directories after branch rebase 2023-01-10 12:11:12 +01:00
Molkobain
36f8e58e25 N°5608 - Use new ItopTestCase::RequireOnceXXX in unit tests 2023-01-10 12:11:12 +01:00
Molkobain
6a7dbb06b0 N°5608 - Add methods to require_once an iTop or a unit test file to avoid crashes when tests dir is moved 2023-01-10 12:11:12 +01:00
Pierre Goiffon
43dd0b7df8 N°2013 Fix regression when installing from scratch
Error was "Call to a member function UpdateFromParams() on null"
Regression introduced by 15d3201a
2023-01-10 10:56:21 +01:00
Pierre Goiffon
43d86ad8e2 N°2013 Setup : fix crash on setting readonly mode if initial DB info were wrong
Same as 15d3201a, but this error happened before compilation, when setting read only mode.
As before this is another fix for #351.

This fix introduces the new method \WizardController::GetParamForConfigArray
I replaced existing duplicate code with a call to this new generic method.
2023-01-10 10:56:21 +01:00
Eric Espie
d3d89b1ee2 N°5857 Fix PHPUnitPrettyPrint with PHPUnit 9 2023-01-10 09:42:13 +01:00
Pierre Goiffon
15d3201a40 N°2013 Setup : fix crash on compilation if initial DB info were wrong
Use case :
- having in the iTop config file wrong DB parameters (unreachable server for example)
- launch the setup in update mode
- fix the DB config in the wizard

The PR #351 solved the errors that were happening in the following steps.
But we still had an error during compilation, caused by the maintenance mode activation.
2023-01-09 16:11:27 +01:00
Eric Espie
cf4616d9a1 N°4756 - Ease extensibility for CRUD operations : Unit tests 2023-01-09 13:59:55 +01:00
Molkobain
5721a324c1 Tests: Always display test status for better feedback 2023-01-06 22:30:09 +01:00
Molkobain
7de6c72154 Tests: Rename provider method name to match convention 2023-01-06 22:30:09 +01:00
Molkobain
c0cee02351 N°5608 - Factorize all core modules tests to a single test suite 2023-01-06 22:30:09 +01:00
Molkobain
bb674fb873 N°5608 - Move/rename "status" unit tests to match their counterpart location/name 2023-01-06 22:30:09 +01:00
Molkobain
6136eadd31 N°5608 - Fix some broken require paths since move/rename 2023-01-06 22:30:08 +01:00
Molkobain
87cb73c038 N°5608 - Rename "test" folder to "tests" to better match conventions 2023-01-06 22:30:08 +01:00
Molkobain
11d8547cef N°5608 - Move/rename unit tests to match their counterpart location/name 2023-01-06 22:30:08 +01:00
Molkobain
0998c73a1a N°5608 - Add README files 2023-01-06 22:30:07 +01:00
Molkobain
471f66649a N°5608 - Rename unitary test folders for better understanding 2023-01-06 22:30:07 +01:00
Molkobain
e8bf9cf688 N°5608 - Move "twig" PHP unit test to new folder
Notice: Test was not working, still not working
2023-01-06 22:30:07 +01:00
Molkobain
4f88a0e7d2 N°5608 - Move legacy PHP unit tests (not run by CI) to a dedicated folder 2023-01-06 22:30:07 +01:00
Molkobain
c6b0e273e6 N°5608 - Rename "VisualTests" folder to match new convention 2023-01-06 22:30:07 +01:00
Molkobain
d9539f9d01 N°5608 - Add comments to main autoloader 2023-01-06 22:30:06 +01:00
Molkobain
a3e309acb5 N°5608 - Revert "authent-local" test suite to its original rank as it is crashing the CI 🤔 2023-01-06 22:30:06 +01:00
Molkobain
c06cbfd4a9 N°5608 - Rename "coreExtensions" test suite to correct datamodel module (authent-local) 2023-01-06 22:30:06 +01:00
Molkobain
1d7e4e1a42 N°5608 - Move unit tests to a dedicated folder and start reorganizing to match iTop folder structure 2023-01-06 22:30:06 +01:00
Molkobain
083d19c688 📝 PHPDoc 2023-01-05 21:19:56 +01:00
Eric Espie
4e9a34d8d8 Merge branch 'support/3.0' into develop 2023-01-05 09:25:11 +01:00
Eric Espie
524e65a29b 📝 fix PHPDoc 2023-01-05 09:23:48 +01:00
Pierre Goiffon
25048ba0cc N°3200 🎨 Replace !empty() by \utils::IsNotNullOrEmptyString
Thanks Molkobain !
2023-01-05 09:07:13 +01:00
Pierre Goiffon
4f7a1ea9da N°3200 Datatable "filter list" icon : specific query for 1,n and n,n objects relations
This specific query passes attcodes list to display to UI.php, but this endpoint doesn't handle it yet. Adding this enhancements would require too much time for now (datatables legacy code), hopefully a refactoring work will be done soon and we'll get back to it !

Note that dedicated ContextTag is renamed from Search to ObjectSearch
2023-01-04 16:23:52 +01:00
Pierre Goiffon
a62a373f64 N°3200 ♻️ Refactor relations attcode list generation
The existing code was added in N°2334
Its generic part is now callable in the MetaModel::GetAttributeLinkedSetIndirectDatatableAttCodesToDisplay method
2023-01-04 16:23:52 +01:00
Pierre Goiffon
6b23171d65 N°3200 New "Filter list" icon in datatables
Every datatables will open its query in a new UI.php?operation=search page
2023-01-04 16:23:52 +01:00
Pierre Goiffon
09b69728a0 📝 Version history : highlight for major versions 2023-01-04 14:24:27 +01:00
Pierre Goiffon
bc0dbc7860 📝 Version history : add link to versions details on the wiki 2023-01-04 14:20:34 +01:00
Eric Espie
a693c343e8 N°4756 - Ease extensibility for CRUD operations : Reduce events after review 2023-01-04 14:18:01 +01:00
Eric Espie
cd17eb484a N°4756 - Ease extensibility for CRUD operations : Reduce events after review 2023-01-04 12:23:23 +01:00
Vincent Dumas
259eb60f97 N°5841 - Non-admin managing User can't see Administrator by default (#383) 2023-01-03 14:08:28 +01:00
Eric Espie
1afa3e2003 Merge branch 'support/3.0' into develop 2023-01-03 08:52:10 +01:00
Eric Espie
df7d7c877d N°5490 - PHP 8.0: Fix crash of bulk modify 2023-01-03 08:50:18 +01:00
Eric Espie
4c4d7c12e8 N°4756 - Ease extensibility for CRUD operations : Coherency in method parameters 2023-01-02 14:23:36 +01:00
Eric Espie
97c3cacfaa N°4756 - Ease extensibility for CRUD operations : Pass DeletionPlan to EVENT_DB_CHECK_TO_DELETE 2023-01-02 14:20:17 +01:00
Eric Espie
98ec568788 N°4756 - Ease extensibility for CRUD operations : Events not sent in overridable methods 2023-01-02 14:06:02 +01:00
Eric Espie
626ba7ee66 📝 PHPDoc reworked packages 2022-12-30 14:17:57 +01:00
Eric Espie
3920f84f45 📝 PHPDoc reworked for auto-doc 2022-12-30 10:11:11 +01:00
Eric Espie
30d2557342 Merge branch 'support/3.0' into develop 2022-12-29 16:00:23 +01:00
Eric Espie
4bcad431aa 📝 Change packages for auto-documentation 2022-12-29 15:59:59 +01:00
Eric Espie
f3cea730af Merge branch 'support/3.0' into develop
# Conflicts:
#	application/applicationextension.inc.php
2022-12-29 14:40:26 +01:00
Eric Espie
5fe32aac15 Merge branch 'support/2.7' into support/3.0
# Conflicts:
#	application/applicationextension.inc.php
2022-12-29 12:40:37 +01:00
Eric Espie
88d9a29599 📝 Change packages for auto-documentation 2022-12-29 12:38:31 +01:00
Eric Espie
92a36dcfdd 📝 Change packages for auto-documentation 2022-12-29 12:24:56 +01:00
Eric Espie
23b4d4cb6b Merge branch 'support/2.7' into support/3.0 2022-12-28 09:52:52 +01:00
Eric Espie
b37e74b407 📝 Change packages for auto-documentation 2022-12-28 09:51:46 +01:00
Eric Espie
0fad249124 N°5564 - ⬆️ twig bump 2022-12-26 09:42:56 +01:00
Pierre Goiffon
94d7d94bff 💡 Fix PHPDoc in \ApplicationMenu::GetSubMenuNodes 2022-12-23 16:14:38 +01:00
Vincent Dumas
48645dd519 N°4852 - Navigation menu: Display "+" dict entries as a tooltip on sub-nodes (#380) 2022-12-23 15:48:52 +01:00
Stephen Abello
9df9077595 N°4737 - Adjust progress bar position in iTop hub connector 2022-12-23 15:45:58 +01:00
Stephen Abello
756241918e N°4737 - Adjust button position in iTop hub connector 2022-12-23 15:44:22 +01:00
Stephen Abello
f819fdae98 N°5507 - Fix impact analysis page title when displaying "Depends on" graph 2022-12-23 15:09:13 +01:00
Stephen Abello
7127b192a2 N°5822 - Do not display the tab separator in scroll mode when there is only one tab 2022-12-23 14:28:22 +01:00
Eric Espie
1cac189077 N°4756 - Ease extensibility for CRUD operations : Fix CRUD after review 2022-12-23 10:37:08 +01:00
Eric Espie
0383fb124b N°4756 - Ease extensibility for CRUD operations : Events renamed 2022-12-22 15:28:31 +01:00
Eric Espie
f378fd3d72 N°4756 - Ease extensibility for CRUD operations : Events renamed 2022-12-22 15:22:06 +01:00
Eric Espie
44fac686f9 N°4756 - Ease extensibility for CRUD operations : Events renamed 2022-12-22 15:16:52 +01:00
Molkobain
eff2afbc69 N°4756 - Improve PHPDoc and type hints 2022-12-22 10:25:24 +01:00
Molkobain
86b3129c08 N°4756 - Fix event listeners for modules
Counter part is that we can no longer fire events before MetaModel::Startup
2022-12-22 10:21:39 +01:00
Eric Espie
bdd5741290 N°4756 - Ease extensibility for CRUD operations : Protect against update loops 2022-12-22 08:56:40 +01:00
Eric Espie
53091fc5df N°4756 - Ease extensibility for CRUD operations : 🌐 dictionaries 2022-12-21 09:03:16 +01:00
Eric Espie
06db3561dc N°4756 - Ease extensibility for CRUD operations : Protect against update loops 2022-12-20 14:26:44 +01:00
Molkobain
5cb2f19ea0 N°4756 - Improve PHPDoc and type hints 2022-12-20 11:11:14 +01:00
Eric Espie
a668b92051 N°4307 - Add option verify_peer => not novalidatecert in SMTP 2022-12-20 10:27:41 +01:00
bdalsass
eda11e97e3 N°5074 - Linkset datatable actions row improvements
Linkset updates, feedbacks 09/12:

- Distinguish action label and tool tip message
- Change default action button label Ok => Confirm
- Use action label in place of default confirm button label
- Attach do not show again preference key to table instance
- Obsolescence flag for link selection (select all)  issue correction
2022-12-20 10:10:25 +01:00
Molkobain
64146b6e1b N°5655 - Add dedicated dict entries for bulk modify/delete actions on linksets 2022-12-20 09:43:25 +01:00
Eric Espie
7b85cb92b0 💡 phpdoc 2022-12-19 09:27:46 +01:00
Eric Espie
a28fcb7c8c N°4756 - Ease extensibility for CRUD operations : Event Service - 💄 better model view display 2022-12-16 11:47:26 +01:00
Eric Espie
f8ec180a0f N°4756 - Ease extensibility for CRUD operations : Event Service - 💚 Fix CI 2022-12-16 11:42:40 +01:00
Eric Espie
0810a113c1 N°4756 - Ease extensibility for CRUD operations : Event Service - Moved Events source code under sources/application/events 2022-12-16 11:30:00 +01:00
Eric Espie
1b4a21fafa N°4756 - Ease extensibility for CRUD operations : Event Service - Moved Events source code under sources/application/events 2022-12-16 11:28:52 +01:00
Eric Espie
fae857175b N°4756 - Ease extensibility for CRUD operations : Event Service - Changed CheckToWrite and CheckToDelete events and add two new events to set attributes flags 2022-12-16 11:07:41 +01:00
Eric Espie
9c21ca2ee6 💡 phpdoc @package ventilation and @api on methods 2022-12-16 11:03:15 +01:00
Pierre Goiffon
ccdb5ec79f Merge remote-tracking branch 'origin/support/3.0' into develop 2022-12-15 15:37:09 +01:00
Pierre Goiffon
cb6232cc05 Merge remote-tracking branch 'origin/support/2.7' into support/3.0 2022-12-15 15:36:43 +01:00
Pierre Goiffon
0d49c605e2 💡 Fix \DBSearch::FromOQL phpdoc + modifiers order 2022-12-15 15:36:14 +01:00
Eric Espie
207d312b12 N°4756 - Ease extensibility for CRUD operations : Event Service - Moved ApplicationEvents 2022-12-15 14:03:23 +01:00
Eric Espie
08d83478da N°4756 - Ease extensibility for CRUD operations : Event Service - Revert default value for utils::GetClassesForInterface() 2022-12-15 13:54:51 +01:00
Eric Espie
8665f4ff06 N°4756 - Ease extensibility for CRUD operations : Event Service - PHP Doc 2022-12-15 13:46:06 +01:00
Pierre Goiffon
6a5beb89cc 📝 Version history : 2.7.0-1 was a major version
2.7.0 community was never released
2022-12-15 11:55:51 +01:00
Molkobain
3d09e3b57b Merge remote-tracking branch 'origin/support/3.0' into develop 2022-12-14 20:35:47 +01:00
Molkobain
6d47b0f4f8 N°4517 - PHP 8.0: Fix undefined array key due to type cast being done before coalesce 2022-12-14 20:34:40 +01:00
Molkobain
27cf8159d0 N°5388 - PHP 8.2: Fix dynamic properties 2022-12-14 19:55:08 +01:00
Eric Espie
314dd7d7ad Merge remote-tracking branch 'origin/develop' into develop 2022-12-14 15:50:17 +01:00
Eric Espie
6412f1ab23 Merge branch 'support/3.0' into develop
# Conflicts:
#	sources/Core/Email/EmailSwiftMailer.php
2022-12-14 15:48:52 +01:00
jbostoen
32ee1a8226 N°5793 - HTML Sanitizer: Allow 'start' attribute in 'ol' tag (#368)
* * Extended allowed attributes on ol, li (based on W3Schools)

* Change unit test case label

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
2022-12-14 15:46:59 +01:00
Eric Espie
e1c28a5c22 Merge branch 'support/2.7' into support/3.0 2022-12-14 15:45:27 +01:00
Eric Espie
296ee019a0 Merge branch 'support/2.7' into support/3.0 - nothing to do 2022-12-14 15:44:05 +01:00
Thomas Casteleyn
fe997d1254 N°2013 Fix setup when doing update to new DB (#351)
During the setup there are some queries done to the DB.
Only the config file parameters were used, meaning changing those parameters in the setup form wasn't effective :(
This is a regression made in 2.5.0 with N°1260 (MySQL TLS)
2022-12-14 10:29:58 +01:00
Eric Espie
e38951ebae N°4756 - Ease extensibility for CRUD operations : Event Service - Changed some tags 2022-12-14 09:43:41 +01:00
Molkobain
7c2f8f4d93 N°5765 - Setup: Never cache folder permissions test response (#374) 2022-12-14 09:33:54 +01:00
Pierre Goiffon
1f76ff940d N°5797 Replace wrong config load (#338) 2022-12-13 18:23:09 +01:00
Pierre Goiffon
fde6cac7a2 📝 SECURITY: Add disclosure policy (#372)
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
2022-12-13 18:15:25 +01:00
jbostoen
93209265f2 N°5792 - Update dutch translations thanks to @jbostoen 2022-12-13 17:49:32 +01:00
Eric Espie
b50675fc29 N°4756 - Ease extensibility for CRUD operations : Event Service - Fix CI 2022-12-13 13:44:20 +01:00
Eric Espie
deb6d1fd9a N°4756 - Ease extensibility for CRUD operations : Event Service - move event description to an object 2022-12-13 11:55:05 +01:00
Eric Espie
432579657c N°4756 - Ease extensibility for CRUD operations : Event Service - cleanup 2022-12-13 11:52:21 +01:00
Molkobain
f09bd5fdff N°5655 - Add icon to linkset bulk actions in case they are set as shortcut actions 2022-12-13 11:47:32 +01:00
Molkobain
4f37a9e447 N°5655 - Router: Add method to dump available routes 2022-12-13 11:47:32 +01:00
Molkobain
32297d93dd N°5655 - Add utils::ToSnakeCase() method 2022-12-13 11:47:32 +01:00
Pierre Goiffon
7083e1263d 📝 Version history : add 2.7.8 2022-12-13 10:53:59 +01:00
Eric Espie
329d1a7c41 N°4756 - Ease extensibility for CRUD operations : Event Service - documentation 2022-12-13 10:43:05 +01:00
Eric Espie
22749caeb4 N°4756 - Ease extensibility for CRUD operations : Event Service - renamed service setup interface 2022-12-13 10:19:25 +01:00
Eric Espie
baaa4474f9 N°5102 - Allow to send emails using GSuite SMTP and OAuth - cleanup unnecessary include 2022-12-13 10:01:57 +01:00
Molkobain
af804a9dc1 N°5655 - Enable bulk modify/delete on linksets 2022-12-12 23:44:31 +01:00
Molkobain
899f4fdc0a N°5655 - Fix regression from e5d67d22
Can't use "let" as this snippet seems to be evaluated several with the same variables 😭
2022-12-12 23:38:55 +01:00
Molkobain
8cced3a79e N°5655 - Refactor of menu actions generation to reduce duplicated code 2022-12-12 17:25:48 +01:00
Eric Espie
bb26e48d38 Update version to next release 2.7.9 2022-12-12 16:19:42 +01:00
Pierre Goiffon
4eb45f1b34 N°5779 iTopDesignFormatTest : test file conversion from version N to N
For example for a 3.1 version content will try to convert the file from 3.0 to 3.1
2022-12-12 10:48:59 +01:00
Pierre Goiffon
c2f503e2ac N°5779 update-xml : update code using iterators 2022-12-12 09:28:42 +01:00
Pierre Goiffon
e4e654100e N°5779 update-xml : check we are indeed targeting all of the design files 2022-12-09 18:19:15 +01:00
Pierre Goiffon
3270c3f775 🔨 N°5779 update-xml : if XML files already at current version, tries to convert from previous one 2022-12-08 17:08:00 +01:00
Eric Espie
7f88a6aa1a Merge branch 'support/3.0' into develop
# Conflicts:
#	datamodels/2.x/itop-portal-base/portal/src/Twig/AppExtension.php
2022-12-08 08:39:55 +01:00
Eric Espie
26042b990f Merge branch 'support/2.7' into support/3.0
# Conflicts:
#	datamodels/2.x/itop-portal-base/portal/src/Twig/AppExtension.php
2022-12-08 08:34:16 +01:00
Eric Espie
cf433f2f80 N°5725 - Twig update 'filter', 'map' and 'reduce' filters 2022-12-08 08:25:11 +01:00
Eric Espie
c02f84969a N°4756 - Ease extensibility for CRUD operations : Event Service 2022-12-08 08:21:13 +01:00
Eric Espie
bdebea62b6 N°5394 - use session for the FSM (use Session object) 2022-12-08 08:21:13 +01:00
Pierre Goiffon
4a22361f39 🔨 N°5633 update-xml.php : add new XML dir (/application and /core) 2022-12-07 17:40:48 +01:00
Pierre Goiffon
025f8b9dc3 🔨 N°5633 update-xml.php : if no version passed, assuming current version 2022-12-07 17:40:48 +01:00
Benjamin Dalsass
9defedb862 N°5073 - Issue, row actions listeners lost on refresh 2022-12-07 15:31:19 +01:00
Eric Espie
ae94e58a43 N°5725 - Twig update 'filter', 'map' and 'reduce' filters 2022-12-07 13:53:15 +01:00
Eric Espie
e4d8489292 Merge branch 'support/3.0' into develop
# Conflicts:
#	datamodels/2.x/itop-portal-base/portal/src/Twig/AppExtension.php
2022-12-07 13:52:42 +01:00
Eric Espie
f66692d5cf Merge branch 'support/2.7' into support/3.0
# Conflicts:
#	datamodels/2.x/itop-portal-base/portal/src/Twig/AppExtension.php
2022-12-07 13:44:54 +01:00
Eric Espie
2b917f6647 Merge branch 'support/2.7' into support/3.0
# Conflicts:
#	datamodels/2.x/itop-oauth-client/src/Service/PopupMenuExtension.php
2022-12-07 13:42:36 +01:00
Eric Espie
cda017fa4f N°5725 - Twig update 'filter', 'map' and 'reduce' filters 2022-12-07 13:37:52 +01:00
Pierre Goiffon
dad22f6f83 📄 Update Licenses 2022-12-07 11:04:33 +01:00
Eduardo Mozart de Oliveira
0579f1b1dc Add Windows / macOS auto-generated files to .gitignore (#367)
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
2022-12-06 18:08:51 +01:00
Pierre Goiffon
a551bf0499 📝 CONTRIBUTING: Improvements (#371) 2022-12-06 17:19:44 +01:00
vdumas
4f36819ab2 Fix @param & @return comments for GetTagFromLabel 2022-12-06 16:43:55 +01:00
Stephen Abello
26359cf1ee Move datatable SCSS files under the same directory 2022-12-06 16:14:42 +01:00
Stephen Abello
00a25f3e8b Move datatable SCSS files under the same directory 2022-12-06 16:10:58 +01:00
Molkobain
2d122448c8 N°5655 - Fix is_callable() call for PHP 8.0+ 2022-12-06 16:04:26 +01:00
Molkobain
e5d67d2219 N°5655 - Small refactor for better reading 2022-12-06 14:07:15 +01:00
Molkobain
4ac0de5fff N°5655 - Code format 2022-12-06 14:07:15 +01:00
bdalsass
dbe7fae82e Feature/modals - generic modal API (#373)
Default modal JS Implementation:

Add title option
Add buttons option
Change template cloning
Confirmation Modal:

Add implementation
Do not show again functionality
Web Page:

Add blocks array with twig loop insertion
2022-12-06 10:18:59 +01:00
Stephen Abello
98a53a46f0 Fix "Configure this list" modal content display 2022-12-02 15:33:35 +01:00
Eric Espie
e6946d33e6 Merge branch 'support/3.0' into develop 2022-12-02 11:21:04 +01:00
Eric Espie
9474f43d61 Merge branch 'support/2.7' into support/3.0
# Conflicts:
#	datamodels/2.x/itop-oauth-client/src/Service/PopupMenuExtension.php
2022-12-02 11:20:31 +01:00
Eric Espie
9077f7ba37 N°5430 - OAuth authentication : customize redirect landing URL - remove unnecessary parameter to JS function OAuthConnect 2022-12-02 11:17:01 +01:00
Eric Espie
3548251997 Merge branch 'support/3.0' into develop 2022-12-02 09:27:40 +01:00
Eric Espie
4d365c8a44 Merge branch 'support/2.7' into support/3.0 2022-12-02 09:26:40 +01:00
Eric Espie
957ff40f30 N°5155 - Email by SMTP with self-signed certificate (changed default values to the previous behaviour) 2022-12-02 09:25:53 +01:00
Eric Espie
93e0dde1a1 Merge branch 'support/3.0' into develop
# Conflicts:
#	sources/Core/Email/EmailSwiftMailer.php

Email by SMTP with self-signed certificate ported from EmailSwiftMailer to EmailLaminas
2022-11-30 14:35:13 +01:00
Eric Espie
7bb12c35ea Merge branch 'support/2.7' into support/3.0
# Conflicts:
#	core/config.class.inc.php
2022-11-30 14:27:32 +01:00
Eric Espie
aff9c7748b N°5155 - Email by SMTP with self-signed certificate 2022-11-30 14:18:11 +01:00
Eric Espie
e518d34bc9 N°5553 - OAuth 2 : Hide Client Secret
* client_id is now 255 chars (AttributeString)
 * client_secret is now 64 chars (AttributePassword) and cannot be anymore in the uniqueness rules
 * The modification of redirect_url, client_id or client_secret change the status to inactive and generate a session message to ask for token regeneration
2022-11-30 14:15:37 +01:00
Eric Espie
f02e95e8bf Merge branch 'support/3.0' into develop
# Conflicts:
#	datamodels/2.x/itop-portal-base/portal/src/Twig/AppExtension.php
#	test/twig/test.html
#	test/twig/test.html.twig
2022-11-30 13:57:28 +01:00
Eric Espie
51a305b445 N°5725 - Twig update 'filter', 'map' and 'reduce' filters (twig functions signature changed) 2022-11-30 13:40:44 +01:00
Eric Espie
5577f4a62e Merge remote-tracking branch 'origin/support/2.7' into support/3.0 2022-11-30 13:36:18 +01:00
Eric Espie
f0141530b9 N°5725 - Twig update 'filter', 'map' and 'reduce' filters (+1 squashed commits)
Squashed commits:

[00148dec5] N°5725 - Twig update 'filter', 'map' and 'reduce' filters
2022-11-30 13:28:33 +01:00
Vladimir Kunin
98bcfeb2ba 🐛 N°5369 - Fix BrowseBrick tree "opening_target" mode for "self" and "new" values (#299)
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
2022-11-30 11:45:06 +01:00
Pierre Goiffon
669c69ff39 Merge remote-tracking branch 'origin/support/3.0' into develop 2022-11-29 19:04:04 +01:00
Pierre Goiffon
92a802947d Merge remote-tracking branch 'origin/support/2.7' into support/3.0
# Conflicts:
#	setup/wizardsteps.class.inc.php
2022-11-29 19:02:51 +01:00
xtophe38
ce5096a896 N°5758 Change setup test for GDPR consent (#336)
We were using SetupUtils::IsProductVersion, but this was blocking for certain packages like TeemIP standalone.
After this change we are now relying on a new method : \SetupUtils::IsConnectableToITopHub. It will check the iTop Hub Connector module presence instead.
2022-11-29 19:00:17 +01:00
Pierre Goiffon
c5e00194b7 Merge remote-tracking branch 'origin/support/3.0' into develop
# Conflicts:
#	pages/ajax.render.php
2022-11-29 18:22:35 +01:00
Pierre Goiffon
5efd45eafc Merge remote-tracking branch 'origin/support/2.7' into support/3.0
# Conflicts:
#	pages/ajax.render.php
2022-11-29 18:18:24 +01:00
Pierre Goiffon
23e0ed5e56 N°4449 Test for FPD detection in RuntimeDashboard 2022-11-29 18:10:17 +01:00
Pierre Goiffon
d412a52fcc N°4449 Fix FPD in dashboard export/import 2022-11-29 18:10:17 +01:00
Eric Espie
ded2f8af9a Fix CI 2022-11-29 14:39:16 +01:00
Molkobain
084f3ec52b N°5655 - Continue work on CombodoModal Part 2 2022-11-28 15:57:25 +01:00
Molkobain
bedc8bbf46 Merge remote-tracking branch 'origin/support/3.0' into develop 2022-11-26 00:25:05 +01:00
Molkobain
cf5745b985 Merge remote-tracking branch 'origin/support/2.7' into support/3.0
# Conflicts:
#	core/pdfbulkexport.class.inc.php
2022-11-26 00:09:10 +01:00
Molkobain
3e18ad590f Fix image attributes not being visible in PDF exports 2022-11-25 19:30:35 +01:00
Eric Espie
b174aa9aeb Merge remote-tracking branch 'origin/support/2.7' into support/3.0
# Conflicts:
#	datamodels/2.x/itop-oauth-client/vendor/composer/InstalledVersions.php
#	datamodels/2.x/itop-oauth-client/vendor/composer/installed.php
2022-11-25 17:37:01 +01:00
652 changed files with 20192 additions and 9794 deletions

View File

@@ -3,14 +3,14 @@
```mermaid
%%{init: { 'logLevel': 'debug', 'theme': 'base', 'gitGraph': {'showBranches': true,'mainBranchName': 'develop','rotateCommitLabel': true}} }%%
gitGraph
commit id: "2016-07-06" tag: "2.3.0"
commit id: "2016-07-06" tag: "2.3.0" type: HIGHLIGHT
branch support/2.3 order: 900
commit id: "2016-07-08" tag: "2.3.1"
commit id: "2016-12-22" tag: "2.3.3"
commit id: "2017-04-14" tag: "2.3.4"
checkout develop
commit id: "2017-07-12" tag: "2.4.0-beta" type: REVERSE
commit id: "2017-11-16" tag: "2.4.0"
commit id: "2017-11-16" tag: "2.4.0" type: HIGHLIGHT
branch support/2.4 order: 890
commit id: "2018-02-14" tag: "2.4.1"
checkout develop
@@ -18,10 +18,10 @@ gitGraph
checkout support/2.4
commit id: "2018-06-14" tag: "2.4.2"
checkout develop
commit id: "2018-06-27" tag: "2.5.0"
commit id: "2018-06-27" tag: "2.5.0" type: HIGHLIGHT
branch support/2.5 order: 880
checkout develop
commit id: "2019-01-09" tag: "2.6.0"
commit id: "2019-01-09" tag: "2.6.0" type: HIGHLIGHT
branch support/2.6 order: 870
commit id: "2019-03-28" tag: "2.6.1"
checkout develop
@@ -32,11 +32,11 @@ gitGraph
commit id: "2020-01-23" tag: "2.6.3"
checkout develop
commit id: "2020-01-29" tag: "2.7.0-beta2" type: REVERSE
branch support/2.7 order: 860
commit id: "2020-04-01" tag: "2.7.0-1"
commit id: "2020-04-01" tag: "2.7.0-1" type: HIGHLIGHT
checkout support/2.6
commit id: "2020-04-22" tag: "2.6.4"
checkout support/2.7
checkout develop
branch support/2.7 order: 860
commit id: "2020-06-26" tag: "2.7.1"
checkout support/2.7
commit id: "2020-12-09" tag: "2.7.3"
@@ -50,7 +50,7 @@ gitGraph
checkout support/2.7
commit id: "2021-12-17" tag: "2.7.6"
checkout develop
commit id: "2022-01-04" tag: "3.0.0"
commit id: "2022-01-04" tag: "3.0.0" type: HIGHLIGHT
branch support/3.0 order: 850
commit id: "2022-04-08" tag: "3.0.1"
checkout support/2.7
@@ -58,4 +58,8 @@ gitGraph
checkout support/3.0
commit id: "2022-09-12" tag: "3.0.2-1"
checkout develop
checkout support/2.7
commit id: "2022-12-28" tag: "2.7.8"
```
To learn more, check the [iTop community versions history on the official wiki](https://www.itophub.io/wiki/page?id=latest:release:start).

11
.gitignore vendored
View File

@@ -19,7 +19,7 @@
# composer reserver directory, from sources, populate/update using "composer install"
vendor/*
test/vendor/*
tests/*/vendor/*
# all conf but listing prevention
/conf/**
@@ -46,7 +46,7 @@ test/vendor/*
!/log/web.config
# PHPUnit cache file
/test/.phpunit.result.cache
/tests/php-unit-tests/.phpunit.result.cache
# Jetbrains
@@ -146,3 +146,10 @@ local.properties
.cache-main
.scala_dependencies
.worksheet
# Mac
.DS_Store
# Windows
Thumbs.db

View File

@@ -6,12 +6,19 @@
* Will update version in the following files :
*
* datamodels/2.x/.../datamodel.*.xml
* application/*.xml
* core/*.xml
*
* Usage :
* `php .make\release\update-xml.php "1.7"`
* `php .make\release\update-xml.php`
*
* If no parameter provided then the current XML version will be used as target version
*
* @since 2.7.0 simple version change using regexp (not doing conversion)
* @since 3.1.0 N°5405 now does a real conversion
* @since 3.1.0 N°5633 allow to use without parameter
* @since 3.1.0 N°5633 add /application and /core XML files
******************************************************************************/
@@ -23,10 +30,12 @@ require_once (__DIR__.DIRECTORY_SEPARATOR.'update.classes.inc.php');
if (count($argv) === 1)
{
echo '/!\ You must pass the new version as parameter';
exit(1);
echo '/!\ No version passed: assuming target XML version is current XML version ('.ITOP_DESIGN_LATEST_VERSION.")\n";
$sVersionLabel = ITOP_DESIGN_LATEST_VERSION;
} else {
$sVersionLabel = $argv[1];
}
$sVersionLabel = $argv[1];
if (empty($sVersionLabel))
{
echo 'Version passed as parameter is empty !';

View File

@@ -125,16 +125,31 @@ class iTopVersionFileUpdater extends AbstractSingleFileVersionUpdater
abstract class AbstractGlobFileVersionUpdater extends FileVersionUpdater
{
protected $sGlobPattern;
/** @var array|string glob patterns to seek for files to modify */
protected $globPattern;
public function __construct($sGlobPattern)
public function __construct($globPattern)
{
$this->sGlobPattern = $sGlobPattern;
$this->globPattern = $globPattern;
}
public function GetFiles()
{
return glob($this->sGlobPattern);
$aGlobPatterns = (is_array($this->globPattern))
? $this->globPattern
: [$this->globPattern];
$aFiles = [];
foreach ($aGlobPatterns as $sGlobPattern) {
$result = glob($sGlobPattern);
if (false === $result) {
continue;
}
/** @noinspection SlowArrayOperationsInLoopInspection */
$aFiles = array_merge($aFiles, $result);
}
return $aFiles;
}
}
@@ -166,7 +181,11 @@ class DatamodelsXmlFiles extends AbstractGlobFileVersionUpdater
{
public function __construct()
{
parent::__construct(APPROOT.'datamodels/2.x/*/datamodel.*.xml');
parent::__construct([
APPROOT.'datamodels/2.x/*/datamodel.*.xml',
APPROOT.'application/*.xml',
APPROOT.'core/*.xml',
]);
}
/**
@@ -183,6 +202,13 @@ class DatamodelsXmlFiles extends AbstractGlobFileVersionUpdater
$oFileXml->loadXML($sFileContent);
$oFileItopFormat = new iTopDesignFormat($oFileXml);
$sDesignVersionToSet = static::GetDesignVersionToSet($oFileItopFormat->GetVersion());
if (false === is_null($sDesignVersionToSet)) {
// N°5779 if same as target version, we will try to convert from version below
$oFileItopFormat->GetITopDesignNode()->setAttribute('version', $sDesignVersionToSet);
}
$bConversionResult = $oFileItopFormat->Convert($sVersionLabel);
if (false === $bConversionResult) {
@@ -191,4 +217,16 @@ class DatamodelsXmlFiles extends AbstractGlobFileVersionUpdater
return $oFileItopFormat->GetXmlAsString();
}
/**
* @return ?string version to use : if file version is same as current version then return previous version, else return null
* @since 3.1.0 N°5779
*/
protected static function GetDesignVersionToSet($sFileDesignVersion):?string {
if ($sFileDesignVersion !== ITOP_DESIGN_LATEST_VERSION) {
return null;
}
return iTopDesignFormat::GetPreviousDesignVersion(ITOP_DESIGN_LATEST_VERSION);
}
}

View File

@@ -134,15 +134,16 @@ Our tests are located in the `test/` directory, containing a PHPUnit config file
When your code is working, please:
* squash as much as possible your commits,
* rebase your branch on our repo last commit,
* create a pull request
* mind to check the "[Allow edits from maintainers](https://docs.github.com/en/github-ae@latest/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork)" option !
Detailed procedure to work on fork and create PR is available [in GitHub help pages](https://help.github.com/articles/creating-a-pull-request-from-a-fork/).
* Squash as much as possible your commits,
* Rebase your branch on our repo last commit,
* Create a pull request. _Detailed procedure to work on fork and create PR is available [in GitHub help pages](https://help.github.com/articles/creating-a-pull-request-from-a-fork/)_.
* Pull request description: mind to add all the information useful to understand why you're suggesting this modification and anything necessary to dive into your work. Especially:
- Bugfixes: exact steps to reproduce the bug (given/when/then), description of the bug cause and what solution is implemented
- Enhancements: use cases, implementation details if needed
* Mind to check the "[Allow edits from maintainers](https://docs.github.com/en/github-ae@latest/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork)" option !
### 🙏 We are thankful
## 🙏 We are thankful
We are thankful for all your contributions to the iTop universe! As a thank you gift, we will send stickers to every iTop (& extensions) contributors!

8
Jenkinsfile vendored
View File

@@ -1,6 +1,14 @@
def infra
node(){
properties([
buildDiscarder(
logRotator(
daysToKeepStr: "28",
numToKeepStr: "500")
)
])
checkout scm
infra = load '/var/lib/jenkins/workspace/itop-test-infra_master/src/Infra.groovy'

View File

@@ -3,9 +3,9 @@
</a></p>
iTop stands for IT Operations Portal. It is a complete open source and web based IT service management platform including a fully customizable CMDB, a helpdesk system and a document management tool. It is ITIL compliant and easily customizable and extensible thanks to a high number of adds-on and web services to integrate with your IT.
iTop stands for IT Operations Portal. It is a complete open source and web-based IT service management platform, including a fully customizable CMDB, a helpdesk system, and a document management tool. It is ITIL compliant and easily customizable and extensible thanks to a high number of add-ons and web services to integrate with your IT.
iTop also offers mass import tools to help you being even more efficient.
iTop also offers mass import tools to help you become even more efficient.
## Features
- Fully configurable [Configuration Management (CMDB)][10]
@@ -65,7 +65,7 @@ iTop also offers mass import tools to help you being even more efficient.
## About Us
iTop development is sponsored, led and supported by [Combodo][0].
iTop development is sponsored, led, and supported by [Combodo][0].
[0]: https://www.combodo.com

View File

@@ -18,8 +18,7 @@ to [itop-security@combodo.com](mailto:itop-security@combodo.com).
## 📆 Disclosure Policy
## 🔍 Combodo acknowledgment and investigation
Report sent to us will be acknowledged within the week.
Then, a Combodo developer will be assigned to the reported issue and will:
@@ -34,3 +33,12 @@ Then, a Combodo developer will be assigned to the reported issue and will:
Security issues always take precedence over bug fixes and feature work.
The assignee will keep you informed of the resolution progress, and may ask you for additional information or guidance.
## 📆 Disclosure Policy
Once the fix is done and acknowledged by every stakeholder, it will be included in the next iTop version.
Mind we have at least 2 active branches (LTS and STS, see [iTop Community Releases [iTop Documentation]](https://www.itophub.io/wiki/page?id=latest:release:start))
The release communications will include the information of the vulnerability fix.
Corresponding GitHub advisories and CVE will be published 3 months after the iTop version release date so that iTop instances can be updated.

View File

@@ -12,6 +12,7 @@ require_once(APPROOT.'/application/applicationcontext.class.inc.php');
require_once(APPROOT.'/application/cmdbabstract.class.inc.php');
require_once(APPROOT.'/application/displayblock.class.inc.php');
require_once(APPROOT.'/application/audit.category.class.inc.php');
require_once(APPROOT.'/application/audit.domain.class.inc.php');
require_once(APPROOT.'/application/audit.rule.class.inc.php');
require_once(APPROOT.'/application/query.class.inc.php');
require_once(APPROOT.'/setup/moduleinstallation.class.inc.php');

View File

@@ -1,29 +0,0 @@
<?php
/*
* @copyright Copyright (C) 2010-2022 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
use Combodo\iTop\Service\EventService;
use Combodo\iTop\Service\iEventEnrolment;
class ApplicationEvents implements iEventEnrolment
{
// Startup events
const APPLICATION_EVENT_REQUEST_RECEIVED = 'APPLICATION_EVENT_REQUEST_RECEIVED';
const APPLICATION_EVENT_METAMODEL_STARTED = 'APPLICATION_EVENT_METAMODEL_STARTED';
/**
* @inheritDoc
*/
public function InitEvents()
{
EventService::RegisterEvent(self::APPLICATION_EVENT_REQUEST_RECEIVED, [
'description' => 'A request was received from the network, at this point only the session is started, the configuration is not even loaded',
], 'application');
EventService::RegisterEvent(self::APPLICATION_EVENT_METAMODEL_STARTED, [
'description' => 'The MetaModel is fully started',
], 'application');
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -20,7 +20,7 @@
/**
* This class manages the audit "categories". Each category defines a set of objects
* to check and is linked to a set of rules that determine the valid or invalid objects
* inside the set
* inside the set
*
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
@@ -48,13 +48,39 @@ class AuditCategory extends cmdbAbstractObject
MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeOQL("definition_set", array("allowed_values"=>null, "sql"=>"definition_set", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSet("rules_list", array("linked_class"=>"AuditRule", "ext_key_to_me"=>"category_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array(), "edit_mode" => LINKSET_EDITMODE_INPLACE, "tracking_level" => LINKSET_TRACKING_ALL)));
MetaModel::Init_AddAttribute(new AttributeInteger("ok_error_tolerance", array("allowed_values"=>null, "sql"=>"ok_error_tolerance", "default_value"=>5, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeInteger("warning_error_tolerance", array("allowed_values"=>null, "sql"=>"warning_error_tolerance", "default_value"=>25, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("domains_list", array("linked_class" => "lnkAuditCategoryToAuditDomain", "ext_key_to_me" => "category_id", "ext_key_to_remote" => "domain_id", "allowed_values" => null, "count_min" => 0, "count_max" => 0, "depends_on" => array())));
// Display lists
MetaModel::Init_SetZListItems('details', array('name', 'description', 'definition_set', 'rules_list')); // Attributes to be displayed for the complete details
MetaModel::Init_SetZListItems('details', array('name', 'description', 'definition_set', 'ok_error_tolerance', 'warning_error_tolerance', 'rules_list', 'domains_list')); // Attributes to be displayed for the complete details
MetaModel::Init_SetZListItems('list', array('description', )); // Attributes to be displayed for a list
// Search criteria
MetaModel::Init_SetZListItems('standard_search', array('description', 'definition_set')); // Criteria of the std search form
MetaModel::Init_SetZListItems('default_search', array('name', 'description')); // Criteria of the default search form
}
/**
* @param int $iTotal
* @param int $iErrors
*
* @return string A semantic color name (eg. red, green, orange, success, failure, ... {@see css/backoffice/utils/variables/colors/_semantic-palette.scss}) to use for this category depending on its error count and tolerance
* @throws \CoreException
*
* @since 3.1.0
*/
public function GetReportColor($iTotal, $iErrors)
{
$sResult = 'red';
if ( ($iTotal == 0) || ($iErrors / $iTotal) <= ($this->Get('ok_error_tolerance') / 100) )
{
$sResult = 'green';
}
else if ( ($iErrors / $iTotal) <= ($this->Get('warning_error_tolerance') / 100) )
{
$sResult = 'orange';
}
return $sResult;
}
}
?>

View File

@@ -0,0 +1,99 @@
<?php
// Copyright (C) 2010-2021 Combodo SARL
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// iTop 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
/**
* This class manages the audit "categories". Each category defines a set of objects
* to check and is linked to a set of rules that determine the valid or invalid objects
* inside the set
*
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
/**
* @since 3.1.0
*/
class AuditDomain extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "application, grant_by_profile",
"key_type" => "autoincrement",
"name_attcode" => "name",
"state_attcode" => "",
"reconc_keys" => array('name'),
"db_table" => "priv_auditdomain",
"db_key_field" => "id",
"db_finalclass_field" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_AddAttribute(new AttributeString("name", array("description"=>"Short name for this category", "allowed_values"=>null, "sql"=>"name", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeImage("icon", array("is_null_allowed"=>true, "depends_on"=>array(), "display_max_width"=>96, "display_max_height"=>96, "storage_max_width"=>256, "storage_max_height"=>256, "default_image"=>null, "always_load_in_tables"=>false)));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("categories_list", array("linked_class" => "lnkAuditCategoryToAuditDomain", "ext_key_to_me" => "domain_id", "ext_key_to_remote" => "category_id", "allowed_values" => null, "count_min" => 0, "count_max" => 0, "depends_on" => array())));
// Display lists
MetaModel::Init_SetZListItems('details', array('name', 'description', 'icon', 'categories_list')); // Attributes to be displayed for the complete details
MetaModel::Init_SetZListItems('list', array('description', )); // Attributes to be displayed for a list
// Search criteria
MetaModel::Init_SetZListItems('standard_search', array('description')); // Criteria of the std search form
MetaModel::Init_SetZListItems('default_search', array('name', 'description')); // Criteria of the default search form
}
}
/**
* @since 3.1.0
*/
class lnkAuditCategoryToAuditDomain extends cmdbAbstractObject
{
/**
* @throws \CoreException
* @throws \Exception
*/
public static function Init()
{
$aParams = array
(
"category" => "application, grant_by_profile",
"key_type" => "autoincrement",
"name_attcode" => "",
"state_attcode" => "",
"reconc_keys" => array('category_id', 'domain_id'),
"db_table" => "priv_link_audit_category_domain",
"db_key_field" => "id",
"db_finalclass_field" => "",
"is_link" => true,
);
MetaModel::Init_Params($aParams);
MetaModel::Init_AddAttribute(new AttributeExternalKey("category_id", array("targetclass" => "AuditCategory", "jointype" => '', "allowed_values" => null, "sql" => "category_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("category_name", array("allowed_values" => null, "extkey_attcode" => 'category_id', "target_attcode" => "name")));
MetaModel::Init_AddAttribute(new AttributeExternalKey("domain_id", array("targetclass" => "AuditDomain", "jointype" => '', "allowed_values" => null, "sql" => "domain_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("domain_name", array("allowed_values" => null, "extkey_attcode" => 'domain_id', "target_attcode" => "name")));
// Display lists
MetaModel::Init_SetZListItems('details', array('category_id', 'domain_id'));
MetaModel::Init_SetZListItems('list', array('category_id', 'domain_id'));
// Search criteria
MetaModel::Init_SetZListItems('standard_search', array('category_id', 'domain_id'));
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1549,6 +1549,29 @@ JS
return $this->sDefinitionFile;
}
/**
* @param string $sDashboardFileRelative can also be an absolute path (compatibility with old URL)
*
* @return string full path to the Dashboard file
* @throws \SecurityException if path isn't under approot
* @uses utils::RealPath()
* @since 2.7.8 3.0.3 3.1.0 N°4449 remove FPD
*/
public static function GetDashboardFileFromRelativePath($sDashboardFileRelative)
{
if (utils::RealPath($sDashboardFileRelative, APPROOT)) {
// compatibility with old URL containing absolute path !
return $sDashboardFileRelative;
}
$sDashboardFile = APPROOT.$sDashboardFileRelative;
if (false === utils::RealPath($sDashboardFile, APPROOT)) {
throw new SecurityException('Invalid dashboard file !');
}
return $sDashboardFile;
}
/**
* @param string $sDefinitionFile
*/

View File

@@ -55,9 +55,9 @@
<menus>
<menu id="WelcomeMenu" xsi:type="MenuGroup" _delta="define">
<rank>10</rank>
<style>
<decoration_classes>fas fa-home</decoration_classes>
</style>
<style>
<decoration_classes>fas fa-home</decoration_classes>
</style>
</menu>
<menu id="WelcomeMenuPage" xsi:type="DashboardMenuNode" _delta="define">
<rank>10</rank>
@@ -151,9 +151,9 @@
</menu>
<menu id="ConfigurationTools" xsi:type="MenuGroup" _delta="define_if_not_exists">
<rank>90</rank>
<style>
<decoration_classes>fas fa-cog</decoration_classes>
</style>
<style>
<decoration_classes>fas fa-cog</decoration_classes>
</style>
</menu>
<menu id="DataSources" xsi:type="OQLMenuNode" _delta="define">
<rank>20</rank>
@@ -172,29 +172,29 @@
</menu>
<menu id="AdminTools" xsi:type="MenuGroup" _delta="define">
<rank>80</rank>
<style>
<decoration_classes>fas fa-tools</decoration_classes>
</style>
<style>
<decoration_classes>fas fa-tools</decoration_classes>
</style>
</menu>
<menu id="SystemTools" xsi:type="MenuGroup" _delta="define">
<rank>100</rank>
<enable_class>ResourceSystemMenu</enable_class>
<enable_action>UR_ACTION_MODIFY</enable_action>
<style>
<decoration_classes>fas fa-terminal</decoration_classes>
</style>
<style>
<decoration_classes>fas fa-terminal</decoration_classes>
</style>
</menu>
</menus>
<events>
<event id="EVENT_SERVICE_DB_INSERT_REQUESTED" _delta="define">
<description>An object insert in the database has been requested. All changes to the object will be persisted automatically.</description>
<event id="EVENT_DB_CHECK_TO_WRITE" _delta="define">
<description>Check an object before it is written into the database (no change possible). Call DBObject::AddCheckIssue() to signal an issue</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
</sources>
<replaces>DBObject::OnInsert</replaces>
<replaces>cmdbAbstractObject::DoCheckToWrite</replaces>
<event_data>
<event_datum id="object">
<description>The object inserted</description>
<description>The object to check</description>
<type>DBObject</type>
</event_datum>
<event_datum id="debug_info">
@@ -203,25 +203,8 @@
</event_datum>
</event_data>
</event>
<event id="EVENT_SERVICE_DB_ABOUT_TO_INSERT" _delta="define">
<description>An object is about to be inserted in the database (no change possible)</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
</sources>
<replaces>DBObject::OnInsert</replaces>
<event_data>
<event_datum id="object">
<description>The object inserted</description>
<type>DBObject</type>
</event_datum>
<event_datum id="debug_info">
<description>Debug string</description>
<type>string</type>
</event_datum>
</event_data>
</event>
<event id="EVENT_SERVICE_DB_INSERT_DONE" _delta="define">
<description>An object has been inserted into the database (but not reloaded). All changes to the object will be persisted automatically.</description>
<event id="EVENT_DB_CREATE_DONE" _delta="define">
<description>An object has been created into the database. The modifications can be propagated to other objects.</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
</sources>
@@ -237,42 +220,8 @@
</event_datum>
</event_data>
</event>
<event id="EVENT_SERVICE_DB_UPDATE_REQUESTED" _delta="define">
<description>An object update has been requested. All changes to the object will be persisted automatically.</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
</sources>
<replaces>DBObject::OnUpdate, DBObject::DoComputeValues</replaces>
<event_data>
<event_datum id="object">
<description>The object updated</description>
<type>DBObject</type>
</event_datum>
<event_datum id="debug_info">
<description>Debug string</description>
<type>string</type>
</event_datum>
</event_data>
</event>
<event id="EVENT_SERVICE_DB_ABOUT_TO_UPDATE" _delta="define">
<description>An object is about to be updated in the database (no change possible)</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
</sources>
<replaces>DBObject::OnUpdate</replaces>
<event_data>
<event_datum id="object">
<description>The object updated</description>
<type>DBObject</type>
</event_datum>
<event_datum id="debug_info">
<description>Debug string</description>
<type>string</type>
</event_datum>
</event_data>
</event>
<event id="EVENT_SERVICE_DB_UPDATE_DONE" _delta="define">
<description>An object has been updated into the database and reloaded. All changes to the object will be persisted automatically.</description>
<event id="EVENT_DB_UPDATE_DONE" _delta="define">
<description>An object has been updated into the database and reloaded.</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
</sources>
@@ -288,15 +237,15 @@
</event_datum>
</event_data>
</event>
<event id="EVENT_SERVICE_DB_ABOUT_TO_DELETE" _delta="define">
<description>An object is about to be deleted in the database</description>
<event id="EVENT_DB_CHECK_TO_DELETE" _delta="define">
<description>Check an object before it is deleted from the database. Call DBObject::AddDeleteIssue() to signal an issue</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
</sources>
<replaces>DBObject::OnDelete</replaces>
<replaces>cmdbAbstractObject::DoCheckToDelete</replaces>
<event_data>
<event_datum id="object">
<description>The object deleted</description>
<description>The object to check</description>
<type>DBObject</type>
</event_datum>
<event_datum id="debug_info">
@@ -305,7 +254,7 @@
</event_datum>
</event_data>
</event>
<event id="EVENT_SERVICE_DB_DELETE_DONE" _delta="define">
<event id="EVENT_DB_DELETE_DONE" _delta="define">
<description>An object has been deleted into the database</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
@@ -322,7 +271,7 @@
</event_datum>
</event_data>
</event>
<event id="EVENT_SERVICE_DB_BEFORE_APPLY_STIMULUS" _delta="define">
<event id="EVENT_DB_BEFORE_APPLY_STIMULUS" _delta="define">
<description>A stimulus is about to be applied to an object</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
@@ -354,7 +303,7 @@
</event_datum>
</event_data>
</event>
<event id="EVENT_SERVICE_DB_AFTER_APPLY_STIMULUS" _delta="define">
<event id="EVENT_DB_AFTER_APPLY_STIMULUS" _delta="define">
<description>A stimulus has been applied to an object</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
@@ -386,7 +335,7 @@
</event_datum>
</event_data>
</event>
<event id="EVENT_SERVICE_DB_APPLY_STIMULUS_FAILED" _delta="define">
<event id="EVENT_DB_APPLY_STIMULUS_FAILED" _delta="define">
<description>A stimulus has failed</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
@@ -422,7 +371,23 @@
</event_datum>
</event_data>
</event>
<event id="EVENT_SERVICE_DB_OBJECT_RELOAD" _delta="define">
<event id="EVENT_DB_LINKS_CHANGED" _delta="define">
<description>At least one link class was changed</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
</sources>
<event_data>
<event_datum id="object">
<description>The object where the link is or was pointing to</description>
<type>DBObject</type>
</event_datum>
<event_datum id="debug_info">
<description>Debug string</description>
<type>string</type>
</event_datum>
</event_data>
</event>
<event id="EVENT_DB_OBJECT_RELOAD" _delta="define">
<description>An object has been re-loaded from the database</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
@@ -438,7 +403,7 @@
</event_datum>
</event_data>
</event>
<event id="EVENT_SERVICE_DB_COMPUTE_VALUES" _delta="define">
<event id="EVENT_DB_COMPUTE_VALUES" _delta="define">
<description>An object needs to be recomputed after changes</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
@@ -455,49 +420,7 @@
</event_datum>
</event_data>
</event>
<event id="EVENT_SERVICE_DB_CHECK_TO_WRITE" _delta="define">
<description>Check an object before it is written into the database (no change possible)</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
</sources>
<replaces>cmdbAbstractObject::DoCheckToWrite</replaces>
<event_data>
<event_datum id="object">
<description>The object to check</description>
<type>DBObject</type>
</event_datum>
<event_datum id="error_messages">
<description>Array of strings where all the errors found during the object checking are added</description>
<type>array</type>
</event_datum>
<event_datum id="debug_info">
<description>Debug string</description>
<type>string</type>
</event_datum>
</event_data>
</event>
<event id="EVENT_SERVICE_DB_CHECK_TO_DELETE" _delta="define">
<description>Check an object before it is deleted from the database (no change possible)</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
</sources>
<replaces>cmdbAbstractObject::DoCheckToDelete</replaces>
<event_data>
<event_datum id="object">
<description>The object to check</description>
<type>DBObject</type>
</event_datum>
<event_datum id="error_messages">
<description>Array of strings where all the errors found during the object checking are added</description>
<type>array</type>
</event_datum>
<event_datum id="debug_info">
<description>Debug string</description>
<type>string</type>
</event_datum>
</event_data>
</event>
<event id="EVENT_SERVICE_DB_ARCHIVE" _delta="define">
<event id="EVENT_DB_ARCHIVE" _delta="define">
<description>An object has been archived</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
@@ -513,7 +436,7 @@
</event_datum>
</event_data>
</event>
<event id="EVENT_SERVICE_DB_UNARCHIVE" _delta="define">
<event id="EVENT_DB_UNARCHIVE" _delta="define">
<description>An object has been unarchived</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
@@ -529,7 +452,43 @@
</event_datum>
</event_data>
</event>
<event id="EVENT_SERVICE_DOWNLOAD_DOCUMENT" _delta="define">
<event id="EVENT_DB_SET_ATTRIBUTES_FLAGS" _delta="define">
<description>Set object attributes flags. Call cmdbAbstractObject::AddAttributeFlags() for all the attributes to be set for this target state.</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
</sources>
<event_data>
<event_datum id="object">
<description>The current object</description>
<type>DBObject</type>
</event_datum>
<event_datum id="target_state">
<description>The target state in which to evaluate the flags</description>
<type>array</type>
</event_datum>
<event_datum id="debug_info">
<description>Debug string</description>
<type>string</type>
</event_datum>
</event_data>
</event>
<event id="EVENT_DB_SET_INITIAL_ATTRIBUTES_FLAGS" _delta="define">
<description>Set object initial attributes flags. Call cmdbAbstractObject::AddInitialAttributeFlags() for all the initial attributes to be set initially.</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
</sources>
<event_data>
<event_datum id="object">
<description>The current object</description>
<type>DBObject</type>
</event_datum>
<event_datum id="debug_info">
<description>Debug string</description>
<type>string</type>
</event_datum>
</event_data>
</event>
<event id="EVENT_DOWNLOAD_DOCUMENT" _delta="define">
<description>A document has been downloaded from the GUI</description>
<sources>
<source id="Document">Document</source>
@@ -549,7 +508,7 @@
</event_datum>
</event_data>
</event>
<event id="EVENT_SERVICE_LOGIN" _delta="define">
<event id="EVENT_LOGIN" _delta="define">
<description>Inform the listeners about the connection states</description>
<event_data>
<event_datum id="code">

View File

@@ -272,6 +272,8 @@ class DisplayBlock
'panel_title',
/** string true if panel title should be displayed as html */
'panel_title_is_html',
/** string Description of the panel content, displayed as a hint on the title */
'panel_title_tooltip',
/** string class for panel block style */
'panel_class',
/** string class for panel block style */
@@ -1045,9 +1047,18 @@ JS
$aCount = $aCounts[$sStateValue];
$sHyperlink = $aCount['link'];
$sCountLabel = $aCount['label'];
$oPill = PillFactory::MakeForState($sClass, $sStateValue)
->SetTooltip($sStateLabel)
->AddHtml("<span class=\"ibo-dashlet-header-dynamic--count\">$sCountLabel</span><span class=\"ibo-dashlet-header-dynamic--label ibo-text-truncated-with-ellipsis\">".utils::HtmlEntities($sStateLabel)."</span>");
$oPill = PillFactory::MakeForState($sClass, $sStateValue);
// N°5849 - Unencode label for ExternalKey attribute because friendlyname is already html encoded thanks to DBObject::GetName() in AttributeExternalKey::GetAllowedValues(). (A fix in this function may have too much impact).
if ($oAttDef instanceof AttributeExternalKey) {
$sPillTooltip = htmlspecialchars_decode($sStateLabel, ENT_QUOTES | ENT_DISALLOWED | ENT_HTML5);
$sPillLabel = $sStateLabel;
} else {
$sPillTooltip = $sStateLabel;
$sPillLabel = utils::HtmlEntities($sStateLabel);
}
$oPill->SetTooltip($sPillTooltip)
->AddHtml("<span class=\"ibo-dashlet-header-dynamic--count\">$sCountLabel</span><span class=\"ibo-dashlet-header-dynamic--label ibo-text-truncated-with-ellipsis\">".$sPillLabel."</span>");
if ($sHyperlink != '-') {
$oPill->SetUrl($sHyperlink);
}
@@ -1304,17 +1315,12 @@ JS
}
}
if (count($aAuthorizedClasses) > 0) {
if ($this->m_oSet->CountWithLimit(1) > 0) {
if (empty($aExtraParams['currentId'])) {
$iListId = utils::GetUniqueId(); // Works only if not in an Ajax page !!
} else {
$iListId = $aExtraParams['currentId'];
}
$oBlock->AddSubBlock(DataTableUIBlockFactory::MakeForObject($oPage, $iListId, $this->m_oSet, $aExtraParams));
if (empty($aExtraParams['currentId'])) {
$iListId = utils::GetUniqueId(); // Works only if not in an Ajax page !!
} else {
// Empty set
$oBlock->bEmptySet = true;
$iListId = $aExtraParams['currentId'];
}
$oBlock->AddSubBlock(DataTableUIBlockFactory::MakeForObject($oPage, $iListId, $this->m_oSet, $aExtraParams));
} else {
// Not authorized
$oBlock->bNotAuthorized = true;
@@ -1337,43 +1343,13 @@ JS
}
// The list is made of only 1 class of objects, actions on the list are possible
if (($this->m_oSet->CountWithLimit(1) > 0) && (UserRights::IsActionAllowed($this->m_oSet->GetClass(), UR_ACTION_READ, $this->m_oSet) == UR_ALLOWED_YES)) {
if (UserRights::IsActionAllowed($this->m_oSet->GetClass(), UR_ACTION_READ, $this->m_oSet) == UR_ALLOWED_YES) {
$oBlock->AddSubBlock(cmdbAbstractObject::GetDisplaySetBlock($oPage, $this->m_oSet, $aExtraParams));
} else {
$oBlock->bEmptySet = true;
$oBlock->sClass = $this->m_oFilter->GetClass();
$oBlock->sClassLabel = MetaModel::GetName($oBlock->sClass);
$bDisplayMenu = isset($aExtraParams['menu']) ? ($aExtraParams['menu'] == true) : true;
if ($bDisplayMenu) {
if ((UserRights::IsActionAllowed($oBlock->sClass, UR_ACTION_MODIFY) == UR_ALLOWED_YES)) {
$oBlock->sLinkTarget = '';
$oAppContext = new ApplicationContext();
$oBlock->sParams = $oAppContext->GetForLink();
// 1:n links, populate the target object as a default value when creating a new linked object
if (isset($aExtraParams['target_attr'])) {
$oBlock->sLinkTarget = ' target="_blank" ';
$aExtraParams['default'][$aExtraParams['target_attr']] = $aExtraParams['object_id'];
}
if (!empty($aExtraParams['default'])) {
foreach ($aExtraParams['default'] as $sKey => $sValue) {
$oBlock->sDefault .= "&default[$sKey]=$sValue";
}
}
$oBlock->bCreateNew = true;
}
}
if (isset($aExtraParams["surround_with_panel"]) && $aExtraParams["surround_with_panel"]) {
$oPanel = PanelUIBlockFactory::MakeForClass($aExtraParams["panel_class"], $aExtraParams["panel_title"]);
if(isset($aExtraParams["panel_icon"]) && strlen($aExtraParams["panel_icon"]) > 0){
$oPanel->SetIcon($aExtraParams["panel_icon"]);
}
$oPanel->AddSubBlock($oBlock);
return $oPanel;
}
}
}
return $oBlock;
@@ -1753,9 +1729,14 @@ class MenuBlock extends DisplayBlock
$this->m_sStyle = 'list';
}
$sClass = $this->m_oFilter->GetClass();
$oSet = new CMDBObjectSet($this->m_oFilter);
$sClass = $this->GetFilter()->GetClass();
$aSelectedClasses = $this->GetFilter()->GetSelectedClasses();
$bIsForLinkset = isset($aExtraParams['target_attr']);
$oSet = new CMDBObjectSet($this->GetFilter());
$iSetCount = $oSet->Count();
/** @var string $sRefreshAction JS snippet to run when clicking on the refresh button of the menu */
$sRefreshAction = $aExtraParams['refresh_action'] ?? '';
$bIsCreationInModalAllowed = isset($aExtraParams['creation_in_modal_is_allowed']) && $aExtraParams['creation_in_modal_is_allowed'] === true;
/** @var array $aRegularActions Any action other than a transition */
$aRegularActions = [];
@@ -1763,275 +1744,240 @@ class MenuBlock extends DisplayBlock
$aTransitionActions = [];
/** @var array $aToolkitActions Any "legacy" toolkit menu item, which are now displayed in the same menu as the $aRegularActions, after them */
$aToolkitActions = [];
if ((!isset($aExtraParams['selection_mode']) || $aExtraParams['selection_mode'] == "") && $this->m_sStyle != 'listInObject') {
if (!isset($aExtraParams['selection_mode']) || ($aExtraParams['selection_mode'] == "")) {
$oAppContext = new ApplicationContext();
$sContext = $oAppContext->GetForLink();
if (!empty($sContext)) {
if (utils::IsNotNullOrEmptyString($sContext)) {
$sContext = '&'.$sContext;
}
$oReflectionClass = new ReflectionClass($sClass);
$sFilter = $this->m_oFilter->serialize();
$sFilter = $this->GetFilter()->serialize();
$sUIPage = cmdbAbstractObject::ComputeStandardUIPage($sClass);
$sRootUrl = utils::GetAbsoluteUrlAppRoot();
// Common params that will be applied to actions
$aActionParams = array();
if (isset($aExtraParams['menu_actions_target'])) {
$aActionParams['target'] = $aExtraParams['menu_actions_target'];
}
$aActionParams = $this->GetDefaultParamsForMenuAction();
// 1:n links, populate the target object as a default value when creating a new linked object
if (isset($aExtraParams['target_attr'])) {
if ($bIsForLinkset) {
$aExtraParams['default'][$aExtraParams['target_attr']] = $aExtraParams['object_id'];
}
$sDefault = '';
/** @var string $sDefaultValuesAsUrlParams Default values for the object to create, already formatted as URL params (eg. "&default[org_id]=3&default[title]=Foo") */
$sDefaultValuesAsUrlParams = '';
if (!empty($aExtraParams['default'])) {
foreach ($aExtraParams['default'] as $sKey => $sValue) {
$sDefault .= "&default[$sKey]=$sValue";
$sDefaultValuesAsUrlParams .= "&default[$sKey]=$sValue";
}
}
$bIsCreationAllowed = (UserRights::IsActionAllowed($sClass,
UR_ACTION_CREATE) == UR_ALLOWED_YES) && ($oReflectionClass->IsSubclassOf('cmdbAbstractObject'));
switch ($oSet->Count()) {
case 0:
// No object in the set, the only possible action is "new"
if ($bIsCreationAllowed) {
$aRegularActions['UI:Menu:New'] = array(
'label' => Dict::S('UI:Menu:New'),
'url' => "{$sRootUrl}pages/$sUIPage?operation=new&class=$sClass{$sContext}{$sDefault}",
) + $aActionParams;
// Check rights
$bIsCreationAllowed = (UserRights::IsActionAllowed($sClass, UR_ACTION_CREATE) === UR_ALLOWED_YES) && ($oReflectionClass->IsSubclassOf('cmdbAbstractObject'));
$bIsModifyAllowed = (UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY, $oSet) === UR_ALLOWED_YES) && ($oReflectionClass->IsSubclassOf('cmdbAbstractObject'));
// Create in new tab
if ($bIsCreationAllowed && !$bIsCreationInModalAllowed) {
$this->AddNewObjectMenuAction($aRegularActions, $sClass, $sDefaultValuesAsUrlParams);
}
// Any style actions
// - Bulk actions on objects set
if ($iSetCount > 1) {
// Bulk actions for each selected classes (eg. "link" and "remote" on n:n relations)
foreach ($aSelectedClasses as $sSelectedAlias => $sSelectedClass) {
$sSelectedClassName = MetaModel::GetName($sSelectedClass);
// Check rights on class
$bIsBulkModifyAllowed = (!MetaModel::IsAbstract($sSelectedClass)) && UserRights::IsActionAllowed($sSelectedClass, UR_ACTION_BULK_MODIFY, $oSet) && ($oReflectionClass->IsSubclassOf('cmdbAbstractObject'));
$bIsBulkDeleteAllowed = (bool) UserRights::IsActionAllowed($sSelectedClass, UR_ACTION_BULK_DELETE, $sSelectedClass);
// Refine filter on selected class so bullk actions occur on the right class
$oSelectedClassFilter = $this->GetFilter()->DeepClone();
$oSelectedClassFilter->SetSelectedClasses([$sSelectedAlias]);
// Action identifier is using the alias on purpose so they can be used as "shortcut actions" easily for "Link" or "Remote" aliases on linksets.
// Action label dict code has a specific suffix for "Link" / "Remote" aliases to allow dedicated labels in linksets.
$sActionLabelCodeSuffix = in_array($sSelectedAlias, ['Link', 'Remote']) ? $sSelectedAlias : 'Class';
if ($bIsBulkModifyAllowed) {
$this->AddBulkModifyObjectsMenuAction($aRegularActions, $sSelectedClass, $oSelectedClassFilter->serialize(), 'UI:Menu:ModifyAll:'.$sSelectedAlias, Dict::Format('UI:Menu:ModifyAll_'.$sActionLabelCodeSuffix, $sSelectedClassName));
}
break;
if ($bIsBulkDeleteAllowed) {
$this->AddBulkDeleteObjectsMenuAction($aRegularActions, $sSelectedClass, $oSelectedClassFilter->serialize(), 'UI:Menu:BulkDelete:'.$sSelectedAlias, Dict::Format('UI:Menu:BulkDelete_'.$sActionLabelCodeSuffix, $sSelectedClassName));
}
}
case 1:
$oObj = $oSet->Fetch();
if (is_null($oObj)) {
if (!isset($aExtraParams['link_attr'])) {
if ($bIsCreationAllowed) {
$aRegularActions['UI:Menu:New'] = array(
'label' => Dict::S('UI:Menu:New'),
'url' => "{$sRootUrl}pages/$sUIPage?operation=new&class=$sClass{$sContext}{$sDefault}",
) + $aActionParams;
}
}
} else {
$id = $oObj->GetKey();
if (empty($sRefreshAction) && utils::ReadParam('operation') == 'details') {
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
$sRefreshAction = "window.location.reload();";
} else {
$sRefreshAction = "window.location.href='".ApplicationContext::MakeObjectUrl(get_class($oObj), $id)."';";
}
}
// Stimuli
$aStates = MetaModel::EnumStates($sClass);
// Do not perform time-consuming computations if there are too many objects in the list
$iLimit = MetaModel::GetConfig()->Get('complex_actions_limit');
$bLocked = false;
if (MetaModel::GetConfig()->Get('concurrent_lock_enabled')) {
$aLockInfo = iTopOwnershipLock::IsLocked(get_class($oObj), $id);
if ($aLockInfo['locked']) {
$bLocked = true;
//$this->AddMenuSeparator($aActions);
//$aActions['concurrent_lock_unlock'] = array ('label' => Dict::S('UI:Menu:ReleaseConcurrentLock'), 'url' => "{$sRootUrl}pages/$sUIPage?operation=kill_lock&class=$sClass&id=$id{$sContext}");
}
}
$bRawModifiedAllowed = (UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY, $oSet) == UR_ALLOWED_YES) && ($oReflectionClass->IsSubclassOf('cmdbAbstractObject'));
$bIsModifyAllowed = !$bLocked && $bRawModifiedAllowed;
$bIsDeleteAllowed = !$bLocked && UserRights::IsActionAllowed($sClass, UR_ACTION_DELETE, $oSet);
// Just one object in the set, possible actions are "new / clone / modify and delete"
if (!isset($aExtraParams['link_attr'])) {
if ($bIsModifyAllowed) {
$aRegularActions['UI:Menu:Modify'] = array(
'label' => Dict::S('UI:Menu:Modify'),
'url' => "{$sRootUrl}pages/$sUIPage?route=object.modify&class=$sClass&id=$id{$sContext}#",
) + $aActionParams;
}
if ($bIsCreationAllowed) {
$aRegularActions['UI:Menu:New'] = array(
'label' => Dict::S('UI:Menu:New'),
'url' => "{$sRootUrl}pages/$sUIPage?operation=new&class=$sClass{$sContext}{$sDefault}",
) + $aActionParams;
}
if ($bIsDeleteAllowed) {
$aRegularActions['UI:Menu:Delete'] = array(
'label' => Dict::S('UI:Menu:Delete'),
'url' => "{$sRootUrl}pages/$sUIPage?operation=delete&class=$sClass&id=$id{$sContext}",
) + $aActionParams;
}
if ((count($aStates) > 0) && (($iLimit == 0) || ($oSet->CountWithLimit($iLimit + 1) < $iLimit))) {
// Life cycle actions may be available... if all objects are in the same state
//
// Group by <state>
$oGroupByExp = new FieldExpression(MetaModel::GetStateAttributeCode($sClass), $this->m_oFilter->GetClassAlias());
$aGroupBy = array('__state__' => $oGroupByExp);
$aQueryParams = array();
if (isset($aExtraParams['query_params'])) {
$aQueryParams = $aExtraParams['query_params'];
}
// Transitions / Stimuli
if (!$bLocked) {
$aTransitions = $oObj->EnumTransitions();
if (count($aTransitions)) {
$aStimuli = Metamodel::EnumStimuli(get_class($oObj));
foreach ($aTransitions as $sStimulusCode => $aTransitionDef) {
$iActionAllowed = (get_class($aStimuli[$sStimulusCode]) == 'StimulusUserAction') ? UserRights::IsStimulusAllowed($sClass,
$sStimulusCode, $oSet) : UR_ALLOWED_NO;
switch ($iActionAllowed) {
case UR_ALLOWED_YES:
$aTransitionActions[$sStimulusCode] = array(
'label' => $aStimuli[$sStimulusCode]->GetLabel(),
'url' => "{$sRootUrl}pages/UI.php?operation=stimulus&stimulus=$sStimulusCode&class=$sClass&id=$id{$sContext}",
) + $aActionParams;
break;
default:
// Do nothing
}
}
}
}
// Relations...
$aRelations = MetaModel::EnumRelationsEx($sClass);
if (count($aRelations)) {
$this->AddMenuSeparator($aRegularActions);
foreach ($aRelations as $sRelationCode => $aRelationInfo) {
if (array_key_exists('down', $aRelationInfo)) {
$aRegularActions[$sRelationCode.'_down'] = array(
'label' => $aRelationInfo['down'],
'url' => "{$sRootUrl}pages/$sUIPage?operation=view_relations&relation=$sRelationCode&direction=down&class=$sClass&id=$id{$sContext}",
$sSql = $this->m_oFilter->MakeGroupByQuery($aQueryParams, $aGroupBy);
$aRes = CMDBSource::QueryToArray($sSql);
if (count($aRes) == 1) {
// All objects are in the same state...
$sState = $aRes[0]['__state__'];
$aTransitions = Metamodel::EnumTransitions($sClass, $sState);
if (count($aTransitions)) {
$aStimuli = Metamodel::EnumStimuli($sClass);
foreach ($aTransitions as $sStimulusCode => $aTransitionDef) {
$oSet->Rewind();
// As soon as the user rights implementation will browse the object set,
// then we might consider using OptimizeColumnLoad() here
$iActionAllowed = UserRights::IsStimulusAllowed($sClass, $sStimulusCode, $oSet);
$iActionAllowed = (get_class($aStimuli[$sStimulusCode]) == 'StimulusUserAction') ? $iActionAllowed : UR_ALLOWED_NO;
switch ($iActionAllowed) {
case UR_ALLOWED_YES:
case UR_ALLOWED_DEPENDS:
$aTransitionActions[$sStimulusCode] = array(
'label' => $aStimuli[$sStimulusCode]->GetLabel(),
'url' => "{$sRootUrl}pages/UI.php?operation=select_bulk_stimulus&stimulus=$sStimulusCode&state=$sState&class=$sClass&filter=".urlencode($sFilter)."{$sContext}",
) + $aActionParams;
}
if (array_key_exists('up', $aRelationInfo)) {
$aRegularActions[$sRelationCode.'_up'] = array(
'label' => $aRelationInfo['up'],
'url' => "{$sRootUrl}pages/$sUIPage?operation=view_relations&relation=$sRelationCode&direction=up&class=$sClass&id=$id{$sContext}",
) + $aActionParams;
}
}
}
// Add a special menu to kill the lock, but only to allowed users who can also modify this object
if ($bLocked && $bRawModifiedAllowed) {
/** @var array $aAllowedProfiles */
$aAllowedProfiles = MetaModel::GetConfig()->Get('concurrent_lock_override_profiles');
$bCanKill = false;
$oUser = UserRights::GetUserObject();
$aUserProfiles = array();
if (!is_null($oUser)) {
$oProfileSet = $oUser->Get('profile_list');
while ($oProfile = $oProfileSet->Fetch()) {
$aUserProfiles[$oProfile->Get('profile')] = true;
}
}
foreach ($aAllowedProfiles as $sProfile) {
if (array_key_exists($sProfile, $aUserProfiles)) {
$bCanKill = true;
break;
}
}
if ($bCanKill) {
$this->AddMenuSeparator($aRegularActions);
$aRegularActions['concurrent_lock_unlock'] = array(
'label' => Dict::S('UI:Menu:KillConcurrentLock'),
'url' => "{$sRootUrl}pages/$sUIPage?operation=kill_lock&class=$sClass&id=$id{$sContext}",
);
default:
// Do nothing
}
}
}
$this->AddMenuSeparator($aRegularActions);
$this->GetEnumAllowedActions($oSet, function ($sLabel, $data) use (&$aRegularActions, $aActionParams) {
$aRegularActions[$sLabel] = array('label' => $sLabel, 'url' => $data) + $aActionParams;
});
}
break;
}
}
default:
// Check rights
// New / Modify
$bIsModifyAllowed = UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY,
$oSet) && ($oReflectionClass->IsSubclassOf('cmdbAbstractObject'));
$bIsBulkModifyAllowed = (!MetaModel::IsAbstract($sClass)) && UserRights::IsActionAllowed($sClass, UR_ACTION_BULK_MODIFY,
$oSet) && ($oReflectionClass->IsSubclassOf('cmdbAbstractObject'));
$bIsBulkDeleteAllowed = UserRights::IsActionAllowed($sClass, UR_ACTION_BULK_DELETE, $oSet);
if (isset($aExtraParams['link_attr'])) {
$id = $aExtraParams['object_id'];
$sTargetAttr = $aExtraParams['target_attr'];
$oAttDef = MetaModel::GetAttributeDef($sClass, $sTargetAttr);
$sTargetClass = $oAttDef->GetTargetClass();
if ($bIsModifyAllowed) {
$aRegularActions['UI:Menu:Add'] = array(
'label' => Dict::S('UI:Menu:Add'),
'url' => "{$sRootUrl}pages/$sUIPage?operation=modify_links&class=$sClass&link_attr=".$aExtraParams['link_attr']."&target_class=$sTargetClass&id=$id&addObjects=true{$sContext}",
) + $aActionParams;
}
if ($bIsBulkModifyAllowed) {
$aRegularActions['UI:Menu:Manage'] = array(
'label' => Dict::S('UI:Menu:Manage'),
'url' => "{$sRootUrl}pages/$sUIPage?operation=modify_links&class=$sClass&link_attr=".$aExtraParams['link_attr']."&target_class=$sTargetClass&id=$id{$sContext}",
) + $aActionParams;
}
//if ($bIsBulkDeleteAllowed) { $aActions[] = array ('label' => 'Remove All...', 'url' => "#") + $aActionParams; }
} else {
// many objects in the set, possible actions are: new / modify all / delete all
if ($bIsCreationAllowed) {
$aRegularActions['UI:Menu:New'] = array(
'label' => Dict::S('UI:Menu:New'),
'url' => "{$sRootUrl}pages/$sUIPage?operation=new&class=$sClass{$sContext}{$sDefault}",
) + $aActionParams;
}
if ($bIsBulkModifyAllowed) {
$aRegularActions['UI:Menu:ModifyAll'] = array(
'label' => Dict::S('UI:Menu:ModifyAll'),
'url' => "{$sRootUrl}pages/$sUIPage?operation=select_for_modify_all&class=$sClass&filter=".urlencode($sFilter)."{$sContext}",
) + $aActionParams;
}
if ($bIsBulkDeleteAllowed) {
$aRegularActions['UI:Menu:BulkDelete'] = array(
'label' => Dict::S('UI:Menu:BulkDelete'),
'url' => "{$sRootUrl}pages/$sUIPage?operation=select_for_deletion&filter=".urlencode($sFilter)."{$sContext}",
) + $aActionParams;
}
// Stimuli
$aStates = MetaModel::EnumStates($sClass);
// Do not perform time consuming computations if there are too may objects in the list
$iLimit = MetaModel::GetConfig()->Get('complex_actions_limit');
if ((count($aStates) > 0) && (($iLimit == 0) || ($oSet->CountWithLimit($iLimit + 1) < $iLimit))) {
// Life cycle actions may be available... if all objects are in the same state
//
// Group by <state>
$oGroupByExp = new FieldExpression(MetaModel::GetStateAttributeCode($sClass), $this->m_oFilter->GetClassAlias());
$aGroupBy = array('__state__' => $oGroupByExp);
$aQueryParams = array();
if (isset($aExtraParams['query_params'])) {
$aQueryParams = $aExtraParams['query_params'];
// NOT "listInObject" style actions
if ($this->m_sStyle !== 'listInObject') {
switch ($iSetCount) {
case 1:
$oObj = $oSet->Fetch();
if (false === is_null($oObj)) {
$id = $oObj->GetKey();
if (empty($sRefreshAction) && utils::ReadParam('operation') == 'details') {
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
$sRefreshAction = "window.location.reload();";
} else {
$sRefreshAction = "window.location.href='".ApplicationContext::MakeObjectUrl(get_class($oObj), $id)."';";
}
}
$sSql = $this->m_oFilter->MakeGroupByQuery($aQueryParams, $aGroupBy);
$aRes = CMDBSource::QueryToArray($sSql);
if (count($aRes) == 1) {
// All objects are in the same state...
$sState = $aRes[0]['__state__'];
$aTransitions = Metamodel::EnumTransitions($sClass, $sState);
if (count($aTransitions)) {
$aStimuli = Metamodel::EnumStimuli($sClass);
foreach ($aTransitions as $sStimulusCode => $aTransitionDef) {
$oSet->Rewind();
// As soon as the user rights implementation will browse the object set,
// then we might consider using OptimizeColumnLoad() here
$iActionAllowed = UserRights::IsStimulusAllowed($sClass, $sStimulusCode, $oSet);
$iActionAllowed = (get_class($aStimuli[$sStimulusCode]) == 'StimulusUserAction') ? $iActionAllowed : UR_ALLOWED_NO;
switch ($iActionAllowed) {
case UR_ALLOWED_YES:
case UR_ALLOWED_DEPENDS:
$aTransitionActions[$sStimulusCode] = array(
'label' => $aStimuli[$sStimulusCode]->GetLabel(),
'url' => "{$sRootUrl}pages/UI.php?operation=select_bulk_stimulus&stimulus=$sStimulusCode&state=$sState&class=$sClass&filter=".urlencode($sFilter)."{$sContext}",
) + $aActionParams;
break;
$bLocked = false;
if (MetaModel::GetConfig()->Get('concurrent_lock_enabled')) {
$aLockInfo = iTopOwnershipLock::IsLocked(get_class($oObj), $id);
if ($aLockInfo['locked']) {
$bLocked = true;
}
}
$bRawModifiedAllowed = (UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY, $oSet) == UR_ALLOWED_YES) && ($oReflectionClass->IsSubclassOf('cmdbAbstractObject'));
$bIsModifyAllowed = !$bLocked && $bRawModifiedAllowed;
$bIsDeleteAllowed = !$bLocked && UserRights::IsActionAllowed($sClass, UR_ACTION_DELETE, $oSet);
// Just one object in the set, possible actions are "new / clone / modify and delete"
if (!isset($aExtraParams['link_attr'])) {
if ($bIsModifyAllowed) {
$aRegularActions['UI:Menu:Modify'] = array(
'label' => Dict::S('UI:Menu:Modify'),
'url' => "{$sRootUrl}pages/$sUIPage?route=object.modify&class=$sClass&id=$id{$sContext}#",
) + $aActionParams;
}
if ($bIsDeleteAllowed) {
$aRegularActions['UI:Menu:Delete'] = array(
'label' => Dict::S('UI:Menu:Delete'),
'url' => "{$sRootUrl}pages/$sUIPage?operation=delete&class=$sClass&id=$id{$sContext}",
) + $aActionParams;
}
default:
// Do nothing
// Transitions / Stimuli
if (!$bLocked) {
$aTransitions = $oObj->EnumTransitions();
if (count($aTransitions)) {
$aStimuli = Metamodel::EnumStimuli(get_class($oObj));
foreach ($aTransitions as $sStimulusCode => $aTransitionDef) {
$iActionAllowed = (get_class($aStimuli[$sStimulusCode]) == 'StimulusUserAction') ? UserRights::IsStimulusAllowed($sClass,
$sStimulusCode, $oSet) : UR_ALLOWED_NO;
switch ($iActionAllowed) {
case UR_ALLOWED_YES:
$aTransitionActions[$sStimulusCode] = array(
'label' => $aStimuli[$sStimulusCode]->GetLabel(),
'url' => "{$sRootUrl}pages/UI.php?operation=stimulus&stimulus=$sStimulusCode&class=$sClass&id=$id{$sContext}",
) + $aActionParams;
break;
default:
// Do nothing
}
}
}
}
// Relations...
$aRelations = MetaModel::EnumRelationsEx($sClass);
if (count($aRelations)) {
$this->AddMenuSeparator($aRegularActions);
foreach ($aRelations as $sRelationCode => $aRelationInfo) {
if (array_key_exists('down', $aRelationInfo)) {
$aRegularActions[$sRelationCode.'_down'] = array(
'label' => $aRelationInfo['down'],
'url' => "{$sRootUrl}pages/$sUIPage?operation=view_relations&relation=$sRelationCode&direction=down&class=$sClass&id=$id{$sContext}",
) + $aActionParams;
}
if (array_key_exists('up', $aRelationInfo)) {
$aRegularActions[$sRelationCode.'_up'] = array(
'label' => $aRelationInfo['up'],
'url' => "{$sRootUrl}pages/$sUIPage?operation=view_relations&relation=$sRelationCode&direction=up&class=$sClass&id=$id{$sContext}",
) + $aActionParams;
}
}
}
// Add a special menu to kill the lock, but only to allowed users who can also modify this object
if ($bLocked && $bRawModifiedAllowed) {
/** @var array $aAllowedProfiles */
$aAllowedProfiles = MetaModel::GetConfig()->Get('concurrent_lock_override_profiles');
$bCanKill = false;
$oUser = UserRights::GetUserObject();
$aUserProfiles = array();
if (!is_null($oUser)) {
$oProfileSet = $oUser->Get('profile_list');
while ($oProfile = $oProfileSet->Fetch()) {
$aUserProfiles[$oProfile->Get('profile')] = true;
}
}
foreach ($aAllowedProfiles as $sProfile) {
if (array_key_exists($sProfile, $aUserProfiles)) {
$bCanKill = true;
break;
}
}
if ($bCanKill) {
$this->AddMenuSeparator($aRegularActions);
$aRegularActions['concurrent_lock_unlock'] = array(
'label' => Dict::S('UI:Menu:KillConcurrentLock'),
'url' => "{$sRootUrl}pages/$sUIPage?operation=kill_lock&class=$sClass&id=$id{$sContext}",
);
}
}
}
$this->AddMenuSeparator($aRegularActions);
$this->GetEnumAllowedActions($oSet, function ($sLabel, $data) use (&$aRegularActions, $aActionParams) {
$aRegularActions[$sLabel] = array('label' => $sLabel, 'url' => $data) + $aActionParams;
});
}
}
break;
}
}
$this->AddMenuSeparator($aRegularActions);
@@ -2056,8 +2002,9 @@ class MenuBlock extends DisplayBlock
$sRefreshAction = "window.location.reload();";
}
} else {
//it's easier just display configure this list and MENU_OBJLIST_TOOLKIT
// It's easier just display configure this list and MENU_OBJLIST_TOOLKIT
}
$param = null;
if (is_null($sId)) {
$sId = uniqid();
@@ -2070,14 +2017,7 @@ class MenuBlock extends DisplayBlock
case 'listInObject':
$oSet->Rewind();
$param = $oSet;
$bToolkitMenu = true;
if (isset($aExtraParams['toolkit_menu'])) {
$bToolkitMenu = (bool)$aExtraParams['toolkit_menu'];
}
if ($bToolkitMenu) {
$sLabel = Dict::S('UI:ConfigureThisList');
$aRegularActions['iTop::ConfigureList'] = ['label' => $sLabel, 'url' => '#', 'onclick' => "$('#datatable_dlg_datatable_{$sId}').dialog('open'); return false;"];
}
utils::GetPopupMenuItemsBlock($oPopupMenuItemsBlock, iPopupMenuExtension::MENU_OBJLIST_ACTIONS, $param, $aRegularActions, $sId);
utils::GetPopupMenuItemsBlock($oPopupMenuItemsBlock, iPopupMenuExtension::MENU_OBJLIST_TOOLKIT, $param, $aToolkitActions, $sId);
break;
@@ -2089,6 +2029,7 @@ class MenuBlock extends DisplayBlock
break;
}
if ($oPopupMenuItemsBlock->HasSubBlocks()) {
$oRenderBlock->AddSubBlock($oPopupMenuItemsBlock);
} else {
@@ -2099,6 +2040,7 @@ class MenuBlock extends DisplayBlock
$oRenderBlock->AddCssFileRelPath($sCssPath);
}
}
// Extract favorite actions from their menus
$aFavoriteRegularActions = [];
$aFavoriteTransitionActions = [];
@@ -2184,12 +2126,16 @@ class MenuBlock extends DisplayBlock
break;
case 'UI:Menu:ModifyAll':
case 'UI:Menu:ModifyAll:Link': // Link class on linkset
case 'UI:Menu:ModifyAll:Remote': // Remote class on linkset
case 'UI:Menu:Modify':
$sIconClass = 'fas fa-pen';
$sLabel = '';
break;
case 'UI:Menu:BulkDelete':
case 'UI:Menu:BulkDelete:Link': // Link class on linkset
case 'UI:Menu:BulkDelete:Remote': // Remote class on linkset
case 'UI:Menu:Delete':
$sIconClass = 'fas fa-trash';
$sLabel = '';
@@ -2222,8 +2168,28 @@ class MenuBlock extends DisplayBlock
$oActionsToolbar->AddSubBlock($oActionButton);
}
// - Creation in modal
if ($bIsCreationInModalAllowed === true) {
$oAddLinkActionButton = ButtonUIBlockFactory::MakeIconAction(
'fas fa-plus',
Dict::Format('UI:ClickToCreateNew', MetaModel::GetName($sClass)),
'UI:Links:New',
'',
false
);
// - If we are used in a Datatable, 'datatable_' will be prefixed to our $sId, so we do the same here
$sRealId = $sId;
if(in_array($this->m_sStyle, ['list', 'links', 'listInObject'])){
$sRealId = 'datatable_' . $sId;
}
$oAddLinkActionButton->AddCSSClasses(['ibo-action-button', 'ibo-regular-action-button'])
->SetOnClickJsCode("$('#$sRealId').trigger('open_creation_modal.object.itop');");
$oActionsToolbar->AddSubBlock($oAddLinkActionButton);
}
// - Refresh
if ($sRefreshAction != '') {
if (utils::IsNotNullOrEmptyString($sRefreshAction)) {
$oActionButton = ButtonUIBlockFactory::MakeAlternativeNeutral('', 'UI:Button:Refresh');
$oActionButton->SetIconClass('fas fa-sync-alt')
->SetOnClickJsCode($sRefreshAction)
@@ -2233,7 +2199,7 @@ class MenuBlock extends DisplayBlock
}
// - Search
if ($this->m_sStyle == 'details') {
if ($this->m_sStyle === 'details') {
$oActionButton = ButtonUIBlockFactory::MakeIconLink('fas fa-search', Dict::Format('UI:SearchFor_Class', MetaModel::GetName($sClass)), "{$sRootUrl}pages/UI.php?operation=search_form&do_search=0&class=$sClass{$sContext}", '', 'UI:SearchFor_Class');
$oActionButton->AddCSSClasses(['ibo-action-button', 'ibo-regular-action-button']);
$oActionsToolbar->AddSubBlock($oActionButton);
@@ -2258,6 +2224,12 @@ class MenuBlock extends DisplayBlock
// Toolkit actions
if (!empty($aToolkitActions)) {
// Add separator if necessary
if (count($aRegularActions) > 0) {
$oRegularActionsMenu->AddItem('separator-regular-actions-toolkit-actions', PopoverMenuItemFactory::MakeSeparator());
}
// Add actions
foreach ($aToolkitActions as $sActionId => $aActionData) {
$oRegularActionsMenu->AddItem('toolkit-actions', PopoverMenuItemFactory::MakeFromApplicationPopupMenuItemData($sActionId, $aActionData));
}
@@ -2338,5 +2310,106 @@ class MenuBlock extends DisplayBlock
$aActions['sep_'.(count($aActions)-1)] = array('label' => $sSeparator, 'url' => '');
}
}
}
}
/**
* Add a create action (to $aActions) for an $sClass object
*
* @param array &$aActions Pointer to the array in which the action will be added
* @param string $sClass Datamodel class concerned by the action
* @param string $sDefaultValuesAsUrlParams Default values for the new object form,
*
* @return void
* @since 3.1.0
* @internal
*/
protected function AddNewObjectMenuAction(array &$aActions, string $sClass, string $sDefaultValuesAsUrlParams = ''): void
{
$aActions['UI:Menu:New'] = [
'label' => Dict::Format('UI:ClickToCreateNew', MetaModel::GetName($sClass)),
'url' => $this->PrepareUrlForStandardMenuAction($sClass, "operation=new&class=$sClass{$sDefaultValuesAsUrlParams}"),
] + $this->GetDefaultParamsForMenuAction();
}
/**
* Add a bulk modify action (to $aActions) on objects defined by $sFilter
*
* @param array &$aActions Pointer to the array in which the action will be added
* @param string $sClass Datamodel class concerned by the action
* @param string $sFilter OQL of the objects to propose for bulk modify
* @param string $sActionIdentifier Unique identifier for the action. Default if 'UI:Menu:ModifyAll'
* @param string $sActionLabel Label for the action, can be either a dict code to translate or an hardcoded label. Default is 'UI:Menu:ModifyAll'.
*
* @return void
* @since 3.1.0
* @internal
*/
protected function AddBulkModifyObjectsMenuAction(array &$aActions, string $sClass, string $sFilter, string $sActionIdentifier = 'UI:Menu:ModifyAll', $sActionLabel = 'UI:Menu:ModifyAll'): void
{
$aActions[$sActionIdentifier] = [
'label' => Dict::S($sActionLabel),
'url' => $this->PrepareUrlForStandardMenuAction($sClass, "operation=select_for_modify_all&class=$sClass&filter=".urlencode($sFilter)),
] + $this->GetDefaultParamsForMenuAction();
}
/**
* Add a bulk delete action (to $aActions) on objects defined by $sFilter
*
* @param array &$aActions Pointer to the array in which the action will be added
* @param string $sClass Datamodel class concerned by the action
* @param string $sFilter OQL of the objects to propose for bulk deletion
* @param string $sActionIdentifier Unique identifier for the action. Default if 'UI:Menu:BulkDelete'
* @param string $sActionLabel Label for the action, can be either a dict code to translate or an hardcoded label. Default is 'UI:Menu:BulkDelete'.
*
* @return void
* @since 3.1.0
* @internal
*/
protected function AddBulkDeleteObjectsMenuAction(array &$aActions, string $sClass, string $sFilter, string $sActionIdentifier = 'UI:Menu:BulkDelete', $sActionLabel = 'UI:Menu:BulkDelete')
{
$aActions[$sActionIdentifier] = array(
'label' => Dict::S($sActionLabel),
'url' => $this->PrepareUrlForStandardMenuAction($sClass, "operation=select_for_deletion&filter=".urlencode($sFilter)),
) + $this->GetDefaultParamsForMenuAction();
}
/**
* @return array Default parameters of a menu action
* @since 3.1.0
* @internal
*/
private function GetDefaultParamsForMenuAction(): array
{
$aDefaultParams = [];
if (isset($aExtraParams['menu_actions_target'])) {
$aDefaultParams['target'] = $aExtraParams['menu_actions_target'];
}
return $aDefaultParams;
}
/**
* @param string $sClass Datamodel class for which the URL is prepared
* @param string $sUrlParams URL parameters to add to the URL, must already be concatenated as a string (eg. "foo=bar&some=thing&third=param")
*
* @return string An absolute URL for a menu action on the $sClass class with $sUrlParams
* @throws \Exception
* @internal
*/
private function PrepareUrlForStandardMenuAction(string $sClass, string $sUrlParams)
{
$sRootUrl = utils::GetAbsoluteUrlAppRoot();
$sUIPage = cmdbAbstractObject::ComputeStandardUIPage($sClass);
$sUrl = "{$sRootUrl}pages/{$sUIPage}?{$sUrlParams}";
$oAppContext = new ApplicationContext();
$sContext = $oAppContext->GetForLink();
if (utils::IsNotNullOrEmptyString($sContext)) {
$sUrl .= '&'.$sContext;
}
return $sUrl;
}
}

View File

@@ -6,6 +6,10 @@
class CoreException extends Exception
{
protected $m_sIssue;
protected $m_sImpact;
protected $m_aContextData;
/**
* CoreException constructor.
*

View File

@@ -59,7 +59,6 @@ class LoginBasic extends AbstractLoginFSMExtension
list($sAuthUser, $sAuthPwd) = $this->GetAuthUserAndPassword();
if (!UserRights::CheckCredentials($sAuthUser, $sAuthPwd, Session::Get('login_mode'), 'internal'))
{
$_SESSION['auth_user'] = $sAuthUser;
$iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS;
return LoginWebPage::LOGIN_FSM_ERROR;
}

View File

@@ -42,7 +42,6 @@ class LoginExternal extends AbstractLoginFSMExtension
$sAuthUser = $this->GetAuthUser();
if (!UserRights::CheckCredentials($sAuthUser, '', Session::Get('login_mode'), 'external'))
{
$_SESSION['auth_user'] = $sAuthUser;
$iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS;
return LoginWebPage::LOGIN_FSM_ERROR;
}

View File

@@ -68,7 +68,6 @@ class LoginForm extends AbstractLoginFSMExtension implements iLoginUIExtension
$sAuthPwd = utils::ReadPostedParam('auth_pwd', null, 'raw_data');
if (!UserRights::CheckCredentials($sAuthUser, $sAuthPwd, Session::Get('login_mode'), 'internal'))
{
$_SESSION['auth_user'] = $sAuthUser;
$iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS;
return LoginWebPage::LOGIN_FSM_ERROR;
}

View File

@@ -57,7 +57,6 @@ class LoginURL extends AbstractLoginFSMExtension
$sAuthPwd = utils::ReadParam('auth_pwd', null, false, 'raw_data');
if (!UserRights::CheckCredentials($sAuthUser, $sAuthPwd, Session::Get('login_mode'), 'internal'))
{
$_SESSION['auth_user'] = $sAuthUser;
$iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS;
return LoginWebPage::LOGIN_FSM_ERROR;
}

View File

@@ -26,8 +26,8 @@
use Combodo\iTop\Application\Branding;
use Combodo\iTop\Application\Helper\Session;
use Combodo\iTop\Service\EventData;
use Combodo\iTop\Service\EventService;
use Combodo\iTop\Service\Events\EventData;
use Combodo\iTop\Service\Events\EventService;
/**
* Web page used for displaying the login form
@@ -481,13 +481,13 @@ class LoginWebPage extends NiceWebPage
$iResponse = $oLoginFSMExtensionInstance->LoginAction($sLoginState, $iErrorCode);
if ($iResponse == self::LOGIN_FSM_RETURN)
{
EventService::FireEvent(new EventData(EVENT_SERVICE_LOGIN, null, ['code' => $iErrorCode, 'state' => $sLoginState]));
EventService::FireEvent(new EventData(EVENT_LOGIN, null, ['code' => $iErrorCode, 'state' => $sLoginState]));
Session::WriteClose();
return $iErrorCode; // Asked to exit FSM, generally login OK
}
if ($iResponse == self::LOGIN_FSM_ERROR)
{
EventService::FireEvent(new EventData(EVENT_SERVICE_LOGIN, null, ['code' => $iErrorCode, 'state' => $sLoginState]));
EventService::FireEvent(new EventData(EVENT_LOGIN, null, ['code' => $iErrorCode, 'state' => $sLoginState]));
$sLoginState = self::LOGIN_STATE_SET_ERROR; // Next state will be error
// An error was detected, skip the other plugins turn
break;
@@ -501,7 +501,7 @@ class LoginWebPage extends NiceWebPage
}
catch (Exception $e)
{
EventService::FireEvent(new EventData(EVENT_SERVICE_LOGIN, null, ['state' => $_SESSION['login_state']]));
EventService::FireEvent(new EventData(EVENT_LOGIN, null, ['state' => $_SESSION['login_state']]));
IssueLog::Error($e->getTraceAsString());
static::ResetSession();
die($e->getMessage());

View File

@@ -291,7 +291,17 @@ class ApplicationMenu
* @param string $sMenuGroupIdx
* @param array $aExtraParams
*
* @return array
* @return array{
* array{
* sId: string,
* sTitle: string,
* sLabel: string,
* bHasCount: boolean,
* sUrl: string,
* bOpenInNewWindow: boolean,
* aSubMenuNodes: array
* }
* } The aSubMenuNodes key contains the same structure recursively
* @throws \DictExceptionMissingString
* @throws \Exception
* @since 3.0.0
@@ -320,12 +330,13 @@ class ApplicationMenu
}
$aSubMenuNodes[] = [
'sId' => $oSubMenuNode->GetMenuId(),
'sTitle' => $oSubMenuNode->GetTitle(),
'bHasCount' => $oSubMenuNode->HasCount(),
'sUrl' => $oSubMenuNode->GetHyperlink($aExtraParams),
'sId' => $oSubMenuNode->GetMenuId(),
'sTitle' => $oSubMenuNode->GetTitle(),
'sLabel' => $oSubMenuNode->GetLabel(),
'bHasCount' => $oSubMenuNode->HasCount(),
'sUrl' => $oSubMenuNode->GetHyperlink($aExtraParams),
'bOpenInNewWindow' => $oSubMenuNode->IsHyperLinkInNewWindow(),
'aSubMenuNodes' => static::GetSubMenuNodes($sSubMenuItemIdx, $aExtraParams),
'aSubMenuNodes' => static::GetSubMenuNodes($sSubMenuItemIdx, $aExtraParams),
];
}
@@ -746,7 +757,7 @@ abstract class MenuNode
}
/**
* @return string
* @return string The "+" dictionary entry for this menu if exists, otherwise the Title (if we have a parent title, will output parentTitle / currentTitle)
*/
public function GetLabel()
{
@@ -758,7 +769,6 @@ abstract class MenuNode
} else {
$sRet = $this->GetTitle();
}
//$sRet = $this->GetTitle();
}
return $sRet;
}
@@ -1101,6 +1111,7 @@ class OQLMenuNode extends MenuNode
*/
public function RenderContent(WebPage $oPage, $aExtraParams = array())
{
ContextTag::AddContext(ContextTag::TAG_OBJECT_SEARCH);
ApplicationMenu::CheckMenuIdEnabled($this->GetMenuId());
OQLMenuNode::RenderOQLSearch
(

View File

@@ -15,9 +15,10 @@
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
use Combodo\iTop\Application\EventRegister\ApplicationEvents;
use Combodo\iTop\Application\Helper\Session;
use Combodo\iTop\Service\EventData;
use Combodo\iTop\Service\EventService;
use Combodo\iTop\Service\Events\EventData;
use Combodo\iTop\Service\Events\EventService;
require_once(APPROOT.'core/cmdbobject.class.inc.php');
require_once(APPROOT.'application/utils.inc.php');
@@ -71,9 +72,6 @@ $oKPI = new ExecutionKPI();
Session::Start();
$oKPI->ComputeAndReport("Session Start");
EventService::InitService();
EventService::FireEvent(new EventData(ApplicationEvents::APPLICATION_EVENT_REQUEST_RECEIVED));
$sSwitchEnv = utils::ReadParam('switch_env', null);
$bAllowCache = true;
if (($sSwitchEnv != null) && file_exists(APPCONF.$sSwitchEnv.'/'.ITOP_CONFIG_FILE) &&( Session::Get('itop_env') !== $sSwitchEnv))
@@ -105,4 +103,6 @@ else
}
$sConfigFile = APPCONF.$sEnv.'/'.ITOP_CONFIG_FILE;
MetaModel::Startup($sConfigFile, false /* $bModelOnly */, $bAllowCache, false /* $bTraceSourceFiles */, $sEnv);
// Event service must be initialized after the MetaModel startup, otherwise it cannot discover classes implementing the iEventServiceSetup interface
EventService::InitService();
EventService::FireEvent(new EventData(ApplicationEvents::APPLICATION_EVENT_METAMODEL_STARTED));

View File

@@ -685,15 +685,15 @@ JS
}
$oFilter->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', $this->bSearchMode);
$oBlock = new DisplayBlock($oFilter, 'search', false, $aParams);
$oPage->AddUiBlock($oBlock->GetDisplay($oPage, $this->iId,
$oPage->AddUiBlock($oBlock->GetDisplay($oPage, 'dtc_'.$this->iId,
array(
'menu' => false,
'currentId' => $this->iId,
'table_id' => "dr_{$this->iId}",
'menu' => false,
'currentId' => $this->iId,
'table_id' => "dr_{$this->iId}",
'table_inner_id' => "{$this->iId}_results",
'selection_mode' => true,
'selection_type' => 'single',
'cssCount' => '#count_'.$this->iId.'_results',
'cssCount' => '#count_'.$this->iId.'_results',
)
));
$sCancel = Dict::S('UI:Button:Cancel');

View File

@@ -19,6 +19,7 @@ class UILinksWidgetDirect
protected $sAttCode;
protected $sInputid;
protected $sNameSuffix;
protected $aZlist;
protected $sLinkedClass;
/**

View File

@@ -171,15 +171,10 @@ class UILinksWidget
$oCurrentObj->PrefillForm('search', $aPrefillFormParam);
}
$sLinkedSetId = "{$this->m_sAttCode}{$this->m_sNameSuffix}";
$oBlock = new BlockObjectPickerDialog($this);
$oPage->AddUiBlock($oBlock);
$oBlock->sLinkedSetId = $sLinkedSetId;
$oBlock->iInputId = $this->m_sInputId;
$oBlock->sLinkedClassName = MetaModel::GetName($this->m_sLinkedClass);
$oBlock->sClassName = MetaModel::GetName($this->m_sClass);
$sLinkedSetId = $oBlock->oUILinksWidget->GetLinkedSetId();
$oDisplayBlock = new DisplayBlock($oFilter, 'search', false);
$oBlock->AddSubBlock($oDisplayBlock->GetDisplay($oPage, "SearchFormToAdd_{$sLinkedSetId}",

View File

@@ -874,11 +874,50 @@ class utils
*/
public static function DateTimeFormatToPHP($sOldDateTimeFormat)
{
$aSearch = array('%d', '%m', '%y', '%Y', '%H', '%i', '%s');
$aReplacement = array('d', 'm', 'y', 'Y', 'H', 'i', 's');
$aSearch = ['%d', '%m', '%y', '%Y', '%H', '%i', '%s'];
$aReplacement = ['d', 'm', 'y', 'Y', 'H', 'i', 's'];
return str_replace($aSearch, $aReplacement, $sOldDateTimeFormat);
}
/**
* Convert an old strtime() date/time format specification {@link https://www.php.net/manual/fr/function.strftime.php}
* to a format compatible with \DateTime::format {@link https://www.php.net/manual/fr/datetime.format.php}
*
* Example: '%Y-%m-%d %H:%M:%S' => 'Y-m-d H:i:s'
*
* Note: Not all strftime() formats can be converted, in which case they will be present in the returned string (eg. '%U' or '%W')
*
* @param string $sOldStrftimeFormat
*
* @return string
* @since 3.1.0
*/
public static function StrftimeFormatToDateTimeFormat(string $sOldStrftimeFormat): string
{
$aSearch = [
'%d', '%m', '%y', '%Y', '%H', '%M', '%S', // Most popular formats
'%a', '%A', '%e', '%j', '%u', '%w', // Day formats
'%U', '%V', '%W', // Week formats
'%b', '%B', '%h', // Month formats
'%C', '%g', '%G', // Year formats
'%k', '%I', '%l', '%p', '%P', '%r', '%R', '%T', '%X', '%z', '%Z', // Time formats
'%c', '%D', '%F', '%s', '%x', // Datetime formats
'%n', '%t', '%%', // Misc. formats
];
$aReplacement = [
'd', 'm', 'y', 'Y', 'H', 'i', 's',
'D', 'l', 'j', 'z', 'N', 'w',
'%U', 'W', '%W',
'M', 'F', 'M',
'%C', 'y', 'Y',
'G', 'h', 'g', 'A', 'a', 'h:i:s A', 'H:i', 'H:i:s', '%X', 'O', 'T',
'%c', 'm/d/y', 'Y-m-d', 'U', '%x',
'%n', '%t', '%',
];
return str_replace($aSearch, $aReplacement, $sOldStrftimeFormat);
}
/**
* Allow to set cached config. Useful when running with {@link Parameters} for example.
* @param \Config $oConfig
@@ -1410,71 +1449,83 @@ class utils
*/
public static function GetPopupMenuItemsBlock(iUIBlock &$oContainerBlock, $iMenuId, $param, &$aActions, $sDataTableId = null)
{
$aResult = [];
// 1st - add standard built-in menu items
//
switch($iMenuId)
{
case iPopupMenuExtension::MENU_OBJLIST_TOOLKIT:
// $param is a DBObjectSet
$oAppContext = new ApplicationContext();
$sContext = $oAppContext->GetForLink();
$sDataTableId = is_null($sDataTableId) ? '' : $sDataTableId;
$sUIPage = cmdbAbstractObject::ComputeStandardUIPage($param->GetFilter()->GetClass());
$sOQL = addslashes($param->GetFilter()->ToOQL(true));
$sFilter = urlencode($param->GetFilter()->serialize());
$sUrl = utils::GetAbsoluteUrlAppRoot()."pages/$sUIPage?operation=search&filter=".$sFilter."&{$sContext}";
$oContainerBlock->AddJsFileRelPath('js/tabularfieldsselector.js');
$oContainerBlock->AddJsFileRelPath('js/jquery.dragtable.js');
$oContainerBlock->AddCssFileRelPath('css/dragtable.css');
case iPopupMenuExtension::MENU_OBJLIST_ACTIONS:
// No native action there yet
break;
$aResult = array();
if (strlen($sUrl) < SERVER_MAX_URL_LENGTH)
{
$aResult[] = new SeparatorPopupMenuItem();
// Static menus: Email this page, CSV Export & Add to Dashboard
$aResult[] = new URLPopupMenuItem('UI:Menu:EMail', Dict::S('UI:Menu:EMail'),
"mailto:?body=".urlencode($sUrl).' ' // Add an extra space to make it work in Outlook
);
}
if (UserRights::IsActionAllowed($param->GetFilter()->GetClass(), UR_ACTION_BULK_READ, $param) != UR_ALLOWED_NO)
{
// Bulk export actions
$aResult[] = new JSPopupMenuItem('UI:Menu:CSVExport', Dict::S('UI:Menu:CSVExport'), "ExportListDlg('$sOQL', '$sDataTableId', 'csv', ".json_encode(Dict::S('UI:Menu:CSVExport')).")");
$aResult[] = new JSPopupMenuItem('UI:Menu:ExportXLSX', Dict::S('ExcelExporter:ExportMenu'), "ExportListDlg('$sOQL', '$sDataTableId', 'xlsx', ".json_encode(Dict::S('ExcelExporter:ExportMenu')).")");
if (extension_loaded('gd'))
{
// PDF export requires GD
$aResult[] = new JSPopupMenuItem('UI:Menu:ExportPDF', Dict::S('UI:Menu:ExportPDF'), "ExportListDlg('$sOQL', '$sDataTableId', 'pdf', ".json_encode(Dict::S('UI:Menu:ExportPDF')).")");
case iPopupMenuExtension::MENU_OBJLIST_TOOLKIT:
/** @var \DBObjectSet $param */
$oAppContext = new ApplicationContext();
$sContext = $oAppContext->GetForLink();
$sDataTableId = is_null($sDataTableId) ? '' : $sDataTableId;
$sUIPage = cmdbAbstractObject::ComputeStandardUIPage($param->GetFilter()->GetClass());
$sOQL = addslashes($param->GetFilter()->ToOQL(true));
$sFilter = urlencode($param->GetFilter()->serialize());
$sUrl = utils::GetAbsoluteUrlAppRoot()."pages/$sUIPage?operation=search&filter=".$sFilter."&{$sContext}";
$oContainerBlock->AddJsFileRelPath('js/tabularfieldsselector.js');
$oContainerBlock->AddJsFileRelPath('js/jquery.dragtable.js');
$oContainerBlock->AddCssFileRelPath('css/dragtable.css');
// Configure this list on datatables
if (utils::IsNotNullOrEmptyString($sDataTableId)) {
$aResult[] = new JSPopupMenuItem(
'iTop::ConfigureList',
Dict::S('UI:ConfigureThisList'),
"$('#datatable_dlg_datatable_{$sDataTableId}').dialog('open'); return false;"
);
$aResult[] = new SeparatorPopupMenuItem();
}
}
$aResult[] = new JSPopupMenuItem('UI:Menu:AddToDashboard', Dict::S('UI:Menu:AddToDashboard'), "DashletCreationDlg('$sOQL', '$sContext')");
$aResult[] = new JSPopupMenuItem('UI:Menu:ShortcutList', Dict::S('UI:Menu:ShortcutList'), "ShortcutListDlg('$sOQL', '$sDataTableId', '$sContext')");
break;
if (strlen($sUrl) < SERVER_MAX_URL_LENGTH) {
// Static menus: Email this page, CSV Export & Add to Dashboard
$aResult[] = new URLPopupMenuItem('UI:Menu:EMail', Dict::S('UI:Menu:EMail'),
"mailto:?body=".urlencode($sUrl).' ' // Add an extra space to make it work in Outlook
);
}
if (UserRights::IsActionAllowed($param->GetFilter()->GetClass(), UR_ACTION_BULK_READ, $param) != UR_ALLOWED_NO) {
// Bulk export actions
$aResult[] = new JSPopupMenuItem('UI:Menu:CSVExport', Dict::S('UI:Menu:CSVExport'), "ExportListDlg('$sOQL', '$sDataTableId', 'csv', ".json_encode(Dict::S('UI:Menu:CSVExport')).")");
$aResult[] = new JSPopupMenuItem('UI:Menu:ExportXLSX', Dict::S('ExcelExporter:ExportMenu'), "ExportListDlg('$sOQL', '$sDataTableId', 'xlsx', ".json_encode(Dict::S('ExcelExporter:ExportMenu')).")");
if (extension_loaded('gd'))
{
// PDF export requires GD
$aResult[] = new JSPopupMenuItem('UI:Menu:ExportPDF', Dict::S('UI:Menu:ExportPDF'), "ExportListDlg('$sOQL', '$sDataTableId', 'pdf', ".json_encode(Dict::S('UI:Menu:ExportPDF')).")");
}
}
$aResult[] = new JSPopupMenuItem('UI:Menu:AddToDashboard', Dict::S('UI:Menu:AddToDashboard'), "DashletCreationDlg('$sOQL', '$sContext')");
$aResult[] = new JSPopupMenuItem('UI:Menu:ShortcutList', Dict::S('UI:Menu:ShortcutList'), "ShortcutListDlg('$sOQL', '$sDataTableId', '$sContext')");
break;
case iPopupMenuExtension::MENU_OBJDETAILS_ACTIONS:
// $param is a DBObject
$oObj = $param;
$sOQL = "SELECT ".get_class($oObj)." WHERE id=".$oObj->GetKey();
$sUrl = ApplicationContext::MakeObjectUrl(get_class($oObj), $oObj->GetKey());
$oContainerBlock->AddJsFileRelPath('js/tabularfieldsselector.js');
$oContainerBlock->AddJsFileRelPath('js/jquery.dragtable.js');
$oContainerBlock->AddCssFileRelPath('css/dragtable.css');
$oContainerBlock->AddJsFileRelPath('js/tabularfieldsselector.js');
$oContainerBlock->AddJsFileRelPath('js/jquery.dragtable.js');
$oContainerBlock->AddCssFileRelPath('css/dragtable.css');
$aResult = array(
new SeparatorPopupMenuItem(),
// Static menus: Email this page & CSV Export
new URLPopupMenuItem('UI:Menu:EMail', Dict::S('UI:Menu:EMail'), "mailto:?subject=".urlencode($oObj->GetRawName())."&body=".urlencode($sUrl).' '), // Add an extra space to make it work in Outlook
new JSPopupMenuItem('UI:Menu:CSVExport', Dict::S('UI:Menu:CSVExport'), "ExportListDlg('$sOQL', '', 'csv', ".json_encode(Dict::S('UI:Menu:CSVExport')).")"),
new JSPopupMenuItem('UI:Menu:ExportXLSX', Dict::S('ExcelExporter:ExportMenu'), "ExportListDlg('$sOQL', '', 'xlsx', ".json_encode(Dict::S('ExcelExporter:ExportMenu')).")"),
new SeparatorPopupMenuItem(),
new URLPopupMenuItem('UI:Menu:PrintableVersion', Dict::S('UI:Menu:PrintableVersion'), $sUrl.'&printable=1', '_blank'),
);
break;
/** @var \DBObject $param */
$oObj = $param;
$sOQL = "SELECT ".get_class($oObj)." WHERE id=".$oObj->GetKey();
$sUrl = ApplicationContext::MakeObjectUrl(get_class($oObj), $oObj->GetKey());
$oContainerBlock->AddJsFileRelPath('js/tabularfieldsselector.js');
$oContainerBlock->AddJsFileRelPath('js/jquery.dragtable.js');
$oContainerBlock->AddCssFileRelPath('css/dragtable.css');
$oContainerBlock->AddJsFileRelPath('js/tabularfieldsselector.js');
$oContainerBlock->AddJsFileRelPath('js/jquery.dragtable.js');
$oContainerBlock->AddCssFileRelPath('css/dragtable.css');
$aResult = array(
new SeparatorPopupMenuItem(),
// Static menus: Email this page & CSV Export
new URLPopupMenuItem('UI:Menu:EMail', Dict::S('UI:Menu:EMail'), "mailto:?subject=".urlencode($oObj->GetRawName())."&body=".urlencode($sUrl).' '), // Add an extra space to make it work in Outlook
new JSPopupMenuItem('UI:Menu:CSVExport', Dict::S('UI:Menu:CSVExport'), "ExportListDlg('$sOQL', '', 'csv', ".json_encode(Dict::S('UI:Menu:CSVExport')).")"),
new JSPopupMenuItem('UI:Menu:ExportXLSX', Dict::S('ExcelExporter:ExportMenu'), "ExportListDlg('$sOQL', '', 'xlsx', ".json_encode(Dict::S('ExcelExporter:ExportMenu')).")"),
new SeparatorPopupMenuItem(),
new URLPopupMenuItem('UI:Menu:PrintableVersion', Dict::S('UI:Menu:PrintableVersion'), $sUrl.'&printable=1', '_blank'),
);
break;
case iPopupMenuExtension::MENU_DASHBOARD_ACTIONS:
// $param is a Dashboard
@@ -1482,19 +1533,19 @@ class utils
$oDashboard = $param;
$sDashboardId = $oDashboard->GetId();
$sDashboardFile = $oDashboard->GetDefinitionFile();
$sDashboardFileRelative = utils::LocalPath($sDashboardFile);
$sDlgTitle = addslashes(Dict::S('UI:ImportDashboardTitle'));
$sDlgText = addslashes(Dict::S('UI:ImportDashboardText'));
$sCloseBtn = addslashes(Dict::S('UI:Button:Cancel'));
$sDashboardFileJS = addslashes($sDashboardFile);
$sDashboardFileURL = urlencode($sDashboardFile);
$sDashboardFileJS = addslashes($sDashboardFileRelative);
$sDashboardFileURL = urlencode($sDashboardFileRelative);
$sUploadDashboardTransactId = utils::GetNewTransactionId();
$aResult = array(
new SeparatorPopupMenuItem(),
new URLPopupMenuItem('UI:ExportDashboard', Dict::S('UI:ExportDashBoard'), utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php?operation=export_dashboard&id='.$sDashboardId.'&file='.$sDashboardFileURL),
new JSPopupMenuItem('UI:ImportDashboard', Dict::S('UI:ImportDashBoard'), "UploadDashboard({dashboard_id: '$sDashboardId', file: '$sDashboardFileJS', title: '$sDlgTitle', text: '$sDlgText', close_btn: '$sCloseBtn', transaction: '$sUploadDashboardTransactId' })"),
);
if ($oDashboard->GetReloadURL())
{
if ($oDashboard->GetReloadURL()) {
$aResult[] = new SeparatorPopupMenuItem();
$aResult[] = new URLPopupMenuItem('UI:Menu:PrintableVersion', Dict::S('UI:Menu:PrintableVersion'), $oDashboard->GetReloadURL().'&printable=1', '_blank');
}
@@ -1503,34 +1554,25 @@ class utils
default:
// Unknown type of menu, do nothing
$aResult = array();
}
foreach ($aResult as $oMenuItem)
{
foreach ($aResult as $oMenuItem) {
$aActions[$oMenuItem->GetUID()] = $oMenuItem->GetMenuItem();
}
// Invoke the plugins
//
/** @var \iPopupMenuExtension $oExtensionInstance */
foreach (MetaModel::EnumPlugins('iPopupMenuExtension') as $oExtensionInstance)
{
if (is_object($param) && !($param instanceof DBObject))
{
foreach (MetaModel::EnumPlugins('iPopupMenuExtension') as $oExtensionInstance) {
if (is_object($param) && !($param instanceof DBObject)) {
$tmpParam = clone $param; // In case the parameter is an DBObjectSet, clone it to prevent alterations
}
else
{
} else {
$tmpParam = $param;
}
foreach($oExtensionInstance->EnumItems($iMenuId, $tmpParam) as $oMenuItem)
{
if (is_object($oMenuItem))
{
foreach ($oExtensionInstance->EnumItems($iMenuId, $tmpParam) as $oMenuItem) {
if (is_object($oMenuItem)) {
$aActions[$oMenuItem->GetUID()] = $oMenuItem->GetMenuItem();
foreach($oMenuItem->GetLinkedScripts() as $sLinkedScript)
{
foreach ($oMenuItem->GetLinkedScripts() as $sLinkedScript) {
$oContainerBlock->AddJsFileRelPath($sLinkedScript);
}
}
@@ -1538,6 +1580,136 @@ class utils
}
}
/**
* We cannot use iMenuId (corresponding values in {@see \iPopupMenuExtension} constants) as value is always {@see \iPopupMenuExtension::MENU_OBJLIST_TOOLKIT}
* whenever we are in a datatable, whereas it is included in a object tab, a dashlet or a search.
*
* So a {@see \ContextTag} is set on the corresponding calls.
*
* @return bool true if we are in a search page context, either directly or by the datatable ajax call
*
* @since 3.1.0 N°3200
*
* @uses \ContextTag::TAG_OBJECT_SEARCH
*/
public static function IsCurrentPageASearch(): bool
{
if (ContextTag::Check(ContextTag::TAG_OBJECT_SEARCH)) {
return true;
}
return false;
}
/**
* @param \DBObjectSearch $oFilter object list
* @param array $aExtraParams
*
* @return string|null null if we are already in a search, otherwise the URL to open this list in a search
*
* @throws \ArchivedObjectException
* @throws \CoreException
* @uses utils::IsCurrentPageASearch()
*
* @since 3.1.0 N°3200
*/
public static function GetDataTableSearchUrl(DBSearch $oFilter, array $aExtraParams): ?string
{
if (static::IsCurrentPageASearch()) {
// we don't want to add the link when already in a search page !
return null;
}
$bIsObjectRelation = isset($aExtraParams['object_id'], $aExtraParams['target_attr']);
if ($bIsObjectRelation) {
[$oDataTableSearchFilter, $aParams] = static::GetDataTableSearchForRelations($oFilter, $aExtraParams);
} else {
$oDataTableSearchFilter = $oFilter;
$aParams = [];
}
if (isset($aExtraParams['table_id'])) {
$aParams['table_id'] = $aExtraParams['table_id'];
}
$sParams = json_encode($aParams);
$sAppRootUrl = static::GetAbsoluteUrlAppRoot();
$oAppContext = new ApplicationContext();
$sUrl = $sAppRootUrl
.'pages/UI.php?operation=search&'
.$oAppContext->GetForLink()
.'&filter='.rawurlencode($oDataTableSearchFilter->serialize());
$sUrl .= '&aParams='.rawurlencode($sParams); // Not working... yet, cause not handled by UI.php
return $sUrl;
}
/**
* Rewrites filter for object relations, so that in the search page we will have the correct criteria and will be able to use "configure this list"
*
* @param \DBSearch $oFilter object list
* @param array{link_attr: string, target_attr: string, object_id: string} $aExtraParams
*
* @return array{\DBObjectSearch, string[]}
* @throws \CoreException
* @throws \OQLException
*
* @since 3.1.0 N°3200
*/
private static function GetDataTableSearchForRelations(DBSearch $oFilter, array $aExtraParams): array
{
$sObjectId = $aExtraParams['object_id'];
$bIsLinkedSetIndirect = isset($aExtraParams['link_attr']);
if ($bIsLinkedSetIndirect) {
//--- AttributeLinkedSetIndirect (n,n => lnk class)
$sLnkClass = $oFilter->GetClass();
$sExtKeyToObjectClass = $aExtraParams['link_attr'];
$sExtKeyToRemoteClass = $aExtraParams['target_attr'];
/** @var \AttributeExternalKey $oLnkExtKeyToRemote */
$oLnkExtKeyToRemote = MetaModel::GetAttributeDef($sLnkClass, $sExtKeyToRemoteClass);
$sRemoteClass = $oLnkExtKeyToRemote->GetTargetClass();
/** @var \AttributeExternalKey $oLnkExtKeyToRemote */
$oLnkExtKeyToObject = MetaModel::GetAttributeDef($sLnkClass, $sExtKeyToObjectClass);
$sObjectClass = $oLnkExtKeyToObject->GetTargetClass();
/** @var \AttributeExternalKey $oLnkExtKeyToRemote */
$oObjectExtKeyToLnk = $oLnkExtKeyToObject->GetMirrorLinkAttribute();
$sObjectExtKeyToLnkClass = $oObjectExtKeyToLnk->GetCode();
$sRemoteClassAliasName = ormLinkSet::REMOTE_ALIAS;
$sLnkClassAliasName = ormLinkSet::LINK_ALIAS;
$sOql = <<<SQL
SELECT {$sRemoteClassAliasName},{$sLnkClassAliasName}
FROM {$sRemoteClass} AS {$sRemoteClassAliasName}
JOIN {$sLnkClass} AS {$sLnkClassAliasName} ON {$sLnkClassAliasName}.$sExtKeyToRemoteClass = {$sRemoteClassAliasName}.id
WHERE {$sLnkClassAliasName}.$sExtKeyToObjectClass = $sObjectId
SQL;
$aAttCodesToDisplay = MetaModel::GetAttributeLinkedSetIndirectDatatableAttCodesToDisplay($sObjectClass, $sObjectExtKeyToLnkClass, $sRemoteClass, $sExtKeyToRemoteClass);
/** @noinspection PhpUnnecessaryLocalVariableInspection */
$sAttCodesToDisplay = implode(',', $aAttCodesToDisplay);
$aParams = [
'zlist' => false,
'extra_fields' => $sAttCodesToDisplay,
];
} else {
//--- AttributeLinkedSet (1,n => AttributeExternalKey)
$sClass = $oFilter->GetClass();
$sExtKeyCode = $aExtraParams['target_attr'];
$sOql = "SELECT $sClass WHERE $sExtKeyCode = $sObjectId";
$aParams = [];
}
$oDataTableSearchFilter = DBSearch::FromOQL($sOql);
return [$oDataTableSearchFilter, $aParams];
}
/**
* @param string $sEnvironment
*
@@ -1545,10 +1717,10 @@ class utils
*/
public static function GetConfigFilePath($sEnvironment = null)
{
if (is_null($sEnvironment))
{
if (is_null($sEnvironment)) {
$sEnvironment = self::GetCurrentEnvironment();
}
return APPCONF.$sEnvironment.'/'.ITOP_CONFIG_FILE;
}
@@ -2714,7 +2886,7 @@ HTML;
* @return array
* @since 3.0.0
*/
public static function GetClassesForInterface(string $sInterface, string $sClassNameFilter = '', $aExcludedPath = ['[\\\\/]lib[\\\\/]', '[\\\\/]node_modules[\\\\/]', '[\\\\/]test[\\\\/]']): array
public static function GetClassesForInterface(string $sInterface, string $sClassNameFilter = '', $aExcludedPath = []): array
{
$aMatchingClasses = [];
@@ -2765,12 +2937,18 @@ HTML;
$bSkipped = true;
}
else {
foreach ($aExcludedPath as $sExcludedPath) {
// Note: We use '#' as delimiters as usual '/' is often used in paths.
if ($sExcludedPath !== '' && preg_match('#'.$sExcludedPath.'#', $sPHPFile) === 1) {
$bSkipped = true;
break;
$sPHPFile = self::LocalPath($sPHPFile);
if ($sPHPFile !== false) {
$sPHPFile = '/'.$sPHPFile; // for regex
foreach ($aExcludedPath as $sExcludedPath) {
// Note: We use '#' as delimiters as usual '/' is often used in paths.
if ($sExcludedPath !== '' && preg_match('#'.$sExcludedPath.'#', $sPHPFile) === 1) {
$bSkipped = true;
break;
}
}
} else {
$bSkipped = true; // file not found
}
}
@@ -2808,7 +2986,7 @@ HTML;
$aResultPref = [];
$aShortcutPrefs = appUserPreferences::GetPref('keyboard_shortcuts', []);
// Note: Mind the 4 blackslashes, see utils::GetClassesForInterface()
$aShortcutClasses = utils::GetClassesForInterface('iKeyboardShortcut', '', array('[\\\\/]lib[\\\\/]', '[\\\\/]node_modules[\\\\/]', '[\\\\/]test[\\\\/]'));
$aShortcutClasses = utils::GetClassesForInterface('iKeyboardShortcut', '', array('[\\\\/]lib[\\\\/]', '[\\\\/]node_modules[\\\\/]', '[\\\\/]test[\\\\/]', '[\\\\/]tests[\\\\/]'));
foreach ($aShortcutClasses as $cShortcutPlugin) {
$sTriggeredElement = $cShortcutPlugin::GetShortcutTriggeredElementSelector();
@@ -3035,18 +3213,35 @@ HTML;
}
/**
* Transform a snake_case $sInput into a CamelCase string
*
* @param string $sInput
*
* @return string
* @return string Camel case representation of $sInput (eg. "something_new" becomes "SomethingNew")
* @since 2.7.0
*/
public static function ToCamelCase($sInput)
public static function ToCamelCase($sInput): string
{
return str_replace(' ', '', ucwords(strtr($sInput, '_-', ' ')));
}
/**
* @param string $sInput
*
* @return string Snake case representation of $sInput (eg. "SomethingNew" becomes "something_new")
* @since 3.1.0
* @link https://stackoverflow.com/a/19533226/2710325
*/
public static function ToSnakeCase(string $sInput): string
{
// Remove special chars to join words
$sOutput = preg_replace('/(\W)/', '_', $sInput);
// Transform camel case words to snake case
$sOutput = preg_replace('/[A-Z]([A-Z](?![a-z]))*/', '_$0', $sOutput);
// Lowercase everything
$sOutput = mb_strtolower($sOutput);
// Trim outer underscores
return trim($sOutput, '_');
}
/**
* @param string $sInput
*
@@ -3205,9 +3400,4 @@ HTML;
{
return in_array($sTrait, self::TraitsUsedByClass($sClass, true));
}
public static function GetUniqId()
{
return hash('sha256', uniqid(sprintf('%x', rand()), true).sprintf('%x', rand()));
}
}

View File

@@ -60,16 +60,20 @@ class WizardHelper
// special handling for lists
// assumes this is handled as an array of objects
// thus encoded in json like: [ { name:'link1', 'id': 123}, { name:'link2', 'id': 124}...]
$aData = json_decode($value, true); // true means decode as a hash array (not an object)
if (!is_array($value)) {
$aData = json_decode($value, true); // true means decode as a hash array (not an object)
} else {
$aData = $value;
}
// Check what are the meaningful attributes
$aFields = $this->GetLinkedWizardStructure($oAttDef);
$sLinkedClass = $oAttDef->GetLinkedClass();
$aLinkedObjectsArray = array();
if (!is_array($aData))
{
echo ("aData: '$aData' (value: '$value')\n");
if (!is_array($aData)) {
echo("aData: '$aData' (value: '$value')\n");
}
foreach($aData as $aLinkedObject)
foreach ($aData as $aLinkedObject)
{
$oLinkedObj = MetaModel::NewObject($sLinkedClass);
foreach($aFields as $sLinkedAttCode)

12
composer.lock generated
View File

@@ -4974,16 +4974,16 @@
},
{
"name": "twig/twig",
"version": "v3.4.2",
"version": "v3.4.3",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "e07cdd3d430cd7e453c31b36eb5ad6c0c5e43077"
"reference": "c38fd6b0b7f370c198db91ffd02e23b517426b58"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/e07cdd3d430cd7e453c31b36eb5ad6c0c5e43077",
"reference": "e07cdd3d430cd7e453c31b36eb5ad6c0c5e43077",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/c38fd6b0b7f370c198db91ffd02e23b517426b58",
"reference": "c38fd6b0b7f370c198db91ffd02e23b517426b58",
"shasum": ""
},
"require": {
@@ -5034,7 +5034,7 @@
],
"support": {
"issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v3.4.2"
"source": "https://github.com/twigphp/Twig/tree/v3.4.3"
},
"funding": [
{
@@ -5046,7 +5046,7 @@
"type": "tidelift"
}
],
"time": "2022-08-12T06:47:24+00:00"
"time": "2022-09-28T08:42:51+00:00"
},
{
"name": "webmozart/assert",

View File

@@ -43,22 +43,24 @@ abstract class Action extends cmdbAbstractObject
{
$aParams = array
(
"category" => "grant_by_profile,core/cmdb",
"key_type" => "autoincrement",
"name_attcode" => "name",
"state_attcode" => "",
"reconc_keys" => array('name'),
"db_table" => "priv_action",
"db_key_field" => "id",
"db_finalclass_field" => "realclass",
'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-in-transit.svg'),
"category" => "grant_by_profile,core/cmdb",
"key_type" => "autoincrement",
"name_attcode" => "name",
"complementary_name_attcode" => array('finalclass', 'description'),
"state_attcode" => "",
"reconc_keys" => array('name'),
"db_table" => "priv_action",
"db_key_field" => "id",
"db_finalclass_field" => "realclass",
'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-in-transit.svg'),
);
MetaModel::Init_Params($aParams);
//MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values"=>null, "sql"=>"name", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeEnum("status", array("allowed_values"=>new ValueSetEnum(array('test'=>'Being tested' ,'enabled'=>'In production', 'disabled'=>'Inactive')), "sql"=>"status", "default_value"=>"test", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("trigger_list", array("linked_class"=>"lnkTriggerAction", "ext_key_to_me"=>"action_id", "ext_key_to_remote"=>"trigger_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeEnum("status", array("allowed_values" => new ValueSetEnum(array('test' => 'Being tested', 'enabled' => 'In production', 'disabled' => 'Inactive')), "sql" => "status", "default_value" => "test", "is_null_allowed" => false, "depends_on" => array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("trigger_list",
array("linked_class" => "lnkTriggerAction", "ext_key_to_me" => "action_id", "ext_key_to_remote" => "trigger_id", "allowed_values" => null, "count_min" => 0, "count_max" => 0, "depends_on" => array(), "display_style" => 'property')));
// Display lists
// - Attributes to be displayed for the complete details

View File

@@ -181,7 +181,7 @@ abstract class AsyncTask extends DBObject
if (is_array($aRetries) && array_key_exists(get_class($this), $aRetries))
{
$aConfig = $aRetries[get_class($this)];
$bExponential = (bool)$aConfig['exponential_delay'] ?? $bExponential;
$bExponential = (bool) ($aConfig['exponential_delay'] ?? $bExponential);
}
return $bExponential;
}

View File

@@ -5,12 +5,15 @@
*/
use Combodo\iTop\Application\UI\Base\Component\FieldBadge\FieldBadgeUIBlockFactory;
use Combodo\iTop\Application\UI\Links\Indirect\BlockLinksSetDisplayAsProperty;
use Combodo\iTop\Form\Field\LabelField;
use Combodo\iTop\Form\Field\TextAreaField;
use Combodo\iTop\Form\Form;
use Combodo\iTop\Form\Validator\NotEmptyExtKeyValidator;
use Combodo\iTop\Form\Validator\Validator;
use Combodo\iTop\Renderer\BlockRenderer;
use Combodo\iTop\Renderer\Console\ConsoleBlockRenderer;
use Combodo\iTop\Service\Links\LinkSetModel;
require_once('MyHelpers.class.inc.php');
require_once('ormdocument.class.inc.php');
@@ -92,6 +95,9 @@ define('LINKSET_EDITMODE_ADDREMOVE', 4); // The "linked" objects can be added/re
define('LINKSET_RELATIONTYPE_PROPERTY', 'property');
define('LINKSET_RELATIONTYPE_LINK', 'link');
define('LINKSET_DISPLAY_STYLE_PROPERTY', 'property');
define('LINKSET_DISPLAY_STYLE_TAB', 'tab');
/**
* Attributes implementing this interface won't be accepted as `group by` field
*
@@ -140,6 +146,15 @@ abstract class AttributeDefinition
abstract public function GetEditClass();
/**
* @return array Css classes
* @since 3.1.0 N°3190
*/
public function GetCssClasses(): array
{
return $this->aCSSClasses;
}
/**
* Return the search widget type corresponding to this attribute
*
@@ -361,6 +376,18 @@ abstract class AttributeDefinition
return false;
}
/**
* Returns true if the attribute can be used in bulk modify.
*
* @return bool
* @since 3.1.0 N°3190
*
*/
public static function IsBulkModifyCompatible(): bool
{
return static::IsScalar();
}
/**
* Returns true if the attribute value is a set of related objects (1-N or N-N)
*
@@ -624,6 +651,16 @@ abstract class AttributeDefinition
return $sLabel;
}
/**
* @return bool True if the attribute has a description {@see \AttributeDefinition::GetDescription()}
* @throws \Exception
* @since 3.1.0
*/
public function HasDescription(): bool
{
return utils::IsNotNullOrEmptyString($this->GetDescription());
}
/**
* @param string|null $sDefault
*
@@ -1417,6 +1454,7 @@ class AttributeLinkedSet extends AttributeDefinition
public function __construct($sCode, $aParams)
{
parent::__construct($sCode, $aParams);
$this->aCSSClasses[] = 'attribute-set';
}
public static function ListExpectedParams()
@@ -1430,6 +1468,12 @@ class AttributeLinkedSet extends AttributeDefinition
return "LinkedSet";
}
/** @inheritDoc */
public static function IsBulkModifyCompatible(): bool
{
return false;
}
public function IsWritable()
{
return true;
@@ -1447,7 +1491,26 @@ class AttributeLinkedSet extends AttributeDefinition
public function GetValuesDef()
{
return $this->Get("allowed_values");
$oValSetDef = $this->Get("allowed_values");
if (!$oValSetDef) {
// Let's propose every existing value
$oValSetDef = new ValueSetObjects('SELECT '.LinkSetModel::GetTargetClass($this));
}
return $oValSetDef;
}
public function GetEditValue($value, $oHostObj = null)
{
/** @var ormLinkSet $value * */
if ($value->Count() === 0) {
return '';
}
/** Return linked objects key as string **/
$aValues = $value->GetValues();
return implode(' ', $aValues);
}
public function GetPrerequisiteAttributes($sClass = null)
@@ -1515,12 +1578,12 @@ class AttributeLinkedSet extends AttributeDefinition
}
/**
* @deprecated 3.1.0 N°5563 this attribute is no longer used
* @return string see LINKSET_EDITMODE_* constants
* @since 3.1.0 N°5563 relations are edited using new attributes in details mode, but as nothing changed in edit mode we are still using edit_mode attribute
*/
public function GetEditMode()
{
return $this->GetOptional('legacy_edit_mode', LINKSET_EDITMODE_ACTIONS);
return $this->GetOptional('edit_mode', LINKSET_EDITMODE_ACTIONS);
}
/**
@@ -1532,6 +1595,15 @@ class AttributeLinkedSet extends AttributeDefinition
return $this->GetOptional('relation_type', LINKSET_RELATIONTYPE_LINK);
}
/**
* @return string see LINKSET_DISPLAY_STYLE_* constants
* @since 3.1.0 N°3190
*/
public function GetDisplayStyle()
{
return $this->GetOptional('display_style', LINKSET_DISPLAY_STYLE_TAB);
}
/**
* @return boolean
* @since 3.1.0 N°5563
@@ -1566,49 +1638,30 @@ class AttributeLinkedSet extends AttributeDefinition
return '';
}
/**
* @param string $sValue
* @param \DBObject $oHostObject
* @param bool $bLocalize
*
* @return string|null
*
* @throws \CoreException
*/
public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true)
/** @inheritDoc * */
public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true): string
{
if (is_object($sValue) && ($sValue instanceof ormLinkSet))
{
$sValue->Rewind();
$aItems = array();
while ($oObj = $sValue->Fetch())
{
// Show only relevant information (hide the external key to the current object)
$aAttributes = array();
foreach(MetaModel::ListAttributeDefs($this->GetLinkedClass()) as $sAttCode => $oAttDef)
{
if ($sAttCode == $this->GetExtKeyToMe())
{
continue;
}
if ($oAttDef->IsExternalField())
{
continue;
}
$sAttValue = $oObj->GetAsHTML($sAttCode);
if (strlen($sAttValue) > 0)
{
$aAttributes[] = $sAttValue;
}
}
$sAttributes = implode(', ', $aAttributes);
$aItems[] = $sAttributes;
try {
/** @var ormLinkSet $sValue */
if ($sValue->Count() === 0) {
return '';
}
return implode('<br/>', $aItems);
}
$oLinkSetBlock = new BlockLinksSetDisplayAsProperty($this->GetCode(), $this, $sValue);
return null;
return ConsoleBlockRenderer::RenderBlockTemplates($oLinkSetBlock);
}
catch (Exception $e) {
$sMessage = "Error while displaying attribute {$this->GetCode()}";
IssueLog::Error($sMessage, IssueLog::CHANNEL_DEFAULT, [
'host_object_class' => $this->GetHostClass(),
'host_object_key' => $oHostObject->GetKey(),
'attribute' => $this->GetCode(),
]);
return $sMessage;
}
}
/**
@@ -2361,6 +2414,13 @@ class AttributeLinkedSetIndirect extends AttributeLinkedSet
return $oRet;
}
/** @inheritDoc */
public static function IsBulkModifyCompatible(): bool
{
return true;
}
}
/**

View File

@@ -21,6 +21,7 @@ MetaModel::IncludeModule('application/menunode.class.inc.php');
MetaModel::IncludeModule('application/user.preferences.class.inc.php');
MetaModel::IncludeModule('application/user.dashboard.class.inc.php');
MetaModel::IncludeModule('application/audit.rule.class.inc.php');
MetaModel::IncludeModule('application/audit.domain.class.inc.php');
MetaModel::IncludeModule('application/query.class.inc.php');
MetaModel::IncludeModule('setup/moduleinstallation.class.inc.php');

View File

@@ -1160,136 +1160,112 @@ class BulkChange
}
$iPreviousTimeLimit = ini_get('max_execution_time');
$iLoopTimeLimit = MetaModel::GetConfig()->Get('max_execution_time_per_loop');
foreach($this->m_aData as $iRow => $aRowData)
{
set_time_limit(intval($iLoopTimeLimit));
if (isset($aResult[$iRow]["__STATUS__"]))
{
// An issue at the earlier steps - skip the rest
continue;
}
try
{
$oReconciliationFilter = new DBObjectSearch($this->m_sClass);
$bSkipQuery = false;
foreach($this->m_aReconcilKeys as $sAttCode)
{
$valuecondition = null;
if (array_key_exists($sAttCode, $this->m_aExtKeys))
{
if ($this->IsNullExternalKeySpec($aRowData, $sAttCode))
{
$oExtKey = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode);
if ($oExtKey->IsNullAllowed())
{
$valuecondition = $oExtKey->GetNullValue();
$aResult[$iRow][$sAttCode] = new CellStatus_Void($oExtKey->GetNullValue());
}
else
{
$aResult[$iRow][$sAttCode] = new CellStatus_NullIssue();
}
}
else
{
// The value has to be found or verified
/** var DBObjectSearch $oReconFilter */
list($oReconFilter, $aMatches) = $this->ResolveExternalKey($aRowData, $sAttCode, $aResult[$iRow]);
// Avoid too many events
cmdbAbstractObject::SetEventDBLinksChangedBlocked(true);
try {
foreach ($this->m_aData as $iRow => $aRowData) {
set_time_limit(intval($iLoopTimeLimit));
if (isset($aResult[$iRow]["__STATUS__"])) {
// An issue at the earlier steps - skip the rest
continue;
}
try {
$oReconciliationFilter = new DBObjectSearch($this->m_sClass);
$bSkipQuery = false;
foreach ($this->m_aReconcilKeys as $sAttCode) {
$valuecondition = null;
if (array_key_exists($sAttCode, $this->m_aExtKeys)) {
if ($this->IsNullExternalKeySpec($aRowData, $sAttCode)) {
$oExtKey = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode);
if ($oExtKey->IsNullAllowed()) {
$valuecondition = $oExtKey->GetNullValue();
$aResult[$iRow][$sAttCode] = new CellStatus_Void($oExtKey->GetNullValue());
} else {
$aResult[$iRow][$sAttCode] = new CellStatus_NullIssue();
}
} else {
// The value has to be found or verified
if (count($aMatches) == 1)
{
$oRemoteObj = reset($aMatches); // first item
$valuecondition = $oRemoteObj->GetKey();
$aResult[$iRow][$sAttCode] = new CellStatus_Void($oRemoteObj->GetKey());
/** var DBObjectSearch $oReconFilter */
list($oReconFilter, $aMatches) = $this->ResolveExternalKey($aRowData, $sAttCode, $aResult[$iRow]);
if (count($aMatches) == 1) {
$oRemoteObj = reset($aMatches); // first item
$valuecondition = $oRemoteObj->GetKey();
$aResult[$iRow][$sAttCode] = new CellStatus_Void($oRemoteObj->GetKey());
} elseif (count($aMatches) == 0) {
$oCellStatus_SearchIssue = $this->GetCellSearchIssue($oReconFilter);
$aResult[$iRow][$sAttCode] = $oCellStatus_SearchIssue;
} else {
$aResult[$iRow][$sAttCode] = new CellStatus_Ambiguous(null, count($aMatches), $oReconFilter->serialize());
}
}
elseif (count($aMatches) == 0)
{
$oCellStatus_SearchIssue = $this->GetCellSearchIssue($oReconFilter);
$aResult[$iRow][$sAttCode] = $oCellStatus_SearchIssue;
}
else
{
$aResult[$iRow][$sAttCode] = new CellStatus_Ambiguous(null, count($aMatches), $oReconFilter->serialize());
} else {
// The value is given in the data row
$iCol = $this->m_aAttList[$sAttCode];
if ($sAttCode == 'id') {
$valuecondition = $aRowData[$iCol];
} else {
$oAttDef = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode);
$valuecondition = $oAttDef->MakeValueFromString($aRowData[$iCol], $this->m_bLocalizedValues);
}
}
}
else
{
// The value is given in the data row
$iCol = $this->m_aAttList[$sAttCode];
if ($sAttCode == 'id')
{
$valuecondition = $aRowData[$iCol];
}
else
{
$oAttDef = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode);
$valuecondition = $oAttDef->MakeValueFromString($aRowData[$iCol], $this->m_bLocalizedValues);
if (is_null($valuecondition)) {
$bSkipQuery = true;
} else {
$oReconciliationFilter->AddCondition($sAttCode, $valuecondition, '=');
}
}
if (is_null($valuecondition))
{
$bSkipQuery = true;
}
else
{
$oReconciliationFilter->AddCondition($sAttCode, $valuecondition, '=');
if ($bSkipQuery) {
$aResult[$iRow]["__STATUS__"] = new RowStatus_Issue(Dict::S('UI:CSVReport-Row-Issue-Reconciliation'));
} else {
$oReconciliationSet = new CMDBObjectSet($oReconciliationFilter);
switch ($oReconciliationSet->Count()) {
case 0:
$oTargetObj = $this->CreateObject($aResult, $iRow, $aRowData, $oChange);
// $aResult[$iRow]["__STATUS__"]=> set in CreateObject
$aVisited[] = $oTargetObj->GetKey();
break;
case 1:
$oTargetObj = $oReconciliationSet->Fetch();
$this->UpdateObject($aResult, $iRow, $oTargetObj, $aRowData, $oChange);
// $aResult[$iRow]["__STATUS__"]=> set in UpdateObject
if (!is_null($this->m_sSynchroScope)) {
$aVisited[] = $oTargetObj->GetKey();
}
break;
default:
// Found several matches, ambiguous
$aResult[$iRow]["__STATUS__"] = new RowStatus_Issue(Dict::S('UI:CSVReport-Row-Issue-Ambiguous'));
$aResult[$iRow]["id"] = new CellStatus_Ambiguous(0, $oReconciliationSet->Count(), $oReconciliationFilter->serialize());
$aResult[$iRow]["finalclass"] = 'n/a';
}
}
} catch (Exception $e) {
$aResult[$iRow]["__STATUS__"] = new RowStatus_Issue(Dict::Format('UI:CSVReport-Row-Issue-Internal', get_class($e), $e->getMessage()));
}
if ($bSkipQuery)
{
$aResult[$iRow]["__STATUS__"]= new RowStatus_Issue(Dict::S('UI:CSVReport-Row-Issue-Reconciliation'));
}
else
{
$oReconciliationSet = new CMDBObjectSet($oReconciliationFilter);
switch($oReconciliationSet->Count())
{
case 0:
$oTargetObj = $this->CreateObject($aResult, $iRow, $aRowData, $oChange);
// $aResult[$iRow]["__STATUS__"]=> set in CreateObject
$aVisited[] = $oTargetObj->GetKey();
break;
case 1:
$oTargetObj = $oReconciliationSet->Fetch();
$this->UpdateObject($aResult, $iRow, $oTargetObj, $aRowData, $oChange);
// $aResult[$iRow]["__STATUS__"]=> set in UpdateObject
if (!is_null($this->m_sSynchroScope))
{
$aVisited[] = $oTargetObj->GetKey();
}
break;
default:
// Found several matches, ambiguous
$aResult[$iRow]["__STATUS__"]= new RowStatus_Issue(Dict::S('UI:CSVReport-Row-Issue-Ambiguous'));
$aResult[$iRow]["id"]= new CellStatus_Ambiguous(0, $oReconciliationSet->Count(), $oReconciliationFilter->serialize());
$aResult[$iRow]["finalclass"]= 'n/a';
}
if (!is_null($this->m_sSynchroScope)) {
// Compute the delta between the scope and visited objects
$oScopeSearch = DBObjectSearch::FromOQL($this->m_sSynchroScope);
$oScopeSet = new DBObjectSet($oScopeSearch);
while ($oObj = $oScopeSet->Fetch()) {
$iObj = $oObj->GetKey();
if (!in_array($iObj, $aVisited)) {
set_time_limit(intval($iLoopTimeLimit));
$iRow++;
$this->UpdateMissingObject($aResult, $iRow, $oObj, $oChange);
}
}
}
catch (Exception $e)
{
$aResult[$iRow]["__STATUS__"]= new RowStatus_Issue(Dict::Format('UI:CSVReport-Row-Issue-Internal', get_class($e), $e->getMessage()));
}
} finally {
// Send all the retained events for further computations
cmdbAbstractObject::SetEventDBLinksChangedBlocked(false);
cmdbAbstractObject::FireEventDbLinksChangedForAllObjects();
}
if (!is_null($this->m_sSynchroScope))
{
// Compute the delta between the scope and visited objects
$oScopeSearch = DBObjectSearch::FromOQL($this->m_sSynchroScope);
$oScopeSet = new DBObjectSet($oScopeSearch);
while ($oObj = $oScopeSet->Fetch())
{
$iObj = $oObj->GetKey();
if (!in_array($iObj, $aVisited))
{
set_time_limit(intval($iLoopTimeLimit));
$iRow++;
$this->UpdateMissingObject($aResult, $iRow, $oObj, $oChange);
}
}
}
set_time_limit(intval($iPreviousTimeLimit));
// Fill in the blanks - the result matrix is expected to be 100% complete

View File

@@ -1611,4 +1611,22 @@ class CMDBSource
return 'ALTER DATABASE'.CMDBSource::GetSqlStringColumnDefinition().';';
}
/**
* Check which mysql client option (--ssl or --ssl-mode) to be used for encrypted connection
*
* @return bool true if --ssl-mode should be used, false otherwise
* @throws \MySQLException
*
* @link https://dev.mysql.com/doc/refman/5.7/en/connection-options.html#encrypted-connection-options "Command Options for Encrypted Connections"
*/
public static function IsSslModeDBVersion()
{
if (static::GetDBVendor() === static::ENUM_DB_VENDOR_MYSQL)
{
//Mysql 5.7.0 and upper deprecated --ssl and uses --ssl-mode instead
return version_compare(static::GetDBVersion(), '5.7.11', '>=');
}
return false;
}
}

View File

@@ -131,15 +131,15 @@ class Config
],
'event_service.debug.filter_events' => [
'type' => 'array',
'description' => 'Filter Event Service debug by events',
'default' => '',
'description' => 'List of events name to filter Event Service debug messages',
'default' => [],
'value' => '',
'source_of_value' => '',
'show_in_conf_sample' => false,
],
'event_service.debug.filter_sources' => [
'type' => 'array',
'description' => 'Filter Event Service debug by event sources',
'description' => 'List of event sources to filter Event Service debug messages',
'default' => '',
'value' => '',
'source_of_value' => '',
@@ -342,11 +342,11 @@ class Config
'show_in_conf_sample' => false,
],
'allow_menu_on_linkset' => [
'type' => 'bool',
'description' => 'Display Action menus in view mode on any LinkedSet with edit_mode != none',
'default' => false,
'value' => false,
'source_of_value' => '',
'type' => 'bool',
'description' => 'Display Action menus in view mode on any LinkedSet with edit_mode != none',
'default' => true,
'value' => true,
'source_of_value' => '',
'show_in_conf_sample' => false,
],
'allow_target_creation' => [
@@ -592,13 +592,29 @@ class Config
'source_of_value' => '',
'show_in_conf_sample' => false,
],
'email_css' => [
'type' => 'string',
'description' => 'CSS that will override the standard stylesheet used for the notifications',
'default' => "",
'value' => "",
'email_transport_smtp.allow_self_signed' => array(
'type' => 'bool',
'description' => 'Allow self signed peer certificates',
'default' => false,
'value' => false,
'source_of_value' => '',
'show_in_conf_sample' => false,
),
'email_transport_smtp.verify_peer' => array(
'type' => 'bool',
'description' => 'Verify peer certificate',
'default' => true,
'value' => true,
'source_of_value' => '',
'show_in_conf_sample' => false,
),
'email_css' => [
'type' => 'string',
'description' => 'CSS that will override the standard stylesheet used for the notifications',
'default' => "",
'value' => "",
'source_of_value' => '',
'show_in_conf_sample' => false,
],
'email_default_sender_address' => [
'type' => 'string',
@@ -1529,11 +1545,11 @@ class Config
'show_in_conf_sample' => false,
],
'security.hide_administrators' => [
'type' => 'bool',
'description' => 'If true, non-administrator users will not be able to see the administrator accounts, the Administrator profile and the links between the administrator accounts and their profiles.',
'default' => false,
'value' => false,
'source_of_value' => '',
'type' => 'bool',
'description' => 'If true, non-administrator users will not be able to see the administrator accounts, the Administrator profile and the links between the administrator accounts and their profiles.',
'default' => true,
'value' => true,
'source_of_value' => '',
'show_in_conf_sample' => false,
],
'behind_reverse_proxy' => [
@@ -1576,6 +1592,14 @@ class Config
'source_of_value' => '',
'show_in_conf_sample' => false,
],
'audit.enable_selection_landing_page' => [
'type' => 'bool',
'description' => 'If true audit categories must be selected before results are computed (use this setting in case of a lot of audit categories)',
'default' => false,
'value' => false,
'source_of_value' => '',
'show_in_conf_sample' => false,
],
];
public function IsProperty($sPropCode)
@@ -2453,10 +2477,15 @@ class Config
/**
* Helper function to initialize a configuration from the page arguments
*
* @see \Parameters::GetParamForConfigArray() to get aParamValues from {@see Parameters} object hierarchy in setup
* @see \WizardController::GetParamForConfigArray() to get aParamValues from {@see \WizardController} object hierarchy in setup
*
* @param array $aParamValues
* @param string|null $sModulesDir
* @param ?string $sModulesDir
* @param bool $bPreserveModuleSettings
*
* @return void The current object is modified directly
*
* @throws \Exception
* @throws \CoreException
*/

View File

@@ -52,17 +52,23 @@
*/
class ContextTag
{
const TAG_PORTAL = 'GUI:Portal';
const TAG_CRON = 'CRON';
const TAG_CONSOLE = 'GUI:Console';
const TAG_SETUP = 'Setup';
const TAG_SYNCHRO = 'Synchro';
const TAG_REST = 'REST/JSON';
public const TAG_PORTAL = 'GUI:Portal';
public const TAG_CRON = 'CRON';
public const TAG_CONSOLE = 'GUI:Console';
public const TAG_SETUP = 'Setup';
public const TAG_SYNCHRO = 'Synchro';
public const TAG_REST = 'REST/JSON';
/**
* @var string
* @since 3.1.0 N°3200
*/
public const TAG_OBJECT_SEARCH = 'ObjectSearch';
protected static $aStack = array();
/**
* Store a context tag on the stack
*
* @param string $sTag
*/
public function __construct($sTag)

View File

@@ -5,8 +5,8 @@
*/
use Combodo\iTop\Core\MetaModel\FriendlyNameType;
use Combodo\iTop\Service\EventData;
use Combodo\iTop\Service\EventService;
use Combodo\iTop\Service\Events\EventData;
use Combodo\iTop\Service\Events\EventService;
/**
* All objects to be displayed in the application (either as a list or as details)
@@ -156,6 +156,18 @@ abstract class DBObject implements iDisplay
/** @var \DBObject Source object when updating links */
protected $m_oLinkHostObject = null;
/**
* @var array List all the CRUD stack in progress
*
* The array contains instances of
* ['type' => 'type of CRUD operation (INSERT, UPDATE, DELETE)',
* 'class' => 'class of the object in the CRUD process',
* 'id' => 'id of the object in the CRUD process']
*
* @since 3.1.0 N°5906
*/
protected static array $m_aCrudStack = [];
/**
* DBObject constructor.
*
@@ -180,7 +192,7 @@ abstract class DBObject implements iDisplay
$this->m_bFullyLoaded = $this->IsFullyLoaded();
$this->m_aTouchedAtt = array();
$this->m_aModifiedAtt = array();
$this->m_sObjectUniqId = get_class($this).'::'.$this->GetKey().'_'.utils::GetUniqId();
$this->m_sObjectUniqId = get_class($this).'::'.$this->GetKey().'_'.uniqId('', true);
$this->RegisterEventListeners();
return;
}
@@ -203,7 +215,7 @@ abstract class DBObject implements iDisplay
$this->UpdateMetaAttributes();
$this->m_sObjectUniqId = get_class($this).'::0'.'_'.utils::GetUniqId();
$this->m_sObjectUniqId = get_class($this).'::0'.'_'.uniqId('', true);
$this->RegisterEventListeners();
}
@@ -355,7 +367,7 @@ abstract class DBObject implements iDisplay
public function Reload($bAllowAllData = false)
{
assert($this->m_bIsInDB);
$this->FireEvent(EVENT_SERVICE_DB_OBJECT_RELOAD);
$this->FireEvent(EVENT_DB_OBJECT_RELOAD);
$aRow = MetaModel::MakeSingleRow(get_class($this), $this->m_iKey, false /* must be found */, true /* AllowAllData */);
if (empty($aRow))
{
@@ -411,6 +423,8 @@ abstract class DBObject implements iDisplay
$this->m_aOrigValues = array();
$this->m_aLoadedAtt = array();
$this->m_bCheckStatus = true;
$this->m_aCheckIssues = [];
$this->m_bSecurityIssue = [];
// Get the key
//
@@ -1082,7 +1096,7 @@ abstract class DBObject implements iDisplay
if ($aCallInfo["function"] != "ComputeValues") continue;
return; //skip!
}
$this->EventComputeValues();
$this->FireEventComputeValues();
$this->ComputeValues();
}
@@ -1750,7 +1764,7 @@ abstract class DBObject implements iDisplay
*
* @param string $sAttCode $sAttCode The code of the attribute
* @param array $aReasons To store the reasons why the attribute is read-only (info about the synchro replicas)
* @param string $sTargetState The target state in which to evalutate the flags, if empty the current state will be used
* @param string $sTargetState The target state in which to evaluate the flags, if empty the current state will be used
*
* @return integer the binary combination of flags for the given attribute in the given state of the object.
* Values can be one of the OPT_ATT_HIDDEN, OPT_ATT_READONLY, OPT_ATT_MANDATORY, ... (see define in metamodel.class.php)
@@ -1793,7 +1807,8 @@ abstract class DBObject implements iDisplay
$iSynchroFlags |= OPT_ATT_READONLY;
}
}
return $iFlags | $iSynchroFlags; // Combine both sets of flags
$iExtensionsFlags = $this->GetExtensionsAttributeFlags($sAttCode, $aReasons, $sTargetState);
return $iFlags | $iSynchroFlags | $iExtensionsFlags; // Combine both sets of flags
}
/**
@@ -1910,7 +1925,9 @@ abstract class DBObject implements iDisplay
$sStateAttCode = MetaModel::GetStateAttributeCode($sClass);
$iFlags = MetaModel::GetInitialStateAttributeFlags($sClass, $this->Get($sStateAttCode), $sAttCode);
}
return $iFlags; // No need to care about the synchro flags since we'll be creating a new object anyway
$iExtensionsFlags = $this->GetExtensionsInitialStateAttributeFlags($sAttCode, $aReasons);
return $iFlags | $iExtensionsFlags; // No need to care about the synchro flags since we'll be creating a new object anyway
}
/**
@@ -2354,8 +2371,9 @@ abstract class DBObject implements iDisplay
$this->DoComputeValues();
}
$this->SetReadOnly('No modification allowed during CheckToWrite');
$this->EventCheckToWrite(['error_messages' => &$this->m_aCheckIssues]);
// Ultimate check - ensure DB integrity
$this->SetReadOnly('No modification allowed during CheckToCreate');
$this->FireEventCheckToWrite();
$this->SetReadWrite();
$this->DoCheckToWrite();
@@ -2385,10 +2403,6 @@ abstract class DBObject implements iDisplay
*/
protected function DoCheckToDelete(&$oDeletionPlan)
{
$this->m_aDeleteIssues = array(); // Ok
$this->EventCheckToDelete(['error_messages' => &$this->m_aDeleteIssues]);
if ($this->InSyncScope())
{
@@ -2816,7 +2830,7 @@ abstract class DBObject implements iDisplay
* @throws \OQLException
* @throws \Exception
*
* @internal
* @api
*
*/
public function DBInsert()
@@ -2950,150 +2964,161 @@ abstract class DBObject implements iDisplay
public function DBInsertNoReload()
{
$sClass = get_class($this);
if (MetaModel::DBIsReadOnly())
{
$sErrorMessage = "Cannot Insert object of class '$sClass' because of an ongoing maintenance: the database is in ReadOnly mode";
IssueLog::Error("$sErrorMessage\n".MyHelpers::get_callstack_text(1));
throw new CoreException("$sErrorMessage (see the log for more information)");
}
$this->AddCurrentObjectInCrudStack('INSERT');
if ($this->m_bIsInDB) {
throw new CoreException('The object already exists into the Database, you may want to use the clone function');
}
try {
if (MetaModel::DBIsReadOnly())
{
$sErrorMessage = "Cannot Insert object of class '$sClass' because of an ongoing maintenance: the database is in ReadOnly mode";
$sClass = get_class($this);
$sRootClass = MetaModel::GetRootClass($sClass);
IssueLog::Error("$sErrorMessage\n".MyHelpers::get_callstack_text(1));
throw new CoreException("$sErrorMessage (see the log for more information)");
}
// Ensure the update of the values (we are accessing the data directly)
$this->DoComputeValues();
$this->EventInsertRequested();
$this->OnInsert();
if ($this->m_iKey < 0) {
// This was a temporary "memory" key: discard it so that DBInsertSingleTable will not try to use it!
$this->m_iKey = null;
}
// If not automatically computed, then check that the key is given by the caller
if (!MetaModel::IsAutoIncrementKey($sRootClass)) {
if (empty($this->m_iKey)) {
throw new CoreWarning('Missing key for the object to write - This class is supposed to have a user defined key, not an autonumber', array('class' => $sRootClass));
if ($this->m_bIsInDB) {
throw new CoreException('The object already exists into the Database, you may want to use the clone function');
}
}
// Ultimate check - ensure DB integrity
list($bRes, $aIssues) = $this->CheckToWrite(false);
if (!$bRes) {
throw new CoreCannotSaveObjectException(array('issues' => $aIssues, 'class' => get_class($this), 'id' => $this->GetKey()));
}
$this->ComputeStopWatchesDeadline(true);
$sClass = get_class($this);
$sRootClass = MetaModel::GetRootClass($sClass);
$this->SetReadOnly('No modification allowed during The Event :'.EVENT_SERVICE_DB_ABOUT_TO_INSERT);
$this->EventInsertBefore();
$this->SetReadWrite();
$iTransactionRetry = 1;
$bIsTransactionEnabled = MetaModel::GetConfig()->Get('db_core_transactions_enabled');
if ($bIsTransactionEnabled) {
// TODO Deep clone this object before the transaction (to use it in case of rollback)
// $iTransactionRetryCount = MetaModel::GetConfig()->Get('db_core_transactions_retry_count');
$iTransactionRetryCount = 1;
$iTransactionRetryDelay = MetaModel::GetConfig()->Get('db_core_transactions_retry_delay_ms');
$iTransactionRetry = $iTransactionRetryCount;
}
while ($iTransactionRetry > 0) {
try {
$iTransactionRetry--;
if ($bIsTransactionEnabled) {
CMDBSource::Query('START TRANSACTION');
// Ensure the update of the values (we are accessing the data directly)
$this->DoComputeValues();
$this->OnInsert();
if ($this->m_iKey < 0) {
// This was a temporary "memory" key: discard it so that DBInsertSingleTable will not try to use it!
$this->m_iKey = null;
$this->UpdateCurrentObjectInCrudStack();
}
// If not automatically computed, then check that the key is given by the caller
if (!MetaModel::IsAutoIncrementKey($sRootClass)) {
if (empty($this->m_iKey)) {
throw new CoreWarning('Missing key for the object to write - This class is supposed to have a user defined key, not an autonumber', array('class' => $sRootClass));
}
}
// First query built upon on the root class, because the ID must be created first
$this->m_iKey = $this->DBInsertSingleTable($sRootClass);
list($bRes, $aIssues) = $this->CheckToWrite(false);
if (!$bRes) {
throw new CoreCannotSaveObjectException(array('issues' => $aIssues, 'class' => get_class($this), 'id' => $this->GetKey()));
}
// Then do the leaf class, if different from the root class
if ($sClass != $sRootClass) {
$this->DBInsertSingleTable($sClass);
}
if ($this->m_iKey < 0) {
// This was a temporary "memory" key: discard it so that DBInsertSingleTable will not try to use it!
$this->m_iKey = null;
}
// Then do the other classes
foreach (MetaModel::EnumParentClasses($sClass) as $sParentClass) {
if ($sParentClass == $sRootClass) {
continue;
$this->ComputeStopWatchesDeadline(true);
$iTransactionRetry = 1;
$bIsTransactionEnabled = MetaModel::GetConfig()->Get('db_core_transactions_enabled');
if ($bIsTransactionEnabled) {
// TODO Deep clone this object before the transaction (to use it in case of rollback)
// $iTransactionRetryCount = MetaModel::GetConfig()->Get('db_core_transactions_retry_count');
$iTransactionRetryCount = 1;
$iTransactionRetryDelay = MetaModel::GetConfig()->Get('db_core_transactions_retry_delay_ms');
$iTransactionRetry = $iTransactionRetryCount;
}
while ($iTransactionRetry > 0) {
try {
$iTransactionRetry--;
if ($bIsTransactionEnabled) {
CMDBSource::Query('START TRANSACTION');
}
$this->DBInsertSingleTable($sParentClass);
}
$this->OnObjectKeyReady();
// First query built upon on the root class, because the ID must be created first
$this->m_iKey = $this->DBInsertSingleTable($sRootClass);
$this->DBWriteLinks();
$this->WriteExternalAttributes();
// Then do the leaf class, if different from the root class
if ($sClass != $sRootClass) {
$this->DBInsertSingleTable($sClass);
}
// Write object creation history within the transaction
$this->RecordObjCreation();
if ($bIsTransactionEnabled) {
CMDBSource::Query('COMMIT');
}
break;
}
catch (Exception $e) {
IssueLog::Error($e->getMessage());
if ($bIsTransactionEnabled) {
CMDBSource::Query('ROLLBACK');
if (!CMDBSource::IsInsideTransaction() && CMDBSource::IsDeadlockException($e)) {
// Deadlock found when trying to get lock; try restarting transaction (only in main transaction)
if ($iTransactionRetry > 0) {
// wait and retry
IssueLog::Error('Insert TRANSACTION Retrying...');
usleep(random_int(1, 5) * 1000 * $iTransactionRetryDelay * ($iTransactionRetryCount - $iTransactionRetry));
// Then do the other classes
foreach (MetaModel::EnumParentClasses($sClass) as $sParentClass) {
if ($sParentClass == $sRootClass) {
continue;
} else {
IssueLog::Error('Insert Deadlock TRANSACTION prevention failed.');
}
$this->DBInsertSingleTable($sParentClass);
}
$this->OnObjectKeyReady();
$this->UpdateCurrentObjectInCrudStack();
$this->DBWriteLinks();
$this->WriteExternalAttributes();
// Write object creation history within the transaction
$this->RecordObjCreation();
if ($bIsTransactionEnabled) {
CMDBSource::Query('COMMIT');
}
break;
}
catch (Exception $e) {
IssueLog::Error($e->getMessage());
if ($bIsTransactionEnabled) {
CMDBSource::Query('ROLLBACK');
if (!CMDBSource::IsInsideTransaction() && CMDBSource::IsDeadlockException($e)) {
// Deadlock found when trying to get lock; try restarting transaction (only in main transaction)
if ($iTransactionRetry > 0) {
// wait and retry
IssueLog::Error('Insert TRANSACTION Retrying...');
usleep(random_int(1, 5) * 1000 * $iTransactionRetryDelay * ($iTransactionRetryCount - $iTransactionRetry));
continue;
} else {
IssueLog::Error('Insert Deadlock TRANSACTION prevention failed.');
}
}
}
throw $e;
}
throw $e;
}
}
$this->m_bIsInDB = true;
$this->m_bDirty = false;
foreach ($this->m_aCurrValues as $sAttCode => $value) {
if (is_object($value)) {
$value = clone $value;
$this->m_bIsInDB = true;
$this->m_bDirty = false;
foreach ($this->m_aCurrValues as $sAttCode => $value) {
if (is_object($value)) {
$value = clone $value;
}
$this->m_aOrigValues[$sAttCode] = $value;
}
$this->m_aOrigValues[$sAttCode] = $value;
}
// Prevent DBUpdate at this point (reentrance protection)
MetaModel::StartReentranceProtection(Metamodel::REENTRANCE_TYPE_UPDATE, $this);
// Prevent DBUpdate at this point (reentrance protection)
MetaModel::StartReentranceProtection($this);
$this->EventInsertAfter();
$this->AfterInsert();
// Activate any existing trigger
$sClass = get_class($this);
$aParams = array('class_list' => MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL));
$oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT TriggerOnObjectCreate AS t WHERE t.target_class IN (:class_list)'), array(), $aParams);
while ($oTrigger = $oSet->Fetch()) {
/** @var \Trigger $oTrigger */
try {
$oTrigger->DoActivate($this->ToArgs('this'));
$this->FireEventCreateDone();
$this->AfterInsert();
// Activate any existing trigger
$sClass = get_class($this);
$aParams = array('class_list' => MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL));
$oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT TriggerOnObjectCreate AS t WHERE t.target_class IN (:class_list)'), array(), $aParams);
while ($oTrigger = $oSet->Fetch()) {
/** @var \Trigger $oTrigger */
try {
$oTrigger->DoActivate($this->ToArgs('this'));
}
catch (Exception $e) {
utils::EnrichRaisedException($oTrigger, $e);
}
}
// - TriggerOnObjectMention
$this->ActivateOnMentionTriggers(true);
}
catch (Exception $e) {
utils::EnrichRaisedException($oTrigger, $e);
finally {
MetaModel::StopReentranceProtection($this);
}
if ($this->IsModified()) {
$this->DBUpdate();
}
}
// - TriggerOnObjectMention
$this->ActivateOnMentionTriggers(true);
MetaModel::StopReentranceProtection(Metamodel::REENTRANCE_TYPE_UPDATE, $this);
if ($this->IsModified()) {
$this->DBUpdate();
finally {
$this->RemoveCurrentObjectInCrudStack();
}
return $this->m_iKey;
@@ -3161,17 +3186,17 @@ abstract class DBObject implements iDisplay
// Protect against reentrance (e.g. cascading the update of ticket logs)
$sClass = get_class($this);
$sKey = $this->GetKey();
if (!MetaModel::StartReentranceProtection(Metamodel::REENTRANCE_TYPE_UPDATE, $this)) {
if (!MetaModel::StartReentranceProtection($this)) {
IssueLog::Debug("CRUD: DBUpdate $sClass::$sKey Rejected (reentrance)", LogChannels::DM_CRUD);
return false;
}
try
{
$this->AddCurrentObjectInCrudStack('UPDATE');
try {
$this->DoComputeValues();
$this->ComputeStopWatchesDeadline(false);
$this->EventUpdateRequested();
$this->OnUpdate();
// Freeze the changes at this point
@@ -3180,16 +3205,12 @@ abstract class DBObject implements iDisplay
if (count($aChanges) == 0)
{
// Attempting to update an unchanged object
MetaModel::StopReentranceProtection(Metamodel::REENTRANCE_TYPE_UPDATE, $this);
IssueLog::Debug("CRUD: DBUpdate $sClass::$sKey Aborted (no change)", LogChannels::DM_CRUD);
return $this->m_iKey;
}
// Ultimate check - ensure DB integrity
$this->SetReadOnly('No modification allowed during CheckToWrite');
list($bRes, $aIssues) = $this->CheckToWrite(false);
$this->SetReadWrite();
if (!$bRes)
{
throw new CoreCannotSaveObjectException(['issues' => $aIssues, 'class' => $sClass, 'id' => $this->GetKey()]);
@@ -3226,9 +3247,6 @@ abstract class DBObject implements iDisplay
$iIsTransactionRetryDelay = MetaModel::GetConfig()->Get('db_core_transactions_retry_delay_ms');
$iTransactionRetry = $iTransactionRetryCount;
}
$this->SetReadOnly('No modification allowed during The Event :'.EVENT_SERVICE_DB_ABOUT_TO_UPDATE);
$this->EventUpdateBefore();
$this->SetReadWrite();
while ($iTransactionRetry > 0)
{
@@ -3356,10 +3374,12 @@ abstract class DBObject implements iDisplay
$this->m_bDirty = false;
$this->m_aTouchedAtt = array();
$this->m_aModifiedAtt = array();
$bModifiedByUpdateDone = false;
try {
$this->EventUpdateAfter(['changes' => $aChanges]);
$this->FireEventUpdateDone($aChanges);
$this->AfterUpdate();
// Save the status as it is reset just after...
$bModifiedByUpdateDone = $this->IsModified();
// Reset original values although the object has not been reloaded
foreach ($this->m_aLoadedAtt as $sAttCode => $bLoaded) {
@@ -3396,10 +3416,11 @@ abstract class DBObject implements iDisplay
}
finally
{
MetaModel::StopReentranceProtection(Metamodel::REENTRANCE_TYPE_UPDATE, $this);
MetaModel::StopReentranceProtection($this);
$this->RemoveCurrentObjectInCrudStack();
}
if ($this->IsModified()) {
if ($this->IsModified() || $bModifiedByUpdateDone) {
// Controlled reentrance
$this->DBUpdate();
}
@@ -3607,7 +3628,6 @@ abstract class DBObject implements iDisplay
return;
}
$this->EventDeleteBefore();
$this->OnDelete();
// Activate any existing trigger
@@ -3718,7 +3738,7 @@ abstract class DBObject implements iDisplay
}
}
$this->EventDeleteAfter();
$this->FireEventDeleteDone();
$this->AfterDelete();
@@ -3767,7 +3787,7 @@ abstract class DBObject implements iDisplay
if ($oDeletionPlan->FoundStopper())
{
$aIssues = $oDeletionPlan->GetIssues();
throw new DeleteException('Found issue(s)', array('target_class' => get_class($this), 'target_id' => $this->GetKey(), 'issues' => implode(', ', $aIssues)));
throw new DeleteException('Found issue(s)', array('target_class' => get_class($this), 'target_id' => $this->GetKey(), 'issues' => implode(', ', $aIssues)));
}
@@ -3788,7 +3808,14 @@ abstract class DBObject implements iDisplay
if ($oToDelete->m_bIsInDB)
{
set_time_limit(intval($iLoopTimeLimit));
$oToDelete->DBDeleteSingleObject();
$oToDelete->AddCurrentObjectInCrudStack('DELETE');
try {
$oToDelete->DBDeleteSingleObject();
}
finally {
$oToDelete->RemoveCurrentObjectInCrudStack();
}
}
}
}
@@ -3922,7 +3949,7 @@ abstract class DBObject implements iDisplay
'new_state' => $sNewState,
'save_object' => !$bDoNotWrite,
];
$this->FireEvent(EVENT_SERVICE_DB_BEFORE_APPLY_STIMULUS, $aEventData);
$this->FireEvent(EVENT_DB_BEFORE_APPLY_STIMULUS, $aEventData);
// $aTransitionDef is an
// array('target_state'=>..., 'actions'=>array of handlers procs, 'user_restriction'=>TBD
@@ -4037,7 +4064,7 @@ abstract class DBObject implements iDisplay
}
}
$this->FireEvent(EVENT_SERVICE_DB_AFTER_APPLY_STIMULUS, $aEventData);
$this->FireEvent(EVENT_DB_AFTER_APPLY_STIMULUS, $aEventData);
}
else
{
@@ -4047,7 +4074,7 @@ abstract class DBObject implements iDisplay
$this->m_aCurrValues[$sAttCode] = $aBackupValues[$sAttCode];
}
$aEventData['action'] = $sActionDesc;
$this->FireEvent(EVENT_SERVICE_DB_APPLY_STIMULUS_FAILED, $aEventData);
$this->FireEvent(EVENT_DB_APPLY_STIMULUS_FAILED, $aEventData);
}
return $bSuccess;
}
@@ -4854,6 +4881,8 @@ abstract class DBObject implements iDisplay
return;
}
// Check the node itself
$this->m_aDeleteIssues = array(); // Ok
$this->FireEventCheckToDelete($oDeletionPlan);
$this->DoCheckToDelete($oDeletionPlan);
$oDeletionPlan->SetDeletionIssues($this, $this->m_aDeleteIssues, $this->m_bSecurityIssue);
@@ -5609,7 +5638,7 @@ abstract class DBObject implements iDisplay
$this->DBWriteArchiveFlag(true);
$this->m_aCurrValues['archive_flag'] = true;
$this->m_aOrigValues['archive_flag'] = true;
$this->EventArchive();
$this->FireEventArchive();
}
/**
@@ -5623,7 +5652,7 @@ abstract class DBObject implements iDisplay
$this->m_aOrigValues['archive_flag'] = false;
$this->m_aCurrValues['archive_date'] = null;
$this->m_aOrigValues['archive_date'] = null;
$this->EventUnarchive();
$this->FireEventUnArchive();
}
@@ -5819,13 +5848,70 @@ abstract class DBObject implements iDisplay
}
/**
* @param $sEvent
* @api
* @param string $sIssue
*
* @return void
* @since 3.1.0
*/
final public function AddCheckIssue(string $sIssue)
{
$this->m_aCheckIssues[] = $sIssue;
}
/**
* @api
* @param string $sIssue
* @param bool $bIsSecurityIssue
*
* @return void
* @since 3.1.0
*/
final public function AddDeleteIssue(string $sIssue, bool $bIsSecurityIssue = false)
{
$this->m_aDeleteIssues[] = $sIssue;
if ($bIsSecurityIssue) {
$this->m_bSecurityIssue = true;
}
}
/**
* @api
* @param string $sAttCode
* @param array $aReasons
* @param string $sTargetState
*
* @return int
* @since 3.1.0
*/
protected function GetExtensionsAttributeFlags(string $sAttCode, array &$aReasons, string $sTargetState): int
{
return OPT_ATT_NORMAL;
}
/**
* @api
* @param string $sAttCode
* @param array $aReasons
*
* @return int
* @since 3.1.0
*/
protected function GetExtensionsInitialStateAttributeFlags(string $sAttCode, array &$aReasons): int
{
return OPT_ATT_NORMAL;
}
/**
* @param string $sEvent
* @param array $aEventData
* @return void
*
* @throws \CoreException
* @throws \Exception
* @since 3.1.0
*/
public function FireEvent($sEvent, $aEventData = array())
public function FireEvent(string $sEvent, array $aEventData = array()): void
{
if (EventService::IsEventRegistered($sEvent)) {
$aEventData['debug_info'] = 'from: '.get_class($this).':'.$this->GetKey();
@@ -5838,57 +5924,182 @@ abstract class DBObject implements iDisplay
}
}
protected function EventInsertRequested()
//////////////////
/// CREATE
///
/**
* @return void
* @since 3.1.0
*/
protected function FireEventCheckToWrite(): void
{
}
protected function EventInsertBefore()
/**
* @return void
* @since 3.1.0
*/
protected function FireEventCreateDone(): void
{
}
protected function EventInsertAfter()
/////////////
/// UPDATE
///
/**
* @return void
* @since 3.1.0
*/
protected function FireEventUpdateDone(array $aChanges): void
{
}
protected function EventComputeValues()
//////////////
/// DELETE
///
/**
* @return void
* @since 3.1.0
*/
protected function FireEventCheckToDelete(DeletionPlan $oDeletionPlan): void
{
}
protected function EventCheckToWrite(array $aEventData)
/**
* @return void
* @since 3.1.0
*/
protected function FireEventDeleteDone(): void
{
}
protected function EventCheckToDelete(array $aEventData)
/**
* @return void
* @since 3.1.0
*/
protected function FireEventComputeValues(): void
{
}
protected function EventUpdateRequested()
{
}
protected function EventUpdateBefore()
{
}
protected function EventUpdateAfter(array $aEventData)
{
}
protected function EventDeleteBefore()
{
}
protected function EventDeleteAfter()
{
}
protected function EventArchive()
/**
* @return void
* @since 3.1.0
*/
protected function FireEventArchive(): void
{
}
protected function EventUnarchive()
/**
* @return void
* @since 3.1.0
*/
protected function FireEventUnArchive(): void
{
}
//////////////
/// CRUD stack in progress
///
/**
* Check if an object is currently involved in CRUD operation
*
* @param string $sClass
* @param string|null $sId
*
* @return bool
* @since 3.1.0 N°5609
*/
final public static function IsObjectCurrentlyInCrud(string $sClass, ?string $sId): bool
{
// during insert key is reset from -1 to null
// so we need to handle null values (will give empty string after conversion)
$sConvertedId = (string)$sId;
foreach (self::$m_aCrudStack as $aCrudStackEntry) {
if (($sClass === $aCrudStackEntry['class'])
&& ($sConvertedId === $aCrudStackEntry['id'])) {
return true;
}
}
return false;
}
/**
* Check if an object of the given class is currently involved in CRUD operation
*
* @param string $sClass
*
* @return bool
* @since 3.1.0 N°5609
*/
final public static function IsClassCurrentlyInCrud(string $sClass): bool
{
foreach (self::$m_aCrudStack as $aCrudStackEntry) {
if ($sClass === $aCrudStackEntry['class']) {
return true;
}
}
return false;
}
/**
* Add the current object to the CRUD stack
*
* @param string $sCrudType
*
* @return void
* @since 3.1.0 N°5609
*/
private function AddCurrentObjectInCrudStack(string $sCrudType): void
{
self::$m_aCrudStack[] = [
'type' => $sCrudType,
'class' => get_class($this),
'id' => (string)$this->GetKey(), // GetKey() doesn't have type hinting, so forcing type to avoid getting an int
];
}
/**
* Update the last entry of the CRUD stack with the information of the current object
* This is calls during DBInsert since the object id changes
*
* @return void
* @since 3.1.0 N°5609
*/
private function UpdateCurrentObjectInCrudStack(): void
{
$aCurrentCrudStack = array_pop(self::$m_aCrudStack);
$aCurrentCrudStack['id'] = (string)$this->GetKey();
self::$m_aCrudStack[] = $aCurrentCrudStack;
}
/**
* Remove the last entry of the CRUD stack
*
* @return void
* @since 3.1.0 N°5609
*/
private function RemoveCurrentObjectInCrudStack(): void
{
array_pop(self::$m_aCrudStack);
}
/**
* Check if there are objects in the CRUD stack
*
* @return bool
* @since 3.1.0 N°5609
*/
final protected function IsCrudStackEmpty(): bool
{
return count(self::$m_aCrudStack) === 0;
}
}

View File

@@ -53,6 +53,18 @@ class DBObjectSet implements iDBObjectSetIterator
* @var array
*/
protected $m_aAttToLoad;
/**
* @var null|array
*/
protected $m_aExtendedDataSpec;
/**
* @var int Maximum number of elements to retrieve
*/
protected $m_iLimitCount;
/**
* @var int Offset from which elements should be retrieved
*/
protected $m_iLimitStart;
/**
* @var array
*/

View File

@@ -773,14 +773,14 @@ abstract class DBSearch
* @see DBSearch::ToOQL()
*
* @param string $sQuery The OQL to convert to a DBSearch
* @param mixed[string] $aParams array of <mixed> params index by <string> name
* @param array $aParams array of <mixed> params index by <string> name
* @param ModelReflection|null $oMetaModel The MetaModel to use when checking the consistency of the OQL
*
* @return DBObjectSearch|DBUnionSearch
*
* @throws OQLException
*/
static public function FromOQL($sQuery, $aParams = null, ModelReflection $oMetaModel=null)
public static function FromOQL($sQuery, $aParams = null, ModelReflection $oMetaModel=null)
{
if (empty($sQuery))
{

View File

@@ -30,6 +30,7 @@ use DOMDocument;
use DOMFormatException;
use IssueLog;
use LogAPI;
use utils;
/**
* Class \Combodo\iTop\DesignDocument

View File

@@ -110,7 +110,7 @@ class Dict
*
* @param string $sStringCode The code identifying the dictionary entry
* @param string $sDefault Default value if there is no match in the dictionary
* @param bool $bUserLanguageOnly True to allow the use of the default language as a fallback, false otherwise
* @param bool $bUserLanguageOnly False to allow the use of the default language as a fallback, true otherwise
*
* @return string
*/
@@ -174,7 +174,7 @@ class Dict
*
* @return string
*/
public static function Format($sFormatCode /*, ... arguments ....*/)
public static function Format($sFormatCode /*, ... arguments ... */)
{
$sLocalizedFormat = self::S($sFormatCode);
$aArguments = func_get_args();

View File

@@ -134,7 +134,7 @@ abstract class DOMSanitizer extends HTMLSanitizer
public function DoSanitize($sHTML)
{
$this->oDoc = new DOMDocument();
$this->oDoc->preserveWhitespace = true;
$this->oDoc->preserveWhiteSpace = true;
// MS outlook implements empty lines by the mean of <p><o:p></o:p></p>
// We have to transform that into <p><br></p> (which is how Thunderbird implements empty lines)
@@ -286,8 +286,8 @@ class HTMLDOMSanitizer extends DOMSanitizer
'strong' => array(),
'img' => array('src', 'style', 'alt', 'title'),
'ul' => array('style'),
'ol' => array('style'),
'li' => array('style'),
'ol' => array('reversed', 'start', 'style', 'type'),
'li' => array('style', 'value'),
'h1' => array('style'),
'h2' => array('style'),
'h3' => array('style'),
@@ -402,7 +402,7 @@ class HTMLDOMSanitizer extends DOMSanitizer
public function LoadDoc($sHTML)
{
@$this->oDoc->loadHTML('<?xml encoding="UTF-8"?>'.$sHTML); // For loading HTML chunks where the character set is not specified
$this->oDoc->preserveWhitespace = true;
$this->oDoc->preserveWhiteSpace = true;
}
public function PrintDoc()

View File

@@ -551,6 +551,12 @@ class LogChannels
*/
public const NOTIFICATIONS = 'notifications';
/**
* @var string Everything related to the backup / restore
* @since 3.1.0
*/
public const BACKUP = 'backup';
/**
* @since 3.0.0
*/
@@ -570,6 +576,12 @@ class LogChannels
public const CORE = 'core';
/**
* @var string Everything related to the datatable component
* @since 3.1.0
*/
public const DATATABLE = 'Datatable';
public const DEADLOCK = 'DeadLock';
public const INLINE_IMAGE = 'InlineImage';
@@ -577,11 +589,15 @@ class LogChannels
public const PORTAL = 'portal';
/**
* @var string
* @since 3.1.0 specific channel for event service
* @var string Everything related to the event service
* @since 3.1.0
*/
public const EVENT_SERVICE = 'EventService';
/**
* @var string Everything related to the datamodel CRUD
* @since 3.1.0
*/
public const DM_CRUD = 'DMCRUD';
}
@@ -1035,6 +1051,7 @@ class DeprecatedCallsLog extends LogAPI
public const ENUM_CHANNEL_FILE = 'deprecated-file';
public const CHANNEL_DEFAULT = self::ENUM_CHANNEL_PHP_METHOD;
/** @var string Warning this constant won't be used directly ! To see the real default level check {@see GetLevelDefault()} */
public const LEVEL_DEFAULT = self::LEVEL_ERROR;
/** @var \FileLog we want our own instance ! */
@@ -1109,7 +1126,12 @@ class DeprecatedCallsLog extends LogAPI
}
$aStack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 4);
$iStackDeprecatedMethodLevel = 2; // level 0 = current method, level 1 = @trigger_error, level 2 = method containing the `trigger_error` call
$iStackDeprecatedMethodLevel = 2; // level 0 = current method, level 1 = @trigger_error, level 2 = method containing the `trigger_error` call (can be either 'trigger_deprecation' or the faulty method), level 3 = In some cases, method containing the 'trigger_deprecation' call
// In case current level is actually a 'trigger_deprecation' call, try to go one level further to get the real deprecated method
if (array_key_exists($iStackDeprecatedMethodLevel, $aStack) && ($aStack[$iStackDeprecatedMethodLevel]['function'] === 'trigger_deprecation') && array_key_exists($iStackDeprecatedMethodLevel + 1, $aStack)) {
$iStackDeprecatedMethodLevel++;
}
$sDeprecatedObject = $aStack[$iStackDeprecatedMethodLevel]['class'];
$sDeprecatedMethod = $aStack[$iStackDeprecatedMethodLevel]['function'];
if (($sDeprecatedObject === __CLASS__) && ($sDeprecatedMethod === 'Log')) {
@@ -1154,7 +1176,6 @@ class DeprecatedCallsLog extends LogAPI
* - else call parent method
*
* In other words, when in dev mode all deprecated calls will be logged to file
*
*/
protected static function GetLevelDefault(string $sConfigKey)
{

View File

@@ -128,9 +128,17 @@ abstract class MetaModel
/** @var string */
protected static $m_sEnvironment = 'production';
public const REENTRANCE_TYPE_UPDATE = 'update';
protected static $m_aReentranceProtection = [];
/**
* Objects currently created/updated.
*
* if an object is already being updated, then this method will return this object instead of recreating a new one.
* At this point the method DBUpdate of a new object with the same class and id won't do anything due to reentrance protection,
* so to ensure that the potential modifications are correctly saved, the object currently being updated is returned.
* DBUpdate() method then will take care that all the modifications will be saved.
*
* [class][key] -> object
*/
protected static array $m_aReentranceProtection = [];
/**
* MetaModel constructor.
@@ -342,7 +350,7 @@ abstract class MetaModel
{
self::_check_subclass($sClass);
return $sClass::GetClassName($sClass);
return call_user_func([$sClass, 'GetClassName'], $sClass);
}
/**
@@ -426,7 +434,7 @@ abstract class MetaModel
{
self::_check_subclass($sClass);
return $sClass::GetClassDescription($sClass);
return call_user_func([$sClass, 'GetClassDescription'], $sClass);
}
/**
@@ -2064,6 +2072,43 @@ abstract class MetaModel
return $aAttCodesToPrint;
}
/**
* @param string $sObjectClass class of the object containing the AttributeLinkedSetIndirect (eg: Team)
* @param string $sObjectLinkedSetIndirectAttCode code of the AttributeLinkedSetIndirect in the sObjectClass (eg: persons_list in the Team class, pointing to lnkPersonToTeam lnk class)
* @param string $sRemoteClass remote class pointed by the lnk class (eg: Person pointed by lnkPersonToTeam)
* @param string $sLnkExternalKeyToRemoteClassAttCode in the lnk class, external key to the remote class (eg: person_id in lnkPersonToTeam, pointing to a Person instance)
*
* @return string[] attcodes to display, containing aliases
* @throws \CoreException
*
* @since 3.0.0 N°2334 added code for n-n relations in {@see BlockIndirectLinksViewTable::GetAttCodesToDisplay}
* @since 3.1.0 N°3200 method creation so that it can be used elsewhere
*/
public static function GetAttributeLinkedSetIndirectDatatableAttCodesToDisplay(string $sObjectClass, string $sObjectLinkedSetIndirectAttCode, string $sRemoteClass, string $sLnkExternalKeyToRemoteClassAttCode):array
{
$aLnkAttDefsToDisplay = MetaModel::GetZListAttDefsFilteredForIndirectLinkClass($sObjectClass, $sObjectLinkedSetIndirectAttCode);
$aRemoteAttDefsToDisplay = MetaModel::GetZListAttDefsFilteredForIndirectRemoteClass($sRemoteClass);
$aLnkAttCodesToDisplay = array_map(
function ($oLnkAttDef) {
return ormLinkSet::LINK_ALIAS.'.'.$oLnkAttDef->GetCode();
},
$aLnkAttDefsToDisplay
);
if (!in_array(ormLinkSet::LINK_ALIAS.'.'.$sLnkExternalKeyToRemoteClassAttCode, $aLnkAttCodesToDisplay)) {
// we need to display a link to the remote class instance !
$aLnkAttCodesToDisplay[] = ormLinkSet::LINK_ALIAS.'.'.$sLnkExternalKeyToRemoteClassAttCode;
}
$aRemoteAttCodesToDisplay = array_map(
function ($oRemoteAttDef) {
return ormLinkSet::REMOTE_ALIAS.'.'.$oRemoteAttDef->GetCode();
},
$aRemoteAttDefsToDisplay
);
$aAttCodesToDisplay = array_merge($aLnkAttCodesToDisplay, $aRemoteAttCodesToDisplay);
return $aAttCodesToDisplay;
}
/**
* @param string $sClass
* @param string $sListCode
@@ -5081,9 +5126,9 @@ abstract class MetaModel
if (!empty(self::$m_sTablePrefix))
{
foreach(CMDBSource::EnumTables() as $sTable)
foreach(self::DBEnumTables() as $sTable)
{
// perform a case insensitive test because on Windows the table names become lowercase :-(
// perform a case-insensitive test because on Windows the table names become lowercase :-(
if (strtolower(substr($sTable, 0, strlen(self::$m_sTablePrefix))) == strtolower(self::$m_sTablePrefix))
{
CMDBSource::DropTable($sTable);
@@ -6796,7 +6841,7 @@ abstract class MetaModel
// DBUpdate() method then will take care that all the modifications will be saved.
if (array_key_exists($sClassAlias.'id', $aRow)) {
$iKey = $aRow[$sClassAlias."id"];
$oObject = self::GetReentranceObject(Metamodel::REENTRANCE_TYPE_UPDATE, $sClass, $iKey);
$oObject = self::GetReentranceObject($sClass, $iKey);
if ($oObject !== false) {
return $oObject;
}
@@ -7561,33 +7606,32 @@ abstract class MetaModel
return $oAttDef->GetStyle($sValue);
}
protected static function GetReentranceObject($sType, $sClass, $sKey)
protected static function GetReentranceObject($sClass, $sKey)
{
if (isset(self::$m_aReentranceProtection[$sType][$sClass][$sKey])) {
return self::$m_aReentranceProtection[$sType][$sClass][$sKey];
if (isset(self::$m_aReentranceProtection[$sClass][$sKey])) {
return self::$m_aReentranceProtection[$sClass][$sKey];
}
return false;
}
/**
* @param $sType
* @param \DBObject $oObject
*
* @return bool true if reentry possible
*/
public static function StartReentranceProtection($sType, DBObject $oObject)
public static function StartReentranceProtection(DBObject $oObject)
{
if (isset(self::$m_aReentranceProtection[$sType][get_class($oObject)][$oObject->GetKey()])) {
if (isset(self::$m_aReentranceProtection[get_class($oObject)][$oObject->GetKey()])) {
return false;
}
self::$m_aReentranceProtection[$sType][get_class($oObject)][$oObject->GetKey()] = $oObject;
self::$m_aReentranceProtection[get_class($oObject)][$oObject->GetKey()] = $oObject;
return true;
}
public static function StopReentranceProtection($sType, DBObject $oObject)
public static function StopReentranceProtection(DBObject $oObject)
{
if (isset(self::$m_aReentranceProtection[$sType][get_class($oObject)][$oObject->GetKey()])) {
unset(self::$m_aReentranceProtection[$sType][get_class($oObject)][$oObject->GetKey()]);
if (isset(self::$m_aReentranceProtection[get_class($oObject)][$oObject->GetKey()])) {
unset(self::$m_aReentranceProtection[get_class($oObject)][$oObject->GetKey()]);
}
}
}

View File

@@ -2860,9 +2860,26 @@ class FunctionExpression extends Expression
{
throw new \Exception("Function {$this->m_sVerb} requires 1 argument");
}
// N°5985 - Since PHP 8.1+, a bug fix on \DateTimeInterval for a date anterior to "1937-05-23" now returns a different number of days. The workaround below aim at making the code work with PHP 7.4 => 8.2+
//
// $oDate = new DateTimeImmutable('2020-01-02');
// $oZero = new DateTimeImmutable('1937-05-22');
// $iRet = (int) $oDate->diff($oZero)->format('%a');
// echo $iRet."\n"; // 30174 (PHP 8.0) vs 30175 (PHP 8.1+)
//
// $oDate = new DateTimeImmutable('2020-01-02');
// $oZero = new DateTimeImmutable('1937-05-23');
// $iRet = (int) $oDate->diff($oZero)->format('%a');
// echo $iRet."\n"; // 30174 (PHP 8.0) vs 30174 (PHP 8.1+)
//
// To work around that we take 1970-01-01 as "zero date" and we offset it with the number of days between 1582-01-01 and 1970-01-01.
// Note that as the "target" date could be between 1582-01-01 and 1970-01-01 we have to format the interval with the "-"/"+" sign in order to correct the number of days.
$oDate = new DateTime($this->m_aArgs[0]->Evaluate($aArgs));
$oZero = new DateTime('1582-01-01');
$iRet = (int) $oDate->diff($oZero)->format('%a') + 577815;
$oZero = new DateTime('1970-01-01');
$iDaysBetween19700101And15800101 = 141713;
$iRet = (int) $oZero->diff($oDate)->format('%R%a') + 577815 + $iDaysBetween19700101And15800101;
return $iRet;
case 'FROM_DAYS':

View File

@@ -26,6 +26,37 @@
class OQLException extends CoreException
{
/**
* @var string
* @since 3.1.0
*/
protected $m_MyIssue;
/**
* @var string
* @since 3.1.0
*/
protected $m_sInput;
/**
* @var int
* @since 3.1.0
*/
protected $m_iLine;
/**
* @var int
* @since 3.1.0
*/
protected $m_iCol;
/**
* @var string
* @since 3.1.0
*/
protected $m_sUnexpected;
/**
* @var array|null string
* @since 3.1.0
*/
protected $m_aExpecting;
public function __construct($sIssue, $sInput, $iLine, $iCol, $sUnexpected, $aExpecting = null)
{
$this->m_MyIssue = $sIssue;

View File

@@ -25,8 +25,8 @@
* @license http://opensource.org/licenses/AGPL-3.0
*/
use Combodo\iTop\Service\EventData;
use Combodo\iTop\Service\EventService;
use Combodo\iTop\Service\Events\EventData;
use Combodo\iTop\Service\Events\EventService;
/**
@@ -219,7 +219,7 @@ class ormDocument
'object' => $oObj,
'document' => $oDocument,
);
EventService::FireEvent(new EventData(EVENT_SERVICE_DOWNLOAD_DOCUMENT, $sClass, $aEventData));
EventService::FireEvent(new EventData(EVENT_DOWNLOAD_DOCUMENT, $sClass, $aEventData));
$oPage->TrashUnexpectedOutput();
$oPage->SetContentType($oDocument->GetMimeType());
$oPage->SetContentDisposition($sContentDisposition,$oDocument->GetFileName());

View File

@@ -847,11 +847,30 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
}
$oLinkSet = new DBObjectSet($oLinkSearch);
$oLinkSet->SetShowObsoleteData($bShowObsolete);
if ($this->HasDelta())
{
if ($this->HasDelta()) {
$oLinkSet->AddObjectArray($this->aAdded);
}
return $oLinkSet;
}
/**
* GetValues.
*
* @return array of tag codes
*/
public function GetValues()
{
$aValues = array();
foreach ($this->aPreserved as $sTagCode => $oTag) {
$aValues[] = $sTagCode;
}
foreach ($this->aAdded as $sTagCode => $oTag) {
$aValues[] = $sTagCode;
}
sort($aValues);
return $aValues;
}
}

View File

@@ -499,9 +499,9 @@ final class ormTagSet extends ormSet
}
/**
* @param $sTagCode
* @param $sTagLabel
*
* @return DBObject tag
* @return string Tag code
* @throws \CoreUnexpectedValue
* @throws \CoreException
*/

View File

@@ -21,6 +21,19 @@ use Combodo\iTop\Application\UI\Base\Layout\MultiColumn\MultiColumnUIBlockFactor
*/
class PDFBulkExport extends HTMLBulkExport
{
/**
* @var string For sample purposes
* @internal
* @since 2.7.8
*/
const ENUM_OUTPUT_TYPE_SAMPLE = 'sample';
/**
* @var string For the real export
* @internal
* @since 2.7.8
*/
const ENUM_OUTPUT_TYPE_REAL = 'real';
public function DisplayUsage(Page $oP)
{
$oP->p(" * pdf format options:");
@@ -197,6 +210,25 @@ EOF
return $sPDF;
}
/**
* @inheritDoc
* @since 2.7.8
*/
protected function GetSampleData($oObj, $sAttCode)
{
if ($sAttCode !== 'id')
{
$oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode);
// As sample data will be displayed in the web browser, AttributeImage needs to be rendered with a regular HTML format, meaning its "src" looking like "data:image/png;base64,iVBORw0KGgoAAAANSUh..."
// Whereas for the PDF generation it needs to be rendered with a TCPPDF-compatible format, meaning its "src" looking like "@iVBORw0KGgoAAAANSUh..."
if ($oAttDef instanceof AttributeImage) {
return $this->GetAttributeImageValue($oAttDef, $oObj->Get($sAttCode), static::ENUM_OUTPUT_TYPE_SAMPLE);
}
}
return parent::GetSampleData($oObj, $sAttCode);
}
protected function GetValue($oObj, $sAttCode)
{
switch($sAttCode)
@@ -212,31 +244,7 @@ EOF
$oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode);
if ($oAttDef instanceof AttributeImage)
{
// To limit the image size in the PDF output, we have to enforce the size as height/width because max-width/max-height have no effect
//
$iDefaultMaxWidthPx = 48;
$iDefaultMaxHeightPx = 48;
if ($value->IsEmpty())
{
$iNewWidth = $iDefaultMaxWidthPx;
$iNewHeight = $iDefaultMaxHeightPx;
$sUrl = $oAttDef->Get('default_image');
}
else
{
list($iWidth, $iHeight) = utils::GetImageSize($value->GetData());
$iMaxWidthPx = min($iDefaultMaxWidthPx, $oAttDef->Get('display_max_width'));
$iMaxHeightPx = min($iDefaultMaxHeightPx, $oAttDef->Get('display_max_height'));
$fScale = min($iMaxWidthPx / $iWidth, $iMaxHeightPx / $iHeight);
$iNewWidth = $iWidth * $fScale;
$iNewHeight = $iHeight * $fScale;
$sUrl = 'data:'.$value->GetMimeType().';base64,'.base64_encode($value->GetData());
}
$sRet = ($sUrl !== null) ? '<img src="'.$sUrl.'" style="width: '.$iNewWidth.'px; height: '.$iNewHeight.'px">' : '';
$sRet = '<div class="ibo-input-image--image-view">'.$sRet.'</div>';
$sRet = $this->GetAttributeImageValue($oAttDef, $value, static::ENUM_OUTPUT_TYPE_REAL);
}
else
{
@@ -251,6 +259,55 @@ EOF
return $sRet;
}
/**
* @param \AttributeImage $oAttDef Instance of image attribute
* @param \ormDocument $oValue Value of image attribute
* @param string $sOutputType {@see \PDFBulkExport::ENUM_OUTPUT_TYPE_SAMPLE}, {@see \PDFBulkExport::ENUM_OUTPUT_TYPE_REAL}
*
* @return string Rendered value of $oAttDef / $oValue according to the desired $sOutputType
* @since 2.7.8
*/
protected function GetAttributeImageValue(AttributeImage $oAttDef, ormDocument $oValue, string $sOutputType)
{
// To limit the image size in the PDF output, we have to enforce the size as height/width because max-width/max-height have no effect
//
$iDefaultMaxWidthPx = 48;
$iDefaultMaxHeightPx = 48;
if ($oValue->IsEmpty()) {
$iNewWidth = $iDefaultMaxWidthPx;
$iNewHeight = $iDefaultMaxHeightPx;
$sUrl = $oAttDef->Get('default_image');
} else {
list($iWidth, $iHeight) = utils::GetImageSize($oValue->GetData());
$iMaxWidthPx = min($iDefaultMaxWidthPx, $oAttDef->Get('display_max_width'));
$iMaxHeightPx = min($iDefaultMaxHeightPx, $oAttDef->Get('display_max_height'));
$fScale = min($iMaxWidthPx / $iWidth, $iMaxHeightPx / $iHeight);
$iNewWidth = $iWidth * $fScale;
$iNewHeight = $iHeight * $fScale;
$sValueAsBase64 = base64_encode($oValue->GetData());
switch ($sOutputType) {
case static::ENUM_OUTPUT_TYPE_SAMPLE:
$sUrl = 'data:'.$oValue->GetMimeType().';base64,'.$sValueAsBase64;
break;
case static::ENUM_OUTPUT_TYPE_REAL:
default:
// TCPDF requires base64-encoded images to be rendered without the usual "data:<MIMETYPE>;base64" header but with an "@"
// @link https://tcpdf.org/examples/example_009/
$sUrl = '@'.$sValueAsBase64;
break;
}
}
$sRet = ($sUrl !== null) ? '<img src="'.$sUrl.'" style="width: '.$iNewWidth.'px; height: '.$iNewHeight.'px;">' : '';
$sRet = '<div class="ibo-input-image--image-view">'.$sRet.'</div>';
return $sRet;
}
public function GetSupportedFormats()
{
return array('pdf' => Dict::S('Core:BulkExport:PDFFormat'));

View File

@@ -30,18 +30,40 @@
/**
* Element of the response formed by RestResultWithObjects
*
* @package REST Services
* @package RESTAPI
* @api
*/
class ObjectResult
{
/**
* @var int
* @api
*/
public $code;
/**
* @var string
* @api
*/
public $message;
/**
* @var mixed|null
* @api
*/
public $class;
/**
* @var mixed|null
* @api
*/
public $key;
/**
* @var array
* @api
*/
public $fields;
/**
* Default constructor
* @api
*/
public function __construct($sClass = null, $iId = null)
{
@@ -54,11 +76,17 @@ class ObjectResult
/**
* Helper to make an output value for a given attribute
*
*
* @api
* @param DBObject $oObject The object being reported
* @param string $sAttCode The attribute code (must be valid)
* @param boolean $bExtendedOutput Output all of the link set attributes ?
*
* @return string A scalar representation of the value
* @throws \ArchivedObjectException
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \MySQLException
*/
protected function MakeResultValue(DBObject $oObject, $sAttCode, $bExtendedOutput = false)
{
@@ -112,11 +140,17 @@ class ObjectResult
/**
* Report the value for the given object attribute
*
*
* @api
* @param DBObject $oObject The object being reported
* @param string $sAttCode The attribute code (must be valid)
* @param boolean $bExtendedOutput Output all of the link set attributes ?
*
* @return void
* @throws \ArchivedObjectException
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \MySQLException
*/
public function AddField(DBObject $oObject, $sAttCode, $bExtendedOutput = false)
{
@@ -129,8 +163,7 @@ class ObjectResult
/**
* REST response for services managing objects. Derive this structure to add information and/or constants
*
* @package Extensibility
* @package REST Services
* @package RESTAPI
* @api
*/
class RestResultWithObjects extends RestResult
@@ -140,13 +173,19 @@ class RestResultWithObjects extends RestResult
/**
* Report the given object
*
* @param int An error code (RestResult::OK is no issue has been found)
*
* @api
* @param int $iCode An error code (RestResult::OK is no issue has been found)
* @param string $sMessage Description of the error if any, an empty string otherwise
* @param DBObject $oObject The object being reported
* @param array $aFieldSpec An array of class => attribute codes (Cf. RestUtils::GetFieldList). List of the attributes to be reported.
* @param array|null $aFieldSpec An array of class => attribute codes (Cf. RestUtils::GetFieldList). List of the attributes to be reported.
* @param boolean $bExtendedOutput Output all of the link set attributes ?
*
* @return void
* @throws \ArchivedObjectException
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \MySQLException
*/
public function AddObject($iCode, $sMessage, $oObject, $aFieldSpec = null, $bExtendedOutput = false)
{
@@ -184,16 +223,30 @@ class RestResultWithObjects extends RestResult
}
}
/**
* @package RESTAPI
* @api
*/
class RestResultWithRelations extends RestResultWithObjects
{
public $relations;
/**
* @api
*/
public function __construct()
{
parent::__construct();
$this->relations = array();
}
/**
* @param $sSrcKey
* @param $sDestKey
*
* @return void
* @api
*/
public function AddRelation($sSrcKey, $sDestKey)
{
if (!array_key_exists($sSrcKey, $this->relations))
@@ -207,7 +260,7 @@ class RestResultWithRelations extends RestResultWithObjects
/**
* Deletion result codes for a target object (either deleted or updated)
*
* @package Extensibility
* @package RESTAPI
* @api
* @since 2.0.1
*/
@@ -215,30 +268,37 @@ class RestDelete
{
/**
* Result: Object deleted as per the initial request
* @api
*/
const OK = 0;
/**
* Result: general issue (user rights or ... ?)
* Result: general issue (user rights or ... ?)
* @api
*/
const ISSUE = 1;
/**
* Result: Must be deleted to preserve database integrity
* Result: Must be deleted to preserve database integrity
* @api
*/
const AUTO_DELETE = 2;
/**
* Result: Must be deleted to preserve database integrity, but that is NOT possible
* Result: Must be deleted to preserve database integrity, but that is NOT possible
* @api
*/
const AUTO_DELETE_ISSUE = 3;
/**
* Result: Must be deleted to preserve database integrity, but this must be requested explicitely
* Result: Must be deleted to preserve database integrity, but this must be requested explicitly
* @api
*/
const REQUEST_EXPLICITELY = 4;
/**
* Result: Must be updated to preserve database integrity
* @api
*/
const AUTO_UPDATE = 5;
/**
* Result: Must be updated to preserve database integrity, but that is NOT possible
* @api
*/
const AUTO_UPDATE_ISSUE = 6;
}

View File

@@ -42,7 +42,7 @@ class TemplateStringPlaceholder
public function __construct($sToken)
{
$this->sToken = $sToken;
$this->sAttcode = '';
$this->sAttCode = '';
$this->sFunction = '';
$this->sParamName = '';
$this->bIsValid = false; // Validity may be false in general, but it can work anyway (thanks to specialization) when rendering
@@ -90,9 +90,9 @@ class TemplateString
$oPlaceholder->sFunction = '';
$oPlaceholder->sParamName = $sParamName;
$sAttcode = substr($sPlaceholder, strlen($sParamPrefix));
$oPlaceholder->sAttcode = $sAttcode;
$oPlaceholder->bIsValid = MetaModel::IsValidAttCode($sClass, $sAttcode, true /* extended */);
$sAttCode = substr($sPlaceholder, strlen($sParamPrefix));
$oPlaceholder->sAttCode = $sAttCode;
$oPlaceholder->bIsValid = MetaModel::IsValidAttCode($sClass, $sAttCode, true /* extended */);
}
}
@@ -164,7 +164,7 @@ class TemplateString
$oRef = $aParamValues[$oPlaceholder->sParamName];
try
{
$value = $oRef->Get($oPlaceholder->sAttcode);
$value = $oRef->Get($oPlaceholder->sAttCode);
$aSearch[] = '$'.$oPlaceholder->sToken.'$';
$aReplace[] = $value;
$oPlaceholder->bIsValid = true;

View File

@@ -33,20 +33,22 @@ abstract class Trigger extends cmdbAbstractObject
{
$aParams = array
(
"category" => "grant_by_profile,core/cmdb",
"key_type" => "autoincrement",
"name_attcode" => "description",
"state_attcode" => "",
"reconc_keys" => array('description'),
"db_table" => "priv_trigger",
"db_key_field" => "id",
"db_finalclass_field" => "realclass",
'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-conflict.svg'),
"category" => "grant_by_profile,core/cmdb",
"key_type" => "autoincrement",
"name_attcode" => "description",
"complementary_name_attcode" => array('finalclass'),
"state_attcode" => "",
"reconc_keys" => array('description'),
"db_table" => "priv_trigger",
"db_key_field" => "id",
"db_finalclass_field" => "realclass",
'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-conflict.svg'),
);
MetaModel::Init_Params($aParams);
//MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => false, "depends_on" => array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("action_list", array("linked_class" => "lnkTriggerAction", "ext_key_to_me" => "trigger_id", "ext_key_to_remote" => "action_id", "allowed_values" => null, "count_min" => 1, "count_max" => 0, "depends_on" => array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("action_list",
array("linked_class" => "lnkTriggerAction", "ext_key_to_me" => "trigger_id", "ext_key_to_remote" => "action_id", "allowed_values" => null, "count_min" => 1, "count_max" => 0, "depends_on" => array(), "display_style" => 'property')));
$aTags = ContextTag::GetTags();
MetaModel::Init_AddAttribute( new AttributeEnumSet("context", array("allowed_values" => null, "possible_values" => new ValueSetEnumPadded($aTags), "sql" => "context", "depends_on" => array(), "is_null_allowed" => true, "max_items" => 12)));

View File

@@ -3,5 +3,7 @@
* @license http://opensource.org/licenses/AGPL-3.0
*/
@import "bulk/all";
@import "display-block/all";
@import "linked-set/all";
@import "tabular-fields/all";

View File

@@ -0,0 +1,6 @@
/*
* @copyright Copyright (C) 2010-2022 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
@import "bulk-modify";

View File

@@ -0,0 +1,14 @@
/*
* @copyright Copyright (C) 2010-2022 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
.ibo-bulk--bulk-modify--incompatible-attribute {
&:before{
margin-right: $ibo-vendors-selectize--item--icon--margin-right;
@extend %fa-solid-base;
content: '\f05a';
color: $ibo-color-information-500;
}
}

View File

@@ -0,0 +1,6 @@
/*
* @copyright Copyright (C) 2010-2022 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
@import "linked-set-selector";

View File

@@ -0,0 +1,14 @@
/*
* @copyright Copyright (C) 2010-2022 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
.ibo-linked-set--bulk-tooltip-info {
font-size: $ibo-font-size-100;
&:before{
margin-right: $ibo-vendors-selectize--item--icon--margin-right;
@extend %fa-solid-base;
content: '\f05a';
color: $ibo-color-information-500;
}
}

View File

@@ -12,17 +12,3 @@ select + label, label + select, label > select,
input + label, label + input, label > input {
margin-left: $ibo-input--spacing-left--with-label;
}
.ibo-input-with-label--label {
&.ibo-has-description {
&::after {
content: $ibo-field--label--description--content;
padding-left: $ibo-field--label--description--padding-left;
vertical-align: top;
cursor: pointer;
color: $ibo-field--label--description--color;
@extend %ibo-font-ral-bol-50;
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @copyright Copyright (C) 2010-2023 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
@@ -9,9 +9,6 @@ $ibo-alert--padding-x: 20px !default;
$ibo-alert--min-height: 30px !default;
$ibo-alert--border-radius: $ibo-border-radius-300 !default;
$ibo-alert--title--highlight--width: 4px !default;
$ibo-alert--title--highlight--height: 100% !default;
$ibo-alert--body--margin-top: $ibo-spacing-200 !default;
$ibo-alert-minimized--padding-y: 5px !default;
@@ -68,14 +65,7 @@ $ibo-alert-colors: (
@extend %ibo-font-size-150;
&::before {
display: block;
position: absolute;
top: 0;
left: 0;
content: '';
width: $ibo-alert--title--highlight--width;
height: $ibo-alert--title--highlight--height;
@include ibo-vertical-highlight;
}
.ibo-alert--title {

View File

@@ -1,5 +1,5 @@
/*
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @copyright Copyright (C) 2010-2022 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
@@ -21,7 +21,7 @@
@import "prop";
@import "title";
@import "datatable";
@import "datatable/all";
@import "form";
@import "fieldset";
@import "field";

View File

@@ -6,10 +6,6 @@
/* SCSS variables */
$ibo-field--value--color: $ibo-color-grey-800 !default;
$ibo-field--label--description--content: "?" !default;
$ibo-field--label--description--padding-left: $ibo-spacing-200 !default;
$ibo-field--label--description--color: $ibo-color-grey-600 !default;
$ibo-field--background-color--is-fullscreen: $ibo-color-white-100 !default;
$ibo-field--label--width--is-fullscreen: 100% !default;
@@ -162,18 +158,6 @@ $ibo-field--enable-bulk--checkbox--margin-left: $ibo-spacing-300 !default;
width: 30%;
word-break: break-word; /* We want labels to wrap if it is very long if it has no spaces */
@extend %ibo-font-weight-600;
> .ibo-has-description {
&::after {
content: $ibo-field--label--description--content;
padding-left: $ibo-field--label--description--padding-left;
vertical-align: top;
cursor: pointer;
color: $ibo-field--label--description--color;
@extend %ibo-font-ral-bol-50;
}
}
}
.ibo-field--label-small .ibo-field--label{
width: 20em;

View File

@@ -1,4 +1,48 @@
/*
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @copyright Copyright (C) 2010-2023 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
*/
/* SCSS variables */
$ibo-modal-option--do-not-show-again--margin-top: $ibo-spacing-500 !default;
$ibo-modal--is-informative--min-width: $ibo-size-700 !default;
$ibo-modal--is-informative--min-height: $ibo-size-300 !default;
$ibo-modal--is-informative--is-error--highlight--background-color: $ibo-color-red-600 !default;
$ibo-modal--is-informative--is-warning--highlight--background-color: $ibo-color-orange-600 !default;
$ibo-modal--is-informative--is-information--highlight--background-color: $ibo-color-blue-600 !default;
$ibo-modal--is-informative--is-success--highlight--background-color: $ibo-color-green-600 !default;
// Modal Option - Do not show again
.ibo-modal-option--do-not-show-again{
margin-top: $ibo-modal-option--do-not-show-again--margin-top;
.ibo-modal-option--do-not-show-again--checkbox{
height: auto;
display: inline-block;
width: auto;
}
}
.ibo-modal.ibo-is-informative{
display: flex;
align-items: center;
min-width: $ibo-modal--is-informative--min-width;
min-height: $ibo-modal--is-informative--min-height !important; // !important in order to overload jQueryUI CSS rule that's put directly on the element
&::before {
@include ibo-vertical-highlight;
}
&.ibo-is-error::before {
background-color: $ibo-modal--is-informative--is-error--highlight--background-color;
}
&.ibo-is-warning::before {
background-color: $ibo-modal--is-informative--is-warning--highlight--background-color;
}
&.ibo-is-information::before {
background-color: $ibo-modal--is-informative--is-information--highlight--background-color;
}
&.ibo-is-success::before {
background-color: $ibo-modal--is-informative--is-success--highlight--background-color;
}
}

View File

@@ -86,28 +86,27 @@ $ibo-panel--collapsible-toggler--font-size: $ibo-font-size-250 !default;
$ibo-panel--collapsible-toggler--color: $ibo-color-grey-700 !default;
/* Rules */
.ibo-panel {
--ibo-main-color: #{map-get($ibo-panel-colors, 'neutral')}; /* --ibo-main-color is to allow overload from custom dynamic value from the DM. The overload will be done through an additional CSS class of a particular DM class or DM attribute */
position: relative;
&.ibo-has-icon {
.ibo-panel--titles {
padding-left: $ibo-panel--icon--spacing;
// Note: Direct child selector is mandatory, otherwise a panel within a panel could be affected too when it shouldn't (eg. dashboard in an object, n:n panel)
> .ibo-panel--header {
.ibo-panel--titles {
padding-left: $ibo-panel--icon--spacing;
}
}
&.ibo-has-medallion-icon {
.ibo-panel--header-left {
position: relative;
z-index: 1;
margin-left: $ibo-panel--icon--spacing--as-medallion;
}
// Note: Direct child selector is mandatory, otherwise a panel within a panel could be affected too when it shouldn't (eg. dashboard in an object, n:n panel)
> .ibo-panel--header {
.ibo-panel--header-left {
position: relative;
z-index: 1;
margin-left: $ibo-panel--icon--spacing--as-medallion;
.ibo-panel--icon {
position: absolute;
bottom: $ibo-panel--icon--bottom--as-medallion;

View File

@@ -0,0 +1,7 @@
/*
* @copyright Copyright (C) 2010-2022 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
@import "datatable";
@import "datatableconfig";

View File

@@ -1,5 +1,5 @@
/*
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @copyright Copyright (C) 2010-2022 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
@@ -151,17 +151,3 @@ $ibo-fieldsorter--selected--background-color: $ibo-color-blue-200 !default;
}
#table-row-action-confirmation-dialog{
.ibo-row-action--confirmation--explanation{
margin-bottom: 16px;
}
.ibo-row-action--confirmation--do-not-show-again--checkbox{
height: auto;
display: inline-block;
width: auto;
}
}

View File

@@ -0,0 +1,39 @@
/*
* @copyright Copyright (C) 2010-2022 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
$ibo-datatableconfig--attributes-panel--first-column--margin-x: $ibo-spacing-0 !default;
$ibo-datatableconfig--attributes-panel--first-column--margin-y: $ibo-spacing-300 !default;
$ibo-datatableconfig--attributes-panel--first-column--max-height: 150px !default;
$ibo-datatableconfig--attributes-panel--per-page--input--margin-x: $ibo-spacing-200 !default;
$ibo-datatableconfig--attributes-panel--per-page--input--margin-y: $ibo-spacing-0 !default;
$ibo-datatableconfig--settings-panel--option--margin-right: $ibo-spacing-200 !default;
.ibo-datatableconfig--attributes-panel .ibo-panel--body{
@extend %ibo-font-ral-nor-100;
}
.ibo-datatableconfig--attributes-panel .ibo-multi-column .ibo-column:first-child{
margin: $ibo-datatableconfig--attributes-panel--first-column--margin-y $ibo-datatableconfig--attributes-panel--first-column--margin-x;
max-height: $ibo-datatableconfig--attributes-panel--first-column--max-height;
overflow-y: scroll;
}
.ibo-datatableconfig--attributes-panel--per-page--input{
margin: $ibo-datatableconfig--attributes-panel--per-page--input--margin-y $ibo-datatableconfig--attributes-panel--per-page--input--margin-x;
}
.ibo-datatableconfig--settings-panel .ibo-panel--body{
display: flex;
flex-direction: row;
}
.ibo-datatableconfig--settings-panel--options-container{
flex-grow: 1;
}
.ibo-datatableconfig--settings-panel--option{
display: flex;
flex-direction: row;
align-items: first baseline;
margin-right: $ibo-datatableconfig--settings-panel--option--margin-right;
}

View File

@@ -4,18 +4,19 @@
*/
$ibo-input-set--padding-x: $ibo-spacing-300 !default;
$ibo-input-set--padding-y: 5px !default;
$ibo-input-set--padding-y: $ibo-spacing-0 !default;
$ibo-input-set--input--height: auto !default;
$ibo-input-set--input--min-height: $ibo-input--height !default;
$ibo-input-set--input--height: 100% !default;
$ibo-input-set--remove--padding-top: 0.15em !default;
$ibo-input-set--remove--border-left: none !default;
$ibo-input-set--has-items--after--right: 8px !default;
$ibo-input-set--has-items--after--top: 5px !default;
$ibo-input-set--item--siblings-spacing: 3px !default;
$ibo-input-set--item--margin-y: $ibo-spacing-100 !default;
$ibo-input-set--item--margin-y: 1px !default;
$ibo-input-set--item--padding-x: 6px !default;
$ibo-input-set--item--padding-y: $ibo-spacing-200 !default;
$ibo-input-set--item--max-width: 120px !default;
@@ -26,6 +27,10 @@ $ibo-input-set--item--box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 0 1px 1px rgb
.ibo-input-set {
flex-wrap: wrap;
height: $ibo-input-set--input--height;
min-height: $ibo-input-set--input--min-height;
> input {
height: $ibo-input-set--input--height;
}
@@ -36,17 +41,7 @@ $ibo-input-set--item--box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 0 1px 1px rgb
border-left: $ibo-input-set--remove--border-left;
}
&.has-items::after {
content: "\f067";
font-family: "Font Awesome 5 Free";
font-weight: 600;
font-size: 10px;
position: absolute;
right: $ibo-input-set--has-items--after--right;
top: $ibo-input-set--has-items--after--top;
}
}
/* CSS rules from the old style, retrieved almost as is. Do not change the classes names in the markup without second thought as they are used by the portal as well */

View File

@@ -477,10 +477,13 @@ $ibo-navigation-menu--user-info--height--is-expanded: 100% !default;
transition-duration: 0.1s;
transition-timing-function: linear;
> .ibo-navigation-menu--menu-group-icon,
> .ibo-navigation-menu--menu-group-title{
> .ibo-navigation-menu--menu-group-icon{
display: flex; /* To avoid end space due to display:inline-block */
}
.ibo-navigation-menu--menu-group-title{
flex-grow: 1;
/* Note that display property is not set to flex on purpose so its text has an ellipsis on overflow */
}
&:not(:last-child){
margin-bottom: $ibo-navigation-menu--middle-part--elements-spacing;
@@ -661,8 +664,8 @@ $ibo-navigation-menu--user-info--height--is-expanded: 100% !default;
.ibo-navigation-menu--menu-nodes-title{
margin-top: $ibo-navigation-menu--menu-nodes-title--margin-top;
margin-bottom: $ibo-navigation-menu--menu-nodes-title--margin-bottom;
word-break: break-word; /* Ensure that long words wrap instead of being clipped */
@extend %ibo-font-ral-nor-350;
@extend %ibo-text-truncated-with-ellipsis;
}
/* - Menu node */
.ibo-navigation-menu--menu-node-title{

View File

@@ -35,6 +35,8 @@ $ibo-tab-container--extra-tab-toggler--text-color: $ibo-color-grey-700 !default;
$ibo-tab-container--extra-tab-toggler--text-color--on-hover: $ibo-color-blue-800 !default;
$ibo-tab-container--extra-tab-toggler--background-color--on-hover: $ibo-color-grey-200 !default;
$ibo-tab-container--extra-tab-toggler--tooltip-title--margin-bottom: $ibo-spacing-500 !default;
$ibo-tab-container--tab-container--label--text-color: $ibo-color-grey-600 !default;
$ibo-tab-container--tab-container--label--spacing: 20px !default;
$ibo-tab-container--tab-container--label--margin-bottom: 20px !default;
@@ -148,19 +150,24 @@ $ibo-tab-container--tab-container--last--min-height: 60vh !default;
}
}
.ibo-tab-container--extra-tab-toggler--tooltip-title {
@extend %ibo-font-weight-600;
margin-bottom: $ibo-tab-container--extra-tab-toggler--tooltip-title--margin-bottom;
}
.ibo-tab-container--tab-container {
padding: $ibo-tab-container--tab-container--padding-y $ibo-tab-container--tab-container--padding-x;
overflow-x: auto;
}
.ibo-tab-container--tab-container-list.ibo-is-scrollable {
.ibo-tab-container--tab-container--label {
.ibo-tab-container--tab-container:not(:first-child:nth-last-child(2)) .ibo-tab-container--tab-container--label {
display: block;
}
.ibo-tab-container--tab-container {
min-height: $ibo-tab-container--tab-container--min-height;
}
.ibo-tab-container--tab-container:last-child {
.ibo-tab-container--tab-container:last-child:not(:only-child) {
min-height: $ibo-tab-container--tab-container--last--min-height;
}
}

View File

@@ -5,9 +5,14 @@
@import "border-radius";
@import "color";
@import "class-icon";
@import "depression";
@import "elevation";
@import "font-icon";
@import "fullscreen";
@import "sticky-header";
@import "text-decoration";
@import "text-position";
@import "typography";
@import "misc";
@import "class-icon";
@import "visibility";

View File

@@ -0,0 +1,36 @@
/*!
* @copyright Copyright (C) 2010-2023 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
/* Used on all ancestors when an element needs to be fullscreen (see .ibo-is-fullscreen) */
html.ibo-has-fullscreen-descendant {
position: fixed !important;
width: 0 !important;
height: 0 !important;
}
body.ibo-has-fullscreen-descendant {
width: 0 !important;
height: 0 !important;
overflow: hidden !important;
}
.ibo-has-fullscreen-descendant {
position: static !important;
overflow: visible !important;
z-index: 1050 !important;
}
/* Used on a fullscreen element (see .ibo-has-fullscreen-descendant) */
.ibo-is-fullscreen {
position: absolute;
top: 0 !important;
left: 0 !important;
margin: 0 !important;
padding: 0 !important;
width: 100vw;
height: 100vh;
overflow: auto;
z-index: 1050;
}

View File

@@ -3,191 +3,9 @@
* @license http://opensource.org/licenses/AGPL-3.0
*/
/* SCSS variables */
$ibo-is-code--background-color: $ibo-color-white-200 !default;
$ibo-is-code--padding: 1.25rem 1.5rem !default;
$ibo-sticky-sentinel--left: 0 !default;
$ibo-sticky-sentinel--right: 0 !default;
$ibo-sticky-sentinel--height: 0 !default;
$ibo-sticky-sentinel-top--top: 0 !default;
$ibo-sticky-sentinel-top--height: $ibo-sticky-sentinel--height !default;
$ibo-sticky-sentinel-bottom--bottom: 0 !default;
$ibo-sticky-sentinel-bottom--height: $ibo-sticky-sentinel--height !default;
/**************/
/* Visibility */
/**************/
.ibo-is-visible {
display: inherit !important; /* Note: !important is necessary as it needs to overload any standard rules */
visibility: visible !important;
}
.ibo-is-hidden {
display: none !important; /* Note: !important is necessary as it needs to overload any standard rules */
}
.ibo-is-transparent {
opacity: 0 !important; /* Note: !important is necessary as it needs to overload any standard rules */
}
.ibo-is-opaque {
opacity: 1 !important; /* Note: !important is necessary as it needs to overload any standard rules */
}
/****************************/
/* Disposition / alignement */
/****************************/
.ibo-is-fullwidth {
width: 100%;
}
%ibo-fully-centered-content {
display: flex;
justify-content: center;
align-items: center;
}
%ibo-vertically-centered-content {
display: flex;
align-items: center;
}
/* Typically to align icons and text as it is a good practice to align them on the baseline and not the "middle" */
%ibo-baseline-centered-content {
display: flex;
align-items: baseline;
}
/* Note: This might not be named correctly. The intention is to make an element occupy the full height of its parent and to be centered in it */
%ibo-full-height-content {
display: flex;
align-items: stretch;
}
/**************/
/* Fullscreen */
/**************/
/* Used on all ancestors when an element needs to be fullscreen (see .ibo-is-fullscreen) */
html.ibo-has-fullscreen-descendant {
position: fixed !important;
width: 0 !important;
height: 0 !important;
}
body.ibo-has-fullscreen-descendant {
width: 0 !important;
height: 0 !important;
overflow: hidden !important;
}
.ibo-has-fullscreen-descendant {
position: static !important;
overflow: visible !important;
z-index: 1050 !important;
}
/* Used on a fullscreen element (see .ibo-has-fullscreen-descendant) */
.ibo-is-fullscreen {
position: absolute;
top: 0 !important;
left: 0 !important;
margin: 0 !important;
padding: 0 !important;
width: 100vw;
height: 100vh;
overflow: auto;
z-index: 1050;
}
/****************/
/* Text helpers */
/****************/
%ibo-text-truncated-with-ellipsis {
white-space: nowrap;
overflow-x: hidden;
text-overflow: ellipsis;
}
.ibo-text-truncated-with-ellipsis {
@extend %ibo-text-truncated-with-ellipsis;
}
/* Use this when you want the hyperlink to be of the color of its container's text instead of the global hyperlink color */
%ibo-hyperlink-inherited-colors {
color: inherit;
&:hover,
&:active {
color: inherit;
}
}
.ibo-is-broken-hyperlink {
text-decoration: line-through;
cursor: help;
}
.ibo-is-code {
background-color: $ibo-is-code--background-color;
padding: $ibo-is-code--padding;
@extend %ibo-font-code-150;
}
.ibo-add-margin-top-250{
margin-top: $ibo-spacing-400;
}
/*
* A single class to handle WYSIWYG generated content, where only HTML tags are available
* See https://bulma.io/documentation/elements/content/
*/
.ibo-is-html-content {
@extend .content;
/* Force user-generated tables to fit within the container as they often have an hard-coded width */
table {
width: unset !important;
max-width: max-content;
}
/* For table to render like in CKEditor, works with bulma lib. overload see:
* - ../../vendors/_bulma-variables-overload.scss)
* - ../../_shame.scss
*/
table {
border-collapse: separate;
border-spacing: 2px;
}
/* Preserve original text color in code blocks, except for the Highlight.js blocks which have their own colors */
& > code,
code:not(.hljs) {
color: inherit;
}
}
/***********************************************************************/
/* Sticky headers */
/* */
/* Used as a trigger to make an element stick to another during scroll */
/***********************************************************************/
.ibo-sticky-sentinel {
position: absolute;
left: $ibo-sticky-sentinel--left;
right: $ibo-sticky-sentinel--right;
visibility: hidden;
}
.ibo-sticky-sentinel-top {
top: $ibo-sticky-sentinel-top--top;
height: $ibo-sticky-sentinel-top--height; /* To be overloaded by use cases */
}
.ibo-sticky-sentinel-bottom {
bottom: $ibo-sticky-sentinel-bottom--bottom;
height: $ibo-sticky-sentinel-bottom--height; /* To be overloaded by use cases */
}
%ibo-medallion {
position: relative;

View File

@@ -0,0 +1,35 @@
/*!
* @copyright Copyright (C) 2010-2023 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
/***********************************************************************/
/* Sticky headers */
/* */
/* Used as a trigger to make an element stick to another during scroll */
/***********************************************************************/
/* SCSS variables */
$ibo-sticky-sentinel--left: 0 !default;
$ibo-sticky-sentinel--right: 0 !default;
$ibo-sticky-sentinel--height: 0 !default;
$ibo-sticky-sentinel-top--top: 0 !default;
$ibo-sticky-sentinel-top--height: $ibo-sticky-sentinel--height !default;
$ibo-sticky-sentinel-bottom--bottom: 0 !default;
$ibo-sticky-sentinel-bottom--height: $ibo-sticky-sentinel--height !default;
/* Rules */
.ibo-sticky-sentinel {
position: absolute;
left: $ibo-sticky-sentinel--left;
right: $ibo-sticky-sentinel--right;
visibility: hidden;
}
.ibo-sticky-sentinel-top {
top: $ibo-sticky-sentinel-top--top;
height: $ibo-sticky-sentinel-top--height; /* To be overloaded by use cases */
}
.ibo-sticky-sentinel-bottom {
bottom: $ibo-sticky-sentinel-bottom--bottom;
height: $ibo-sticky-sentinel-bottom--height; /* To be overloaded by use cases */
}

View File

@@ -0,0 +1,90 @@
/*!
* @copyright Copyright (C) 2010-2023 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
/* SCSS variables */
$ibo-has-description--content: "?" !default;
$ibo-has-description--padding-left: $ibo-spacing-200 !default;
$ibo-has-description--color: $ibo-color-grey-600 !default;
$ibo-has-description--font-size: 0.7em !default; /* Font size is em on purpose as we want it to be proportional to its context */
$ibo-is-code--background-color: $ibo-color-white-200 !default;
$ibo-is-code--padding: 1.25rem 1.5rem !default;
/* Rules */
%ibo-text-truncated-with-ellipsis {
white-space: nowrap;
overflow-x: hidden;
text-overflow: ellipsis;
}
.ibo-text-truncated-with-ellipsis {
@extend %ibo-text-truncated-with-ellipsis;
}
/* Use this when you want the hyperlink to be of the color of its container's text instead of the global hyperlink color */
%ibo-hyperlink-inherited-colors {
color: inherit;
&:hover,
&:active {
color: inherit;
}
}
.ibo-is-broken-hyperlink {
text-decoration: line-through;
cursor: help;
}
/* Class to display a hint on elements that have a tooltip for further description */
.ibo-has-description {
&::after {
content: $ibo-has-description--content;
padding-left: $ibo-has-description--padding-left;
vertical-align: top;
cursor: pointer;
color: $ibo-has-description--color;
/* We don't use a %ibo-font-ral-xxx-yyy as we need a specific size */
@extend %ibo-font-weight-700;
font-size: $ibo-has-description--font-size;
}
}
.ibo-is-code {
background-color: $ibo-is-code--background-color;
padding: $ibo-is-code--padding;
@extend %ibo-font-code-150;
}
/*
* A single class to handle WYSIWYG generated content, where only HTML tags are available
* See https://bulma.io/documentation/elements/content/
*/
.ibo-is-html-content {
@extend .content;
/* Force user-generated tables to fit within the container as they often have an hard-coded width */
table {
width: unset !important;
max-width: max-content;
}
/* For table to render like in CKEditor, works with bulma lib. overload see:
* - ../../vendors/_bulma-variables-overload.scss)
* - ../../_shame.scss
*/
table {
border-collapse: separate;
border-spacing: 2px;
}
/* Preserve original text color in code blocks, except for the Highlight.js blocks which have their own colors */
& > code,
code:not(.hljs) {
color: inherit;
}
}

View File

@@ -0,0 +1,34 @@
/*!
* @copyright Copyright (C) 2010-2023 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
/****************************/
/* Disposition / alignement */
/****************************/
.ibo-is-fullwidth {
width: 100%;
}
%ibo-fully-centered-content {
display: flex;
justify-content: center;
align-items: center;
}
%ibo-vertically-centered-content {
display: flex;
align-items: center;
}
/* Typically to align icons and text as it is a good practice to align them on the baseline and not the "middle" */
%ibo-baseline-centered-content {
display: flex;
align-items: baseline;
}
/* Note: This might not be named correctly. The intention is to make an element occupy the full height of its parent and to be centered in it */
%ibo-full-height-content {
display: flex;
align-items: stretch;
}

View File

@@ -0,0 +1,21 @@
/*!
* @copyright Copyright (C) 2010-2023 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
.ibo-is-visible {
display: inherit !important; /* Note: !important is necessary as it needs to overload any standard rules */
visibility: visible !important;
}
.ibo-is-hidden {
display: none !important; /* Note: !important is necessary as it needs to overload any standard rules */
}
.ibo-is-transparent {
opacity: 0 !important; /* Note: !important is necessary as it needs to overload any standard rules */
}
.ibo-is-opaque {
opacity: 1 !important; /* Note: !important is necessary as it needs to overload any standard rules */
}

View File

@@ -1,5 +1,6 @@
/*
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @copyright Copyright (C) 2010-2023 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
@import "highlight";

View File

@@ -0,0 +1,17 @@
/*
* @copyright Copyright (C) 2010-2023 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
$ibo-vertical-highlight--width: $ibo-size-100;
$ibo-vertical-highlight--height: 100%;
@mixin ibo-vertical-highlight {
display: block;
position: absolute;
top: 0;
left: 0;
content: "";
width: $ibo-vertical-highlight--width;
height: $ibo-vertical-highlight--height;
}

View File

@@ -4,10 +4,95 @@
*/
$ibo-vendors-selectize-input--color: $ibo-color-grey-900 !default;
$ibo-vendors-selectize-control--plugin-add-button--add-option--right: $ibo-spacing-0 !default;
$ibo-vendors-selectize-control--plugin-add-button--add-option--height: 100% !default;
$ibo-vendors-selectize-control--plugin-add-button--add-option--width: $ibo-size-350 !default;
$ibo-vendors-selectize-control--plugin-add-button--add-option--color: $ibo-color-grey-900 !default;
$ibo-vendors-selectize--item--icon--margin-right: $ibo-spacing-200 !default;
$ibo-vendors-selectize--item--add--background-color: $ibo-color-green-100 !default;
$ibo-vendors-selectize--item--add--icon--color: $ibo-color-green-900 !default;
$ibo-vendors-selectize--item--remove--background-color: $ibo-color-red-100 !default;
$ibo-vendors-selectize--item--remove--icon--color: $ibo-color-red-800 !default;
$ibo-vendors-selectize--item--ignore-partial--background-color: $ibo-color-grey-200 !default;
$ibo-vendors-selectize--input-error--border: 1px solid $ibo-color-red-600 !default;
.selectize-dropdown-content {
max-height: unset; /* Overloaded as it will be handled by the _input-select.scss partial */
}
.selectize-input input{
color: $ibo-vendors-selectize-input--color;
}
.selectize-control.plugin-combodo_add_button{
display: flex;
.selectize-add-option {
position: absolute;
right: $ibo-vendors-selectize-control--plugin-add-button--add-option--right;
display: inline-flex;
justify-content: center;
align-items: center;
height: $ibo-vendors-selectize-control--plugin-add-button--add-option--height;
width: $ibo-vendors-selectize-control--plugin-add-button--add-option--width;
z-index: 1;
color: $ibo-vendors-selectize-control--plugin-add-button--add-option--color;
}
}
// Simple options renderer
.simple-option-renderer--container {
display: flex;
align-items: center;
}
.simple-option-renderer--container--icon {
width: 25px;
text-align: center;
}
.simple-option-renderer--container--label {
margin-left: 3px;
flex-grow: 1;
}
.selectize-input{
.attribute-set-item{
>* {
display: inline;
}
&.item-add::before,&.item-remove::before{
@extend %fa-solid-base;
margin-right: $ibo-vendors-selectize--item--icon--margin-right;
}
&.item-add{
background-color: $ibo-vendors-selectize--item--add--background-color !important;
&::before{
color: $ibo-vendors-selectize--item--add--icon--color;
content: '\f067';
}
}
&.item-remove{
background-color: $ibo-vendors-selectize--item--remove--background-color !important;
&::before{
color: $ibo-vendors-selectize--item--remove--icon--color;
content: '\f1f8';
}
}
&.item-ignore-partial{
background-color: $ibo-vendors-selectize--item--ignore-partial--background-color !important;
}
}
&.selectize-input-error{
border: $ibo-vendors-selectize--input-error--border;
}
}

View File

@@ -6,7 +6,7 @@
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
'CAS:Error:UserNotAllowed' => 'User not allowed~~',
'CAS:Login:SignIn' => 'Sign in with CAS~~',
'CAS:Login:SignInTooltip' => 'Click here to authenticate yourself with the CAS server~~',
'CAS:Error:UserNotAllowed' => 'Nem engedélyezett felhasználó',
'CAS:Login:SignIn' => 'Bejelentkezés CAS szerverrel',
'CAS:Login:SignInTooltip' => 'Kattintson ide az azonosításhoz a CAS szerveren',
));

View File

@@ -20,26 +20,26 @@
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
'Class:UserLocal' => 'ITOP_APPLICATION_SHORT felhasználó',
'Class:UserLocal' => ITOP_APPLICATION_SHORT.' felhasználó',
'Class:UserLocal+' => '',
'Class:UserLocal/Attribute:password' => 'Jelszó',
'Class:UserLocal/Attribute:password+' => '',
'Class:UserLocal/Attribute:expiration' => 'Password expiration~~',
'Class:UserLocal/Attribute:expiration+' => 'Password expiration status (requires an extension to have an effect)~~',
'Class:UserLocal/Attribute:expiration/Value:can_expire' => 'Can expire~~',
'Class:UserLocal/Attribute:expiration' => 'Jelszó lejárati ideje',
'Class:UserLocal/Attribute:expiration+' => 'Jelszó lejárati státusz (bővítmény szükséges hozzá)',
'Class:UserLocal/Attribute:expiration/Value:can_expire' => 'Lejár',
'Class:UserLocal/Attribute:expiration/Value:can_expire+' => '~~',
'Class:UserLocal/Attribute:expiration/Value:never_expire' => 'Never expire~~',
'Class:UserLocal/Attribute:expiration/Value:never_expire' => 'Soha nem jár le',
'Class:UserLocal/Attribute:expiration/Value:never_expire+' => '~~',
'Class:UserLocal/Attribute:expiration/Value:force_expire' => 'Expired~~',
'Class:UserLocal/Attribute:expiration/Value:force_expire' => 'Lejárt',
'Class:UserLocal/Attribute:expiration/Value:force_expire+' => '~~',
'Class:UserLocal/Attribute:expiration/Value:otp_expire' => 'One-time Password~~',
'Class:UserLocal/Attribute:expiration/Value:otp_expire+' => 'Password cannot be changed by the user.~~',
'Class:UserLocal/Attribute:password_renewed_date' => 'Password renewal~~',
'Class:UserLocal/Attribute:password_renewed_date+' => 'When the password was last changed~~',
'Class:UserLocal/Attribute:expiration/Value:otp_expire' => 'Egyszeri jelszó',
'Class:UserLocal/Attribute:expiration/Value:otp_expire+' => 'A felhasználó nem változtathat jelszót.',
'Class:UserLocal/Attribute:password_renewed_date' => 'Jelszó megújítás',
'Class:UserLocal/Attribute:password_renewed_date+' => 'A jelszó legutóbbi módosításának időpontja',
'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Password must be at least 8 characters and include uppercase, lowercase, numeric and special characters.~~',
'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'A jelszónak legalább 8 karakterből kell állnia, és tartalmaznia kell nagybetűket, kisbetűket, numerikus és speciális karaktereket.',
'UserLocal:password:expiration' => 'The fields below require an extension~~',
'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Setting password expiration to "One-time password" is not allowed for your own User~~',
'UserLocal:password:expiration' => 'Az alábbi mezőkhöz egy bővítmény szükséges',
'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'A jelszó lejárati idejének beállítása "Egyszeri jelszóra" nem engedélyezett a saját Felhasználó számára.',
));

File diff suppressed because one or more lines are too long

View File

@@ -21,6 +21,8 @@ use Combodo\iTop\Core\MetaModel\HierarchicalKey;
class DatabaseAnalyzer
{
const LIMIT = 100;
var $iTimeLimitPerOperation;
public function __construct($iTimeLimitPerOperation = null)
@@ -45,7 +47,7 @@ class DatabaseAnalyzer
set_time_limit(intval($this->iTimeLimitPerOperation));
}
$aWrongRecords = CMDBSource::QueryToArray($sSelWrongRecs);
$aWrongRecords = CMDBSource::QueryToArray($sSelWrongRecs.' limit '.self::LIMIT);
if (count($aWrongRecords) > 0)
{
foreach($aWrongRecords as $aRes)

View File

@@ -207,9 +207,13 @@ function DisplayErrorList($aResults)
foreach ($aResults as $sClass => $aErrorList) {
foreach ($aErrorList as $sErrorLabel => $aError) {
$iCount = $aError['count'];
if ($iCount === DatabaseAnalyzer::LIMIT) {
$iCount = "$iCount(+)";
}
$aRows[] = [
'class' => MetaModel::GetName($sClass).' ('.$sClass.')',
'count' => $aError['count'],
'count' => $iCount,
'error' => $sErrorLabel,
];
}
@@ -227,10 +231,19 @@ function DisplayErrorDetails($aResults, $bVerbose)
foreach ($aResults as $sClass => $aErrorList) {
foreach ($aErrorList as $sErrorLabel => $aError) {
$sErrorTitle = Dict::Format('DBTools:DetailedErrorTitle', MetaModel::GetName($sClass).' ('.$sClass.')', $aError['count'], $sErrorLabel);
$iCount = $aError['count'];
if ($iCount === DatabaseAnalyzer::LIMIT) {
$iCount = "$iCount(+)";
}
$sErrorTitle = Dict::Format('DBTools:DetailedErrorTitle', MetaModel::GetName($sClass).' ('.$sClass.')', $iCount, $sErrorLabel);
$oCollapsible = CollapsibleSectionUIBlockFactory::MakeStandard($sErrorTitle);
$oBlock->AddSubBlock($oCollapsible);
if ($aError['count'] === DatabaseAnalyzer::LIMIT) {
$oHTML = new Combodo\iTop\Application\UI\Base\Component\Html\Html('<p>'.Dict::format('DBTools:DetailedErrorLimit', DatabaseAnalyzer::LIMIT).'</p>');
$oCollapsible->AddSubBlock($oHTML);
}
$oFieldSet = FieldSetUIBlockFactory::MakeStandard(Dict::S('DBTools:SQLquery'));
$oCollapsible->AddSubBlock($oFieldSet);

View File

@@ -49,6 +49,7 @@ Dict::Add('EN US', 'English', 'English', array(
'DBTools:Inconsistencies' => 'Database inconsistencies',
'DBTools:DetailedErrorTitle' => '%2$s error(s) in class %1$s: %3$s',
'DBTools:DetailedErrorLimit' => 'List limited to %1$s errors',
'DBAnalyzer-Integrity-OrphanRecord' => 'Orphan record in `%1$s`, it should have its counterpart in table `%2$s`',
'DBAnalyzer-Integrity-InvalidExtKey' => 'Invalid external key %1$s (column: `%2$s.%3$s`)',

View File

@@ -44,6 +44,7 @@ Dict::Add('FR FR', 'French', 'Français', array(
'DBTools:Inconsistencies' => 'Incohérences de base de données',
'DBTools:DetailedErrorTitle' => '%2$s erreur(s) dans la classe %1$s : %3$s',
'DBTools:DetailedErrorLimit' => 'Liste limitée à %1$s erreurs',
'DBAnalyzer-Integrity-OrphanRecord' => 'Enregistrement orphelin dans `%1$s`, il devrait avoir son équivalent dans la table `%2$s`',
'DBAnalyzer-Integrity-InvalidExtKey' => 'Clé externe invalide %1$s (colonne: `%2$s.%3$s`)',

View File

@@ -23,72 +23,72 @@
// Database inconsistencies
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
// Dictionary entries go here
'Menu:DBToolsMenu' => 'DB Tools~~',
'DBTools:Class' => 'Class~~',
'DBTools:Title' => 'Database Maintenance Tools~~',
'DBTools:ErrorsFound' => 'Errors Found~~',
'DBTools:Indication' => 'Important: after fixing errors in the database you\'ll have to run the analysis again as new inconsistencies will be generated~~',
'DBTools:Disclaimer' => 'DISCLAIMER: BACKUP YOUR DATABASE BEFORE RUNNING THE FIXES~~',
'DBTools:Error' => 'Error~~',
'DBTools:Count' => 'Count~~',
'DBTools:SQLquery' => 'SQL query~~',
'DBTools:FixitSQLquery' => 'SQL query To Fix it (indication)~~',
'DBTools:SQLresult' => 'SQL result~~',
'DBTools:NoError' => 'The database is OK~~',
'DBTools:HideIds' => 'Error List~~',
'DBTools:ShowIds' => 'Detailed view~~',
'DBTools:ShowReport' => 'Report~~',
'DBTools:IntegrityCheck' => 'Integrity check~~',
'DBTools:FetchCheck' => 'Fetch Check (long)~~',
'DBTools:SelectAnalysisType' => 'Select analysis type~~',
'Menu:DBToolsMenu' => 'DB eszközök',
'DBTools:Class' => 'Osztály',
'DBTools:Title' => 'Adatbázis karbantartó eszközök',
'DBTools:ErrorsFound' => 'Hibák vannak',
'DBTools:Indication' => 'Fontos: az adatbázisban lévő hibák kijavítása után újra kell futtatni az elemzést, mivel új következetlenségek keletkeznek.',
'DBTools:Disclaimer' => 'A JAVÍTÁSOK FUTTATÁSA ELŐTT MINDIG KÉSZÍTSEN BIZTONSÁGI MENTÉST AZ ADATBÁZISÁRÓL.',
'DBTools:Error' => 'Hiba',
'DBTools:Count' => 'Sorszám',
'DBTools:SQLquery' => 'SQL lekérdezés',
'DBTools:FixitSQLquery' => 'SQL lekérdezés To Fix it (indication)',
'DBTools:SQLresult' => 'SQL eredmény',
'DBTools:NoError' => 'Az adatbázis OK',
'DBTools:HideIds' => 'Hibalista',
'DBTools:ShowIds' => 'Részletes nézet',
'DBTools:ShowReport' => 'Jelentés',
'DBTools:IntegrityCheck' => 'Integritás ellenőrzés',
'DBTools:FetchCheck' => 'Lehívás ellenőrzés (hosszú)',
'DBTools:SelectAnalysisType' => 'Válasszon elemzés típust',
'DBTools:Analyze' => 'Analyze~~',
'DBTools:Details' => 'Show Details~~',
'DBTools:ShowAll' => 'Show All Errors~~',
'DBTools:Analyze' => 'Elemzés',
'DBTools:Details' => 'Részletek mutatása',
'DBTools:ShowAll' => 'Minden hiba mutatása',
'DBTools:Inconsistencies' => 'Database inconsistencies~~',
'DBTools:DetailedErrorTitle' => '%2$s error(s) in class %1$s: %3$s~~',
'DBTools:Inconsistencies' => 'Adatbázis inkonzisztenciák',
'DBTools:DetailedErrorTitle' => '%2$s hiba a %1$s osztályban: %3$s',
'DBAnalyzer-Integrity-OrphanRecord' => 'Orphan record in `%1$s`, it should have its counterpart in table `%2$s`~~',
'DBAnalyzer-Integrity-InvalidExtKey' => 'Invalid external key %1$s (column: `%2$s.%3$s`)~~',
'DBAnalyzer-Integrity-MissingExtKey' => 'Missing external key %1$s (column: `%2$s.%3$s`)~~',
'DBAnalyzer-Integrity-InvalidValue' => 'Invalid value for %1$s (column: `%2$s.%3$s`)~~',
'DBAnalyzer-Integrity-UsersWithoutProfile' => 'Some user accounts have no profile at all~~',
'DBAnalyzer-Integrity-HKInvalid' => 'Broken hierarchical key `%1$s`~~',
'DBAnalyzer-Fetch-Count-Error' => 'Fetch count error in `%1$s`, %2$d entries fetched / %3$d counted~~',
'DBAnalyzer-Integrity-FinalClass' => 'Field `%2$s`.`%1$s` must have the same value as `%3$s`.`%1$s`~~',
'DBAnalyzer-Integrity-RootFinalClass' => 'Field `%2$s`.`%1$s` must contains a valid class~~',
'DBAnalyzer-Integrity-OrphanRecord' => 'Elárvult rekord a `%1$s` -ban, kell hogy legyen megfelelője a `%2$s` táblázatban',
'DBAnalyzer-Integrity-InvalidExtKey' => 'Érvénytelen a %1$s külső kulcs (oszlop: `%2$s.%3$s`)',
'DBAnalyzer-Integrity-MissingExtKey' => 'Hiányzik a %1$s külső külcs (oszlop: `%2$s.%3$s`)',
'DBAnalyzer-Integrity-InvalidValue' => '%1$s értéke érvénytelen (oszlop: `%2$s.%3$s`)~~',
'DBAnalyzer-Integrity-UsersWithoutProfile' => 'Néhány felhasználónak egyáltalán nincs fiókja',
'DBAnalyzer-Integrity-HKInvalid' => 'Sérült a `%1$s` hierarchikus kulcs',
'DBAnalyzer-Fetch-Count-Error' => 'Lekérési hiba a `%1$s` -nál, %2$d bejegyzés lekérve / %3$d megszámlálva',
'DBAnalyzer-Integrity-FinalClass' => 'A `%2$s`.`%1$s` mezőnek ugyanolyan értékűnek kell lennie mint a `%3$s`.`%1$s`',
'DBAnalyzer-Integrity-RootFinalClass' => '`%2$s`.`%1$s` mezőnek érvényes osztályt kell tartalmaznia',
));
// Database Info
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
'DBTools:DatabaseInfo' => 'Database Information~~',
'DBTools:Base' => 'Base~~',
'DBTools:Size' => 'Size~~',
'DBTools:DatabaseInfo' => 'Adatbázis információ',
'DBTools:Base' => 'Bázis',
'DBTools:Size' => 'Méret',
));
// Lost attachments
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
'DBTools:LostAttachments' => 'Lost attachments~~',
'DBTools:LostAttachments:Disclaimer' => 'Here you can search your database for lost or misplaced attachments. This is NOT a data recovery tool, is does not retrieve deleted data.~~',
'DBTools:LostAttachments' => 'Elveszett mellékletek',
'DBTools:LostAttachments:Disclaimer' => 'Itt kereshet az adatbázisban elveszett vagy elkeveredett mellékletek után. Ez NEM egy adat-visszaállítási eszköz, nem állítja vissza a törölt adatokat.',
'DBTools:LostAttachments:Button:Analyze' => 'Analyze~~',
'DBTools:LostAttachments:Button:Restore' => 'Restore~~',
'DBTools:LostAttachments:Button:Restore:Confirm' => 'This action cannot be undone, please confirm that you want to restore the selected files.~~',
'DBTools:LostAttachments:Button:Busy' => 'Please wait...~~',
'DBTools:LostAttachments:Button:Analyze' => 'Elemzés',
'DBTools:LostAttachments:Button:Restore' => 'Visszaállítás',
'DBTools:LostAttachments:Button:Restore:Confirm' => 'Ez a művelet nem vonható vissza, kérjük, erősítse meg, hogy vissza kívánja-e állítani a kiválasztott fájlokat.',
'DBTools:LostAttachments:Button:Busy' => 'Kérem várjon...',
'DBTools:LostAttachments:Step:Analyze' => 'First, search for lost/misplaced attachments by analyzing the database.~~',
'DBTools:LostAttachments:Step:Analyze' => 'Először az adatbázis elemzésével keresse meg az elveszett/áthelyezett mellékleteket.',
'DBTools:LostAttachments:Step:AnalyzeResults' => 'Analyze results:~~',
'DBTools:LostAttachments:Step:AnalyzeResults:None' => 'Great! Every thing seems to be at the right place.~~',
'DBTools:LostAttachments:Step:AnalyzeResults:Some' => 'Some attachments (%1$d) seem to be misplaced. Take a look at the following list and check the ones you would like to move.~~',
'DBTools:LostAttachments:Step:AnalyzeResults:Item:Filename' => 'Filename~~',
'DBTools:LostAttachments:Step:AnalyzeResults:Item:CurrentLocation' => 'Current location~~',
'DBTools:LostAttachments:Step:AnalyzeResults:Item:TargetLocation' => 'Move to...~~',
'DBTools:LostAttachments:Step:AnalyzeResults' => 'Elemzés eredménye:',
'DBTools:LostAttachments:Step:AnalyzeResults:None' => 'Nagyszerű! Úgy tűnik, minden a helyén van.',
'DBTools:LostAttachments:Step:AnalyzeResults:Some' => 'Úgy tűnik, hogy néhány melléklet (%1$d) rossz helyen van. Nézze meg az alábbi listát, és ellenőrizze azokat, amelyeket szeretne áthelyezni.',
'DBTools:LostAttachments:Step:AnalyzeResults:Item:Filename' => 'Fájlnév',
'DBTools:LostAttachments:Step:AnalyzeResults:Item:CurrentLocation' => 'Jelenlegi helye',
'DBTools:LostAttachments:Step:AnalyzeResults:Item:TargetLocation' => 'Áthelyezés...',
'DBTools:LostAttachments:Step:RestoreResults' => 'Restore results:~~',
'DBTools:LostAttachments:Step:RestoreResults:Results' => '%1$d/%2$d attachments were restored.~~',
'DBTools:LostAttachments:Step:RestoreResults' => 'Visszaállítás eredménye:',
'DBTools:LostAttachments:Step:RestoreResults:Results' => '%1$d/%2$d melléklet lett visszaállítva.',
'DBTools:LostAttachments:StoredAsInlineImage' => 'Stored as inline image~~',
'DBTools:LostAttachments:History' => 'Attachment "%1$s" restored with DB tools~~'
'DBTools:LostAttachments:StoredAsInlineImage' => 'Soron belüli képként tárolva',
'DBTools:LostAttachments:History' => 'A "%1$s" melléklet visszaállítva a DB eszközzel'
));

View File

@@ -8,6 +8,7 @@
namespace Combodo\iTop\DBTools\Service;
use CoreException;
use DatabaseAnalyzer;
use Dict;
use DictExceptionMissingString;
use MetaModel;
@@ -38,6 +39,9 @@ class DBAnalyzerUtils
fwrite($fReport, "\r\n-- \r\n");
fwrite($fReport, '-- Class: '.MetaModel::GetName($sClass).' ('.$sClass.")\r\n");
$iCount = $aError['count'];
if ($iCount === DatabaseAnalyzer::LIMIT) {
$iCount = "$iCount(+)";
}
fwrite($fReport, '-- Count: '.$iCount."\r\n");
fwrite($fReport, '-- Error: '.$sErrorLabel."\r\n");
if (array_key_exists('query', $aError)) {

View File

@@ -256,7 +256,7 @@
</class>
</classes>
<events>
<event id="EVENT_SERVICE_ADD_ATTACHMENT_TO_OBJECT" _delta="define">
<event id="EVENT_ADD_ATTACHMENT_TO_OBJECT" _delta="define">
<description>An attachment has been added to an object</description>
<replaces>Attachment::AfterUpdate</replaces>
<sources>
@@ -278,7 +278,7 @@
</event_datum>
</event_data>
</event>
<event id="EVENT_SERVICE_REMOVE_ATTACHMENT_FROM_OBJECT" _delta="define">
<event id="EVENT_REMOVE_ATTACHMENT_FROM_OBJECT" _delta="define">
<description>An attachment has been removed from an object</description>
<replaces>Attachment::AfterUpdate</replaces>
<sources>

View File

@@ -21,26 +21,24 @@
* along with iTop. If not, see <http://www.gnu.org/licenses/>
*/
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
'Attachments:TabTitle_Count' => 'Attachments (%1$d)~~',
'Attachments:EmptyTabTitle' => 'Attachments~~',
'Attachments:FieldsetTitle' => 'Attachments~~',
'Attachments:DeleteBtn' => 'Delete~~',
'Attachments:History_File_Added' => 'Attachment %1$s added.~~',
'Attachments:History_File_Removed' => 'Attachment %1$s removed.~~',
'Attachments:AddAttachment' => 'Add attachment: ~~',
'Attachments:UploadNotAllowedOnThisSystem' => 'File upload in NOT allowed on this system.~~',
'Attachment:Max_Go' => '(Maximum file size: %1$s Go)~~',
'Attachment:Max_Mo' => '(Maximum file size: %1$s Mo)~~',
'Attachment:Max_Ko' => '(Maximum file size: %1$s Ko)~~',
'Attachments:NoAttachment' => 'No attachment. ~~',
'Attachments:PreviewNotAvailable' => 'Preview not available for this type of attachment.~~',
'Attachments:Error:FileTooLarge' => 'File is too large to be uploaded. %1$s~~',
'Attachments:Error:UploadedFileEmpty' => 'The received file is empty and cannot be attached.
Either you have pushed an empty file,
or ask your iTop administrator if the iTop server disk is full.~~',
'Attachments:Render:Icons' => 'Display as icons~~',
'Attachments:Render:Table' => 'Display as list~~',
'UI:Attachments:DropYourFileHint' => 'Drop files anywhere in this area~~',
'Attachments:TabTitle_Count' => 'Mellékletek (%1$d)',
'Attachments:EmptyTabTitle' => 'Mellékletek',
'Attachments:FieldsetTitle' => 'Mellékletek',
'Attachments:DeleteBtn' => 'Törlés',
'Attachments:History_File_Added' => '%1$s melléklet hozzáadva',
'Attachments:History_File_Removed' => '%1$s melléklet eltávolítva',
'Attachments:AddAttachment' => 'Melléklet hozzáadása: ',
'Attachments:UploadNotAllowedOnThisSystem' => 'A fájlfeltöltés nem engedélyezett ezen a rendszeren',
'Attachment:Max_Go' => '(Maximum fájlméret: %1$s GB)',
'Attachment:Max_Mo' => '(Maximum fájlméret: %1$s MB)',
'Attachment:Max_Ko' => '(Maximum fájlméret: %1$s KB)',
'Attachments:NoAttachment' => 'Nincs melléklet. ',
'Attachments:PreviewNotAvailable' => 'Az előnézet nem érhető el ilyen típusú melléklethez',
'Attachments:Error:FileTooLarge' => 'Túl nagy a fájl a feltöltéshez. %1$s',
'Attachments:Error:UploadedFileEmpty' => 'A kapott fájl üres, ezért nem csatolható. Vagy egy üres fájlt tolt be, vagy kérdezze meg a rendszergazdát, hátha az iTop szerver lemeze telt meg.',
'Attachments:Render:Icons' => 'Mutassa ikonként',
'Attachments:Render:Table' => 'Mutassa listaként',
'UI:Attachments:DropYourFileHint' => 'Húzza a fájlokat erre a területre',
));
//
@@ -48,40 +46,40 @@ or ask your iTop administrator if the iTop server disk is full.~~',
//
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
'Class:Attachment' => 'Attachment~~',
'Class:Attachment' => 'Mellékletek',
'Class:Attachment+' => '~~',
'Class:Attachment/Attribute:expire' => 'Expire~~',
'Class:Attachment/Attribute:expire' => 'Lejárat',
'Class:Attachment/Attribute:expire+' => '~~',
'Class:Attachment/Attribute:temp_id' => 'Temporary id~~',
'Class:Attachment/Attribute:temp_id' => 'Átmeneti azonosító',
'Class:Attachment/Attribute:temp_id+' => '~~',
'Class:Attachment/Attribute:item_class' => 'Item class~~',
'Class:Attachment/Attribute:item_class' => 'Elem osztály',
'Class:Attachment/Attribute:item_class+' => '~~',
'Class:Attachment/Attribute:item_id' => 'Item~~',
'Class:Attachment/Attribute:item_id' => 'Elem',
'Class:Attachment/Attribute:item_id+' => '~~',
'Class:Attachment/Attribute:item_org_id' => 'Item organization~~',
'Class:Attachment/Attribute:item_org_id' => 'Elem szervezet',
'Class:Attachment/Attribute:item_org_id+' => '~~',
'Class:Attachment/Attribute:contents' => 'Contents~~',
'Class:Attachment/Attribute:contents' => 'Tartalomjegyzék',
'Class:Attachment/Attribute:contents+' => '~~',
));
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
'Attachments:File:Thumbnail' => 'Icon~~',
'Attachments:File:Name' => 'File name~~',
'Attachments:File:Date' => 'Upload date~~',
'Attachments:File:Uploader' => 'Uploaded by~~',
'Attachments:File:Size' => 'Size~~',
'Attachments:File:MimeType' => 'Type~~',
'Attachments:File:Thumbnail' => 'Ikon',
'Attachments:File:Name' => 'Fájlnév',
'Attachments:File:Date' => 'Feltöltés dátum',
'Attachments:File:Uploader' => 'Feltöltötte ',
'Attachments:File:Size' => 'Méret',
'Attachments:File:MimeType' => 'Típus',
));
//
// Class: Attachment
//
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
'Class:Attachment/Attribute:creation_date' => 'Creation date~~',
'Class:Attachment/Attribute:creation_date' => 'Létrehozás dátum',
'Class:Attachment/Attribute:creation_date+' => '~~',
'Class:Attachment/Attribute:user_id' => 'User id~~',
'Class:Attachment/Attribute:user_id' => 'Felhasználói azonosító',
'Class:Attachment/Attribute:user_id+' => '~~',
'Class:Attachment/Attribute:contact_id' => 'Contact id~~',
'Class:Attachment/Attribute:contact_id' => 'Kapcsolattartó azonosító',
'Class:Attachment/Attribute:contact_id+' => '~~',
));

View File

@@ -305,7 +305,7 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt
if (in_array($oAttachment->GetKey(), $aRemovedAttachmentIds))
{
$aData = ['target_object' => $oObject];
$oAttachment->FireEvent(EVENT_SERVICE_REMOVE_ATTACHMENT_FROM_OBJECT, $aData);
$oAttachment->FireEvent(EVENT_REMOVE_ATTACHMENT_FROM_OBJECT, $aData);
$oAttachment->DBDelete();
$aActions[] = self::GetActionChangeOp($oAttachment, false /* false => deletion */);
}
@@ -335,7 +335,7 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt
// temporary attachment confirmed, list it in the history
$aActions[] = self::GetActionChangeOp($oAttachment, true /* true => creation */);
$aData = ['target_object' => $oObject];
$oAttachment->FireEvent(EVENT_SERVICE_ADD_ATTACHMENT_TO_OBJECT, $aData);
$oAttachment->FireEvent(EVENT_ADD_ATTACHMENT_TO_OBJECT, $aData);
}
}
}

View File

@@ -23,7 +23,7 @@ auth_pwd = admin
# Full path or relative to current directory
#
# Formatting rules:
# %Y-%m-%d => 2011-01-25... see PHP documentation of strftime()
# %Y-%m-%d => 2011-01-25... see PHP documentation of strftime() (https://www.php.net/manual/fr/function.strftime.php)
# Placeholders:
# __HOST__ MySQL server
# __DB__ Database name

View File

@@ -69,7 +69,7 @@ function Usage($oP)
$oP->p('auth_user: login, must be administrator');
$oP->p('auth_pwd: ...');
}
$oP->p('backup_file [optional]: name of the file to store the backup into. Follows the PHP strftime format spec. The following placeholders are available: __HOST__, __DB__, __SUBNAME__');
$oP->p('backup_file [optional]: name of the file to store the backup into. Follows the PHP strftime() format spec (https://www.php.net/manual/fr/function.strftime.php). The following placeholders are available: __HOST__, __DB__, __SUBNAME__');
$oP->p('simulate [optional]: set to check the name of the file that would be created');
$oP->p('mysql_bindir [optional]: specify the path for mysqldump');

View File

@@ -108,20 +108,9 @@ function MakeArchiveFileName($iRefTime = null)
$sDefaultBackupFileName = sys_get_temp_dir().'/'."__DB__-%Y-%m-%d";
$sBackupFile = utils::ReadParam('backup_file', $sDefaultBackupFileName, true, 'raw_data');
$oConfig = GetConfig();
$sBackupFile = str_replace('__HOST__', $oConfig->Get('db_host'), $sBackupFile);
$sBackupFile = str_replace('__DB__', $oConfig->Get('db_name'), $sBackupFile);
$sBackupFile = str_replace('__SUBNAME__', $oConfig->Get('db_subname'), $sBackupFile);
if (is_null($iRefTime))
{
$sBackupFile = strftime($sBackupFile);
}
else
{
$sBackupFile = strftime($sBackupFile, $iRefTime);
}
$oBackup = new DBBackup();
$oDateTime = $iRefTime !== null ? new DateTime($iRefTime) : new DateTime();
$sBackupFile = $oBackup->MakeName($sBackupFile, $oDateTime);
return $sBackupFile;
}

View File

@@ -22,39 +22,39 @@
*/
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
'bkp-backup-running' => 'A backup is running. Please wait...~~',
'bkp-restore-running' => 'A restore is running. Please wait...~~',
'bkp-backup-running' => 'A backup fut. Kérem várjon...',
'bkp-restore-running' => 'A visszaállítás fut. Kérem várjon...',
'Menu:BackupStatus' => 'Scheduled Backups~~',
'bkp-status-title' => 'Scheduled Backups~~',
'bkp-status-checks' => 'Settings and checks~~',
'bkp-mysqldump-ok' => 'mysqldump is present: %1$s~~',
'bkp-mysqldump-notfound' => 'mysqldump could not be found: %1$s - Please make sure it is installed and in the path, or edit the configuration file to tune mysql_bindir.~~',
'bkp-mysqldump-issue' => 'mysqldump could not be executed (retcode=%1$d): Please make sure it is installed and in the path, or edit the configuration file to tune mysql_bindir~~',
'bkp-missing-dir' => 'The target directory <code>%1$s</code> could not be found~~',
'bkp-free-disk-space' => '<b>%1$s free</b> in <code>%2$s</code>~~',
'bkp-dir-not-writeable' => '%1$s is not writeable~~',
'bkp-wrong-format-spec' => 'The current specification to format the file names is wrong (%1$s). A default specification will apply: %2$s~~',
'bkp-name-sample' => 'Backup files are named depending on DB identifiers, date and time. Example: %1$s~~',
'bkp-week-days' => 'Backups will occur <b>every %1$s at %2$s</b>~~',
'bkp-retention' => 'At most <b>%1$d backup files will be kept</b> in the target directory.~~',
'bkp-next-to-delete' => 'Will be deleted when the next backup occurs (see the setting "retention_count")~~',
'bkp-table-file' => 'File~~',
'bkp-table-file+' => 'Only files having the extension .zip are considered as being backup files~~',
'bkp-table-size' => 'Size~~',
'Menu:BackupStatus' => 'Ütemezett Backup',
'bkp-status-title' => 'Ütemezett backup-ok',
'bkp-status-checks' => 'Beállítás és ellenőrzés',
'bkp-mysqldump-ok' => 'mysqldump megvan: %1$s',
'bkp-mysqldump-notfound' => 'mysqldump nem található: %1$s - Győződjön meg róla, hogy telepítve van és szerepel az elérési útvonalban, vagy szerkessze a konfigurációs fájlt a mysql_bindir beállításához..',
'bkp-mysqldump-issue' => 'mysqldump nem hajtható végre (retcode=%1$d): Győződjön meg róla, hogy telepítve van és szerepel az elérési útvonalban, vagy szerkessze a konfigurációs fájlt a mysql_bindir beállításához.',
'bkp-missing-dir' => 'A <code>%1$s</code> célkönyvtár nem található',
'bkp-free-disk-space' => '<b>%1$s szabad</b> a <code>%2$s</code> -ből',
'bkp-dir-not-writeable' => '%1$s nem írható',
'bkp-wrong-format-spec' => 'A fájlnevek formázására vonatkozó jelenlegi specifikáció helytelen (%1$s). Alapértelmezett specifikáció lesz érvényben: %2$s',
'bkp-name-sample' => 'A backup fájlok neve a DB azonosítóktól, a dátumtól és az időponttól függ. Példa: %1$s',
'bkp-week-days' => 'Backup lesz végrehajtva <b>minden %1$s %2$s -kor</b>',
'bkp-retention' => 'Legfeljebb <b>%1$d backup fájl lesz megőrizve</b> a célkönyvtárban.',
'bkp-next-to-delete' => 'Törölve lesz a következő backup alkalmával (lásd a "retention_count" beállítást)',
'bkp-table-file' => 'Fájl',
'bkp-table-file+' => 'Csak a .zip kiterjesztésű fájlokat tekintjük biztonsági mentésnek.',
'bkp-table-size' => 'Méret',
'bkp-table-size+' => '~~',
'bkp-table-actions' => 'Actions~~',
'bkp-table-actions' => 'Műveletek',
'bkp-table-actions+' => '~~',
'bkp-status-backups-auto' => 'Scheduled backups~~',
'bkp-status-backups-manual' => 'Manual backups~~',
'bkp-status-backups-none' => 'No backup yet~~',
'bkp-next-backup' => 'The next backup will occur on <b>%1$s</b> (%2$s) at %3$s~~',
'bkp-next-backup-unknown' => 'The next backup is <b>not scheduled</b> yet.~~',
'bkp-button-backup-now' => 'Backup now!~~',
'bkp-button-restore-now' => 'Restore!~~',
'bkp-confirm-backup' => 'Please confirm that you do request the backup to occur right now.~~',
'bkp-confirm-restore' => 'Please confirm that you do want to restore the backup %1$s.~~',
'bkp-wait-backup' => 'Please wait for the backup to complete...~~',
'bkp-wait-restore' => 'Please wait for the restore to complete...~~',
'bkp-success-restore' => 'Restore successfully completed.~~',
'bkp-status-backups-auto' => 'Ütemezett backup',
'bkp-status-backups-manual' => 'Manuális backup',
'bkp-status-backups-none' => 'Még nincs backup',
'bkp-next-backup' => 'A következő backup <b>%1$s</b> (%2$s) fog lefutni at %3$s -kor',
'bkp-next-backup-unknown' => 'A következő backup <b>nincs ütemezve</b> még.',
'bkp-button-backup-now' => 'Backup most!',
'bkp-button-restore-now' => 'Visszaállítás!',
'bkp-confirm-backup' => 'Erősítse meg, hogy a biztonsági mentést most kéri.',
'bkp-confirm-restore' => 'Kérjük, erősítse meg, hogy vissza szeretné állítani a %1$s backup-ot.',
'bkp-wait-backup' => 'Várjon a backup befejezéséig...',
'bkp-wait-restore' => 'Várjon a visszaállítás befejezéséig...',
'bkp-success-restore' => 'A visszaállítás sikerült.',
));

View File

@@ -163,8 +163,7 @@ class BackupExec extends AbstractWeeklyScheduledProcess
//
$oBackup->SetMySQLBinDir(MetaModel::GetConfig()->GetModuleSetting($this->GetModuleName(), 'mysql_bindir', ''));
$sBackupFileFormat = MetaModel::GetConfig()->GetModuleSetting($this->GetModuleName(), 'file_name_format',
'__DB__-%Y-%m-%d_%H_%M');
$sBackupFileFormat = MetaModel::GetConfig()->GetModuleSetting($this->GetModuleName(), 'file_name_format', '__DB__-%Y-%m-%d_%H_%M');
$sName = $oBackup->MakeName($sBackupFileFormat);
if ($sName == '')
{

Some files were not shown because too many files have changed in this diff Show More