Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fix on media module #7

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/Controller/Front/ModalController.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,14 @@ public function mediaformAction()
$form->setData($post);
if ($form->isValid()) {

// ToDo : its Temporary fix, database field must be update
if (!isset($post['geoloc_latitude']) || empty($post['geoloc_latitude'])) {
$post['geoloc_latitude'] = null;
}
if (!isset($post['geoloc_longitude']) || empty($post['geoloc_longitude'])) {
$post['geoloc_longitude'] = null;
}

$formIsValid = true;
// upload image
$file = $this->request->getFiles();
Expand All @@ -386,6 +394,7 @@ public function mediaformAction()
$title = str_replace(array('-','_','.'), ' ', $title);

// Set params
$params = [];
$params['filename'] = $file['file']['name'];
$params['title'] = $title;
$params['type'] = 'image';
Expand Down Expand Up @@ -455,7 +464,6 @@ public function mediaformAction()
if ($uid = Pi::user()->getId()) {
$media->updated_by = $uid;
}

$media->save();

return array(
Expand Down
3 changes: 2 additions & 1 deletion src/Model/Doc/RowGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ public function removePageCacheForTargets()
/**
* Try flushing extra object as event is an extended story object
*/
if($module == 'news'){
// ToDo : $module should be `news` or `event` ?
if($module == 'news' && Pi::service('module')->isActive('event')){
voltan marked this conversation as resolved.
Show resolved Hide resolved
$entity = Pi::model('extra', 'event')->find($object_id);
if($entity && isset($entity->id)){
$entity->save();
Expand Down