Skip to content
Snippets Groups Projects
Commit c456684c authored by JediKev's avatar JediKev
Browse files

issue: FAQ & Canned Attachments Dropping

This addresses an issue where FAQ & Canned Response attachments are dropping
when another agent edits the FAQ or Canned Response.
parent e5024184
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,13 @@ $canned_form = new SimpleForm(array(
)),
));
// Set fields' attachments so exsting files stay put
if ($canned
&& $canned->attachments
&& ($attachments = $canned_form->getField('attachments'))) {
$attachments->setAttachments($canned->attachments);
}
if ($_POST) {
switch(strtolower($_POST['do'])) {
case 'update':
......
......@@ -48,6 +48,21 @@ if ($langs = $cfg->getSecondaryLanguages()) {
$faq_form = new SimpleForm($form_fields, $_POST);
// Set fields' attachments so exsting files stay put
if ($faq
&& $faq->getAttachments()->window(array('inline' => false))
&& ($common_attachments = $faq_form->getField('attachments'))) {
// Common attachments
$common_attachments->setAttachments($faq->getAttachments()->window(array('inline' => false)));
}
if ($langs && $faq) {
// Multi-lingual system
foreach ($langs as $lang) {
$attachments = $faq_form->getField('attachments.'.$lang);
$attachments->setAttachments($faq->getAttachments($lang)->window(array('inline' => false)));
}
}
if ($_POST) {
$errors=array();
// General attachments
......@@ -126,21 +141,6 @@ if ($_POST) {
}
}
else {
// Not a POST — load database-backed attachments to attachment fields
if ($langs && $faq) {
// Multi-lingual system
foreach ($langs as $lang) {
$attachments = $faq_form->getField('attachments.'.$lang);
$attachments->setAttachments($faq->getAttachments($lang)->window(array('inline' => false)));
}
}
if ($faq) {
// Common attachments
$attachments = $faq_form->getField('attachments');
$attachments->setAttachments($faq->getAttachments()->window(array('inline' => false)));
}
}
$inc='faq-categories.inc.php'; //FAQs landing page.
if($faq) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment