hook action order grid not work in prestashop 1.7 - hook

On my custom module i followed this documentation steps for add columns on customer grid, it works, so i tried to replicate for the order grid but nothing happens.
Prestashop version: 1.7.6.7
public function install()
{
return parent::install() &&
...
$this->registerHook('actionOrderGridDefinitionModifier') && \\ this not works
$this->registerHook('actionCustomerGridDefinitionModifier') && \\ this works
...
}
public function hookActionCustomerGridDefinitionModifier(array $params)
{
...
}
public function hookActionOrderGridDefinitionModifier(array $params)
{
...
}

The order page (back office) isn't migrated yet to the new framework (Symfony) in the 1.7.6.x, it has been migrated in the 1.7.7, so it's normal that that hooks doesn't works :)
For all the others page, already migrated to Symfony the hooks will work.
Here you'll find the 1.7.7 kanban projects to follow the progress: https://github.com/PrestaShop/PrestaShop/projects/7

Related

Pluralsight Advanced - Movie Content not displayed in Content table

I am walking through Pluralsight Advanced Orchard course.
I just created the Movie module and created a sample movie.
It was working fine but I did notice that the sample movie did not show up in Manage Content page.
I can only get to the list by going to Content Definition and select "List Items"
Then I can see the list of Movie item
This is what I got so far. I followed the steps and don't see what I have missed. I did notice that Orchard has changed slightly from 1.4 to 1.10 appearance wise. I wonder if this also has something to do with the version difference.
Any tips would be appreciated! Thank you
namespace Pluralsight.Movies {
public class Migrations : DataMigrationImpl {
public int Create() {
ContentDefinitionManager.AlterTypeDefinition("Movie", builder=>
builder.WithPart("CommonPart")
.WithPart("TitlePart")
.WithPart("AutoroutePart")
.WithPart("BodyPart")
.Creatable()
.Draftable());
return 1;
}
public int UpdateFrom1()
{
ContentDefinitionManager.AlterTypeDefinition("Movie", builder =>
builder.WithPart("BodyPart", partBuilder=>partBuilder.WithSetting("BodyTypePartSettings.Flavor", "text")));
return 2;
}
}
Try to add .Listable() into your type definition. Note that if you already ran those migrations, unless you reset the database, it won't execute again, so you'll have to put it into a UpdateFrom2() method.
Note that this setting can also be checked from the content definition screen after the fact.
Note: I think the PluralSight course was written at a time when this setting didn't exist, and everything was listable.

How to use JHipster translation i18 for custom component

Using JHipster 4.4.1 i want to use the translation feature (jhiTranslate="") for a custom component. In the component foo ts file:
constructor(
private jhiLanguageService: JhiLanguageService
) {
this.jhiLanguageService.setLocations(['foo']);
}
In the html file:
<h3 jhiTranslate="foo.title">title</h3>
And in webapp\i18n\en\foo.json
{
"foo": {
"title":"hello"
}
}
Resulting in:
translation-not-found[foo.title]
How is it done right?
To make language changes work you will need to reload the webpack process.
It sometimes works without reloading, but not with version 4.4.

Block Check-In on Policy Failure

I've created the check-in policy from this MSDN article as an example (code is just copy / pasted).
This works fine, it appears when I try and do a check-in, however it appears as an warning. So I can ignore it by just pressing Check In again. How can I change the code, as listed in the URL, so that it will return an Error not a warning. I can't see any properties on PolicyFailure to do this.
Essentially I want it to look like the error in this screenshot:
Image Source
EDIT: Here is the exact code that I'm using. Now it is slightly modified from the original source, but not in any massive way I wouldn't have thought. Unfortunately I can't post screenshots, but I'll try and describe everything I've done.
So I have a DLL from the code below, I've added it into a folder at C:\TFS\CheckInComments.dll. I added a registry key under Checkin Policies with the path to the DLL, the string value name is the same as my DLL (minus .dll). In my project settings under source control I've added this Check-In Policy.
It all seems to work fine, if I try and do a check-in it will display a warning saying "Please provide some comments about your check-in" which is what I expect, what I'd like is for it to stop the check-in if any policies are not met, however I would still like the user to be able to select Override if necessary. At the moment, even though there is a warning, if I was to click the Check In button then it would successfully check-in the code.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.TeamFoundation.VersionControl.Client;
namespace CheckInComments
{
[Serializable]
public class CheckInComments : PolicyBase
{
public override string Description
{
get
{
return "Remind users to add meaningful comments to their checkins";
}
}
public override string InstallationInstructions
{
get { return "To install this policy, read InstallInstructions.txt"; }
}
public override string Type
{
get { return "Check for Comments Policy"; }
}
public override string TypeDescription
{
get
{
return "This policy will prompt the user to decide whether or not they should be allowed to check in";
}
}
public override bool Edit(IPolicyEditArgs args)
{
return true;
}
public override PolicyFailure[] Evaluate()
{
string proposedComment = PendingCheckin.PendingChanges.Comment;
if (String.IsNullOrEmpty(proposedComment))
{
PolicyFailure failure = new PolicyFailure("Please provide some comments about your check-in", this);
failure.Activate();
return new PolicyFailure[1]
{
failure
};
}
else
{
return new PolicyFailure[0];
}
}
public override void Activate(PolicyFailure failure)
{
MessageBox.Show("Please provide comments for your check-in.", "How to fix your policy failure");
}
public override void DisplayHelp(PolicyFailure failure)
{
MessageBox.Show("This policy helps you to remember to add comments to your check-ins", "Prompt Policy Help");
}
}
}
A check-in policy will always return a warning and if your user has permission to ignore them, then they can.
Users can always override the policy. You can query the TFS warehouse to generate a report of users violating the policies and their reasons for the violation if they provided any. Or setup an alert whenever someone ignores these polite warnings.
There is no way to enforce this from the policy itself. Only from a server side plugin, as described by Neno in the post you quoted. Such a server side plugin can be created for 2012 or 2010 as well. The process is explained here.
I just got past that issue by turning on Code Analysis on my project - right click on your project, click properties, go to Code Analysis, select the Configuration drop down and pick "All Configurations", select the "Enable Code Analysis on Build".
Do a build and make sure you have no errors / warnings.
This will get you past any policies requiring code analysis on build.

cakephp facebook component include paths on linux

I have a website on cakephp 1.3, with facebook integration. On my localhost(with windows os) it works fine, but on real hosting(with linux os) it gives this error Fatal error: Class 'Facebook' not found in /home/username/public_html/app/plugins/facebook/libs/f_b.php on line 22.
This is f_b.php
App::import('Vendor', 'Facebook.facebook/src/facebook');
App::import('Lib', 'Facebook.FacebookInfo');
class FB {
/**
* Facebook Api
*/
public static $Facebook = null;
public function __construct() {
if (empty(self::$Facebook)) {
self::$Facebook = new Facebook(FacebookInfo::getConfig()); } // 22 line
}
so, apparently it can not load Vender, I think there is a problem with paths, though this does not work either App::import('Vendor', 'Facebook.facebook'.DS.'src'.DS.'facebook');
f_b.php located in plugins/facebook/libs/ folder and this Facebook.php vendor is located in plugins/facebook/vendors/facebook/src folder
Thanks
Finally I found the solution of my problem, in order to work both on windows and linux it is necessary write like this
App::import('Vendor', 'Facebook.Facebook', array('file' => 'facebook/src/Facebook.php' ));
Here, are couple of example for that - Vendor examples
I’d say your paths don’t look right (why is there a dot?).
When I’ve used plugins with CakePHP, I’ve had to enable them by un-commenting the Plugins::loadAll() line in app/config/bootstrap.php. This will then make my library available in my CakePHP application.

ReSharper doesn't see my Machine.Specification tests

I'm having a problem getting ReSharper to see the Machine.Specification "tests" I've written.
The specs run in the ConsoleRunner from mSpec. When I try to "Run Unit Tests" in ReSharper, I get a message: "No tests found in file." The specs don't show the test markers.
I created a folder in the ReSharper /bin/ folder and put the proper .dlls there. The mSpec plug in appears in ReSharper.
What might I be missing?
Also, I'm using xUnit.NET if that makes a difference.
The ReSharper runner do not take nested context classes into account. Instead of nesting context classes:
namespace SomeNamespace
{
public class Specs
{
public class when_something_happens
{
Because of = () => {};
It should_do_something = () => {};
}
}
}
Author contexts that are not nested, i.e. root classes inside a namespace:
namespace SomeNamespace
{
public class when_something_happens
{
Because of = () => {};
It should_do_something = () => {};
}
}
ReSharper's green-and-yellow test icons do appear if all of the conditions are met:
class is public
class is not abstract
class is not nested
has >= 1 specification field (It),
or has >= 1 behavior field
(Behaves_like<>)
In order to have good integration of MSpec with Visual Studio and ReSharper install MSpec using installer which is available here: http://marcinobel.com/index.php/mspec-bdd-installer/
Had also the same problem with "No tests found in file" when try to use ReSharper and XUnit.net together. However I could see my tests in Test Explorer window and was able to run them from there.

Resources