Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/support/2.13.0' into support/2.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Aug 1, 2023
2 parents 742d7a0 + 5f2604a commit 703d353
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions inc/field/dropdownfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
use Document;
use Dropdown;
use CommonGLPI;
use CommonDBTM;
use CommonITILActor;
use CommonITILObject;
use CommonTreeDropdown;
Expand Down
4 changes: 2 additions & 2 deletions inc/targetchange.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -664,11 +664,11 @@ public function save(PluginFormcreatorFormAnswer $formanswer): ?CommonDBTM {
$data[$changeField] = $this->prepareTemplate(
Sanitizer::unsanitize(__($this->fields[$changeField], $domain)) ?? '',
$formanswer,
$changeField == 'content' // only content supports rich text
true // all *content supports rich text
);
$data[$changeField] = $data[$changeField] ?? '';

$data[$changeField] = $formanswer->parseTags($data[$changeField], $this, $changeField == 'content');
$data[$changeField] = $formanswer->parseTags($data[$changeField], $this, true); // all *content supports rich text
}

$data['_users_id_recipient'] = $formanswer->fields['requester_id'];
Expand Down
18 changes: 18 additions & 0 deletions inc/targetticket.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,8 @@ protected function getTargetTemplate(array $data): int {
* @return Ticket|null Generated ticket if success, null otherwise
*/
public function save(PluginFormcreatorFormAnswer $formanswer): ?CommonDBTM {
global $CFG_GLPI;

$ticket = new Ticket();
$form = $formanswer->getForm();
$data = $this->getDefaultData($formanswer);
Expand Down Expand Up @@ -889,6 +891,22 @@ public function save(PluginFormcreatorFormAnswer $formanswer): ?CommonDBTM {
return null;
}

// Set default document category
$document_category = $CFG_GLPI['documentcategories_id_forticket'] ?? 0;
if ($document_category) {
foreach (array_keys($this->attachedDocuments) as $documents_id) {
$document = Document::getById($documents_id);
if (!$document) {
continue;
}

$document->update([
'id' => $document->fields['id'],
'documentcategories_id' => $document_category,
]);
}
}

$this->saveTags($formanswer, $ticketID);

// Add link between Ticket and FormAnswer
Expand Down
2 changes: 1 addition & 1 deletion js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ function buildTiles(list) {
// Build a HTML tile
var url = formcreatorRootDoc + '/front/formdisplay.php?id=' + item.id;
if (item.type != 'form') {
url = rootDoc + '/front/knowbaseitem.form.php?id=' + item.id;
url = rootDoc + '/front/helpdesk.faq.php?id=' + item.id;
}

var tiles_design = "";
Expand Down
2 changes: 1 addition & 1 deletion setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ function plugin_formcreator_redirect() {

$pages = [
'front/reservationitem.php' => FORMCREATOR_ROOTDOC . '/front/reservationitem.php',
'front/helpdesk.faq.php' => FORMCREATOR_ROOTDOC . '/front/wizard.php',
// 'front/helpdesk.faq.php' => FORMCREATOR_ROOTDOC . '/front/wizard.php',
'front/ticket.php' => FORMCREATOR_ROOTDOC . '/front/issue.php',
];
foreach ($pages as $srcPage => $dstPage) {
Expand Down

0 comments on commit 703d353

Please sign in to comment.