@@ -1517,19 +1517,19 @@ protected function showActorSettingsHeader($type) {
15171517 /**
15181518 * Show header for actors edition
15191519 *
1520- * @param integer $type see CommonITILActor constants
1520+ * @param integer $actorType see CommonITILActor constants
15211521 * @param array $actors actors to show
15221522 * @return void
15231523 */
1524- protected function showActorSettingsForType ($ type , array $ actors ) {
1524+ protected function showActorSettingsForType ($ actorType , array $ actors ) {
15251525 $ itemActor = $ this ->getItem_Actor ();
15261526 $ dropdownItems = ['' => Dropdown::EMPTY_VALUE ] + $ itemActor ::getEnumActorType ();
15271527
1528- switch ($ type ) { // Values from CommonITILObject::getSearchOptionsActors()
1528+ switch ($ actorType ) { // Values from CommonITILObject::getSearchOptionsActors()
15291529 case CommonITILActor::REQUESTER :
15301530 $ type = 'requester ' ;
1531- unset($ dropdownItems [' supplier ' ]);
1532- unset($ dropdownItems [' question_supplier ' ]);
1531+ unset($ dropdownItems [PluginFormcreatorTarget_Actor:: ACTOR_TYPE_SUPPLIER ]);
1532+ unset($ dropdownItems [PluginFormcreatorTarget_Actor:: ACTOR_TYPE_QUESTION_SUPPLIER ]);
15331533 $ changeActorJSFunction = 'plugin_formcreator_ChangeActorRequester(this.value) ' ;
15341534 $ actorRole = PluginFormcreatorTarget_Actor::ACTOR_ROLE_REQUESTER ;
15351535 break ;
@@ -1643,6 +1643,28 @@ protected function showActorSettingsForType($type, array $actors) {
16431643 );
16441644 echo '</div> ' ;
16451645
1646+ if ($ actorType == CommonITILActor::ASSIGN ) {
1647+ echo '<div id="block_ ' . $ type . '_supplier" style="display:none"> ' ;
1648+ Supplier::dropdown ([
1649+ 'name ' => 'actor_value_ ' . PluginFormcreatorTarget_Actor::ACTOR_TYPE_SUPPLIER ,
1650+ ]);
1651+ echo '</div> ' ;
1652+
1653+ echo '<div id="block_ ' . $ type . '_question_supplier" style="display:none"> ' ;
1654+ PluginFormcreatorQuestion::dropdownForForm (
1655+ $ this ->getForm ()->getID (),
1656+ [
1657+ 'fieldtype ' => ['glpiselect ' ],
1658+ 'values ' => Supplier::class,
1659+ ],
1660+ 'actor_value_ ' . PluginFormcreatorTarget_Actor::ACTOR_TYPE_QUESTION_SUPPLIER ,
1661+ [
1662+ 'value ' => 0
1663+ ]
1664+ );
1665+ echo '</div> ' ;
1666+ }
1667+
16461668 echo '<div> ' ;
16471669 echo __ ('Email followup ' );
16481670 Dropdown::showYesNo ('use_notification ' , 1 );
@@ -1713,6 +1735,17 @@ protected function showActorSettingsForType($type, array $actors) {
17131735 echo $ img_user . ' <b> ' . __ ('Actors from the question ' , 'formcreator ' )
17141736 . '</b> " ' . $ question ->getName () . '" ' ;
17151737 break ;
1738+ case PluginFormcreatorTarget_Actor::ACTOR_TYPE_SUPPLIER :
1739+ $ supplier = new Supplier ();
1740+ $ supplier ->getFromDB ($ values ['actor_value ' ]);
1741+ echo $ img_supplier . ' <b> ' . __ ('Supplier ' ) . ' </b> " ' . $ supplier ->getName () . '" ' ;
1742+ break ;
1743+ case PluginFormcreatorTarget_Actor::ACTOR_TYPE_QUESTION_SUPPLIER :
1744+ $ question = new PluginFormcreatorQuestion ();
1745+ $ question ->getFromDB ($ values ['actor_value ' ]);
1746+ echo $ img_supplier . ' <b> ' . __ ('Supplier from the question ' , 'formcreator ' )
1747+ . '</b> " ' . $ question ->getName () . '" ' ;
1748+ break ;
17161749 }
17171750 echo $ values ['use_notification ' ] ? ' ' . $ img_mail . ' ' : ' ' . $ img_nomail . ' ' ;
17181751 echo self ::getDeleteImage ($ id );
0 commit comments