Skip to content
Snippets Groups Projects
Unverified Commit c20ed47a authored by Peter Rotich's avatar Peter Rotich Committed by GitHub
Browse files

Merge pull request #4428 from JediKev/issue/faq-canned-attachments-dropping

issue: FAQ & Canned Attachments Dropping
parents 2ba062f3 c456684c
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.
Please register or to comment