Joomla 3.9.1 publish/unpublish no longer working (custom components) - joomla3.0

I've recently upgraded my joomla site to 3.9.1, and now my custom components publish/unpublish buttons aren't working and I can't figure out why. The database column is called "state" and this is the code which was working up until the upgrade:
JToolbarHelper::publish('items.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish('items.unpublish', 'JTOOLBAR_UNPUBLISH', true);
These buttons used to work and they would publish / unpublish the items, now I get this message:
0 items successfully published
I'm not sure where exactly the code is which tells it to update the status of the item, but for some reason it's not working anymore.

Try to add following line to the __construct function within "table" file:
$this->setColumnAlias('published', 'state');
so it looks like
public function __construct(&$db)
{
parent::__construct('#__your_custom_table', 'id', $db);
$this->setColumnAlias('published', 'state');
}
Works for my custom component.

Related

Where to put Event listener to detect afterSave of plugin table (CakePHP)

I'm on CakePHP 3.3.16
I've put this in the main app's Bootstrap.php:
Log::write('info','foo');
$contactTable = \Cake\ORM\TableRegistry::get('Contacts.contacts');
$contactTable->eventManager()
->on('Model.afterSave', ['priority' => 1],function($event, $entity)
{
pr( "afterSave - " );
Log::write('info','afterSave');
});
I do get "foo" in the lofs, and yet when I save the plugin model in question, there's nothing in the logs. I've tried with and without priority.
Do I need to update CakePHP? I think a method has been depracated? The CakePHP event docs said to place this code in Bootstrap.php, so I'm confused...

Custom changes in Sonata Admin PreUpdate prevent persiting of object

I am using Doctrine 2.4.8 in my Symfony 2.8.34 project.
My Problem is that custom changes I made in the preUpdate function preventing the expected changes from the admin form. Dependent on a choice field a new event should been created or deleted.
class CustomAdmin extends AbstractAdmin {
public function preUpdate($object) {
...
if ($object->isDetached()) {
$event = new Event();
...
$object->setDetachedEvent($event);
} else {
$object->setDetachedEvent(null);
}
}
}
Now, the line $object->setDetachedEvent(null); turns everything crazy. The first time I'm saving the form my custom changes in that preUpdate function are executed, but the changes in the fields of the admin form are ignored. The second time the changes from the admin form were executed. If I remove the line above, everythings works fine.
So, anybody has an idea how to handle this problem?

ReactJS DropDown and PhantonJS Headless not playing nice together

Good day all,
I'm currently trying to run cucumber tests on a reactjs component, dropdown search selection, running in headless mode, using PhantonJS, but it is causing a weird situation that preventing me from completely these tests.
Using the following reactJs dropdown, http://jedwatson.github.io/react-select/, it is the "'Github users (Async with fetch.js)'"
The current issue that is according is when the scenarios gets to it fourth example test it fails but the same code is used to pass the first three tests.
I thought it was the fourth example so I changed it around with other values and it still fails on the fourth step.
This is the code used to enter the value into the drop down search
find(".Select").trigger("click")
fix_overlap = %{ $('.Select-placeholder').css('z-index', -99999) }
page.execute_script(fix_overlap)
find(".Select .Select-input input").native.send_keys(with)
find(".Select-menu-outer", text: with, visible: :all, match: :first).click
The react control is doing async call to search for the input data from an API endpoint.
I able to run the test in a browser with no issues.
The error that is being returned from the test is that I can't found the value in the drop down.
I have added the options to the environment setup when I'm registering poltergeist,
options = {:js_errors => false, phantomjs_options: ['--debug=true'], debug: false }
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, options)
end
to see if there is an internal error that is not shown in the debug console.
I have done a page.save_screenshot to see the state just before the error and the drop down has the correct value.
Questions
Is there any other options that can be added to show more information/errors?
Has anyone experienced this issue before?
I'm open to any suggestions to fix this weird behaviour.
Extra details
gem 'poltergeist','= 1.9.0'
gem 'cucumber', '~> 2.0'
For the "Cities (Large Dataset)" example on the linked page, the following code selects the "New York" entry for me, without resorting to using trigger, execute_script or native
with = "New York"
section = find('.section', text: 'Cities (Large Dataset)')
section.find('.Select').click
section.find('.Select-placeholder').send_keys(with)
section.find('.VirtualizedSelectOption', exact_text: with).click
That is using the latest Poltergeist and Capybara. Without the latest Capybara you'd probably need to pass a regex as a :text option in the last line rather than the :exact_text option (otherwise you will get multiple respones)
For the "Contributors (Async)" example
with = 'Craig Dallimore'
section = sess.find('.section', text: 'Contributors (Async)')
section.find('.Select').click
section.find('.Select-input input').send_keys(with.gsub(' ', '')
section.find('.Select-option', exact_text: with).click
will select someone

Set a store with a function in app.js doesn't work in production build?

I'm trying to create a search form view based on the following example of Sencha :
http://try.sencha.com/touch/2.0.0/examples/list-search/viewer.html
I made a few changes just not to create the view by code but export it in a view.
To set up the store, i use this in the config :
store: Preconisations.app.getStoreAdherents(),
where Preconisations is my project name and getStoreAdherents the function set in the app.js:
getStoreAdherents: function () {
if (!this.storeAdherents) {
var gestionAdherent = new DAL_Adherent(); // custom classes
var tc = gestionAdherent.GetAll(); // and functions which returns a json string with data
this.storeAdherents = Ext.create('Ext.data.Store', {
model: "Preconisations.model.ADHERENT",
data: tc,
sorters: 'nom',
groupField: 'code'
});
}
return this.storeAdherents;
}
Now, everything works fine but when i make the testing or the production build, i've got this error :
Uncaught TypeError: Cannot call method 'getStoreAdherents' of undefined
at the store definition...
Maybe, there's a better way to set up the store by code but i can't understand why it's working in developpement and not with the production or testing build...
Is anyone had this problem ? Or how do you set up dynamically a store with a function ?
Thanks... I'm banging my head on the wall on this one...
It is clear that you have a build dependency issue in Ext Build. In the code snippet posted, there is a chance that you missed to add "Preconisations.model.ADHERENT" to a class path. If so, please add the following to your app.js
requires: ["Preconisations.model.ADHERENT"]
If the issue persist, Please do the following diagnostics :
Run your app (development mode) in Google Chrome with the Console open; Look for warnings that states a particular class is being synchronously loaded and add requires statement for those classes.
In fact i think there's a bug in setting a store dynamically in the config.
I found this workaround which work in developpement and in build production :
I don't specify a store : xxxx in the view.
Instead, in a controller i put this code in the launch function :
this.getMainView().setStore(this.getStoreAdherents());
where getMainView is a reference to my view.
That's all !

NDB Query not returning most recently added object

I have a GAE website. The home page displays a list of project objects and a form for adding more projects. When the submit button is pressed, an ajax request is made which runs the 'create_userstoryproject()' method. This method adds the new project and returns a list of all projects, including the one that was just added. For some reason, the query in the 'create_userstoryproject()' method does not return the project just added. However, if I refresh the page, causing the 'get()' method to run, the newly added project shows up just fine. I haven't simplified this code--it's cut and pasted. Anyone have any idea why the newly created project doesn't show up until I refresh the page?
class Home(BaseApp): #BaseApp is derived from webapp2.RequestHandler
def get(self):
self.context['userstoryprojects'] = UserStoryProject.query().order(UserStoryProject.Order)
self.context['userstorystatuses'] = UserStoryStatus.query().order(UserStoryStatus.Order)
self.render('/userstories')
def create_userstoryproject(self):
description = self.request.get('userstoryproject[description]', default_value=None)
if description:
userstoryproject = UserStoryProject()
userstoryproject.Description = description
userstoryproject.put()
self.context['userstoryprojects'] = UserStoryProject.query().order(UserStoryProject.Order)
self.render('/userstoryprojects')
else:
self.write("fail.")
This is because of eventual consistency.

Resources