How can I deactivate Asset Versioning in Magnolia 5.7 - assets

We have a massive problem regarding assets (images) in our magnolia 5.7 system.
I can describe it like this:
On our author server we create a completely new asset.
When we publish that asset and look at it on our public server we see that it has the mixinTypes "mgnl:hasVersion" and the link to the image (That is inserted and worked on our author server) is not working anymore.
Do you know what could be the cause of this and how can I deactivate that automatic versioning of images?
UPDATE:
We have managed to fix the broken links problem with using the recovery-flag from here: https://docs.magnolia-cms.com/product-docs/Administration/Troubleshooting/Broken-version-history.html
Still we have versioning on our public server. Here is the diff between the two xml-exports of the asset-nodes:
< <sv:value>mix:versionable</sv:value>
13,24d11
< <sv:property sv:name="jcr:baseVersion" sv:type="Reference">
< <sv:value>55f158e2-16c7-44ce-a973-cd48a5cad53b</sv:value>
< </sv:property>
< <sv:property sv:name="jcr:isCheckedOut" sv:type="Boolean">
< <sv:value>true</sv:value>
< </sv:property>
< <sv:property sv:name="jcr:predecessors" sv:type="Reference" sv:multiple="true">
< <sv:value>55f158e2-16c7-44ce-a973-cd48a5cad53b</sv:value>
< </sv:property>
< <sv:property sv:name="jcr:versionHistory" sv:type="Reference">
< <sv:value>e1dfbbf9-e9be-468d-a20c-11c2cb978aa4</sv:value>
< </sv:property>
31,33d17
< <sv:property sv:name="mgnl:comment" sv:type="String">
< <sv:value/>
< </sv:property>
41c25
< <sv:value>2021-03-03T10:42:37.277+01:00</sv:value>
---
> <sv:value>2021-03-03T10:47:35.533+01:00</sv:value>
45a30,35
> <sv:property sv:name="mgnl:lastActivatedVersion" sv:type="String">
> <sv:value>jcr:frozenNode</sv:value>
> </sv:property>
> <sv:property sv:name="mgnl:lastActivatedVersionCreated" sv:type="Date">
> <sv:value>2021-03-03T10:47:35.139+01:00</sv:value>
> </sv:property>
93c83
< <sv:value>2021-03-03T10:42:37.278+01:00</sv:value>
---
> <sv:value>2021-03-03T10:47:35.539+01:00</sv:value>

You can find it under the node type definition, must be named such as this: magnolia-dam-nodetypes.xml
If you remove <supertype>mgnl:versionable</supertype> from the definition, it should not version the nodes anymore.

Could you try with decorations to override and remove catalog: versioned from publish action.
Original actions:
https://git.magnolia-cms.com/projects/MODULES/repos/dam/browse/magnolia-dam-app-jcr/src/main/resources/dam-app-jcr/decorations/dam-assets-app/apps/dam.subApps.yaml
/your module name/decorations/dam-assets-app/apps/dam.subApps.yaml
jcrBrowser:
actions:
publish: !override
icon: icon-publish
class: info.magnolia.ui.contentapp.action.JcrCommandActionDefinition
command: publish
availability: *notDeletedWritableAvailability

Related

Catalog product page gives error 500 after upgrade from 1.7.3 to 1.7.6

I can't access the product catalog page or edit any products after upgrading from 1.7.3.1 to 1.7.6.1
It gives me two fatal php errors.
The first exception: Twig\Error\RuntimeError
in src/PrestaShopBundle/Resources/views/Admin/layout.html.twig (line 34)
layoutHeaderToolbarBtn is defined ? layoutHeaderToolbarBtn : [],
layoutDisplayType is defined ? layoutDisplayType : '',
showContentHeader is defined ? showContentHeader : true,
headerTabContent is defined ? headerTabContent : '',
enableSidebar is defined ? enableSidebar : false,
Line 34 help_link is defined ? help_link : ''
)
)) %}
{% import '#PrestaShop/Admin/macros.html.twig' as ps %}
The second exception: Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
in vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php (line 348)
if ($lev <= \strlen($id) / 3 || false !== strpos($knownId, $id)) {
$alternatives[] = $knownId;
}
}
throw new ServiceNotFoundException($id, null, null, $alternatives);
}[enter image description here][1]
}
/**
* Returns true if the given service has actually been initialized.
Cross posted here https://www.prestashop.com/forums/topic/1003821-catalog-product-page-gives-error-500-after-upgrade-from-173-to-176/
Error screenshot
Turns out, that the related products module was not updated. It's a module bought on the Marketplace. I checked the compatibility and it said it was compatible with 1.7.6.1, so for that reason, combined with my backoffice telling me i had 0 available updates and that the module was up to date, i assumed it was all good.
But apparently, modules bought on the marketplace, don't have their updates show up in prestashop. 
I fixed the issue, by uninstalling the related products module and downloading the newest one 1.6.4 instead of 1.6.3 from the prestashop marketplace.

Odoo 10 XMLRPC How to map one2many and many2one

I have recently been doing some development in python 2.7 with Odoo 10 API using XMLRPC.
My questions are:
How do I write a one2many field to a field in odoo via xmlrpc
How do u write a many2one field to a field in odoo via xmlrpc
Many thanks your help is much appreciated!
Samuel
For Many2one fields you can simply use the ID of the record:
my_partner_id = 1 # or use a search to find the correct one
id = models.execute_kw(db, uid, password, 'sale.order', 'create', [{
'partner_id': my_partner_id,
}])
Many2many or One2many fields are a bit special. There are some magic triplets in Odoo, you have to use with such fields -> Model Reference/CRUD/write(vals).
For example if you want to add a tag to a customer (Many2many field):
my_tag_id = 42 # or use a search to find the correct one
id = models.execute_kw(db, uid, password, 'res.partner', 'write',
[my_partner_id], [{
'category_id': [(4, my_tag_id)],
}])
Or if you want to delete all tags:
my_tag_id = 42 # or use a search to find the correct one
id = models.execute_kw(db, uid, password, 'res.partner', 'write',
[my_partner_id], [{
'category_id': [(5,)],
}])
Or if you want to substitute all tags by some others:
my_tag_id1 = 42 # or use a search to find the correct one
my_tag_id2 = 7 # or use a search to find the correct one
id = models.execute_kw(db, uid, password, 'res.partner', 'write',
[my_partner_id], [{
'category_id': [(6, None, [my_tag_id1, my_tag_id2])],
}])
Create Activity (One2many field) in CRM form using Php API In #v11 Odoo Community:
$opportunity_id = 13; (Lead in which you create activity)
$user_id = 1; (User, for whom you assign task)
$c = $_POST["loading_time"]; (Deadline date which you have to set from php)
$enddate = date("Y-m-d H-i-s", strtotime($c));
$model = 'crm.lead';
$res_model_id = $models -> execute_kw($db, $uid, $password,
'ir.model', 'search', array(array(array('model', '=', 'crm.lead'))));
print_r($res_model_id);
$activity_type_id = $models -> execute_kw($db, $uid, $password,
'mail.activity.type', 'search', array(array(array('name', '=', 'Todo')))); (this is activity type like Todo,Call,Email,etc....)
print_r($activity_type_id);
$product_attribute_line = $models -> execute($db, $uid, $password,
'mail.activity', 'create',
array('model'= > $model,
'res_id'= > $opportunity_id,
'note'= > $_POST["question"],
'user_id'= > $user_id,
'date_deadline'=> $_POST["loading_time"],
'res_model_id'= > $res_model_id[0],
'summary'= > $_POST["subject"],
'activity_type_id'= > $activity_type_id[0],
'activity_ids'= > array(array(6, 0, array($opportunity_id))) ));
(activity_ids is a one2many field which will create activity)
Important:
To Create One2many field You must have to pass related many2one Id
You can see in image also by refer following image:
enter image description here

Get all entries if no entries in linked table with condition (Doctrine2, Symfony2)

There are 2 tables: Providers and Adverts. A Provider has Adverts.
First table "Provider":
ID
...
Second table "Advert":
ID
Begin (DateTime)
End (DateTime)
...
Relation:
/**
* #ORM\OneToMany(targetEntity="Advert", mappedBy="provider", cascade={"persist"})
*/
private $adverts;
I want:
All Providers who DON'T have any adverts which are currently active (= currently between "Begin" and "End") AND DON'T have any adverts which are planned for the future (= "Begin" and "End" are in the future).
In other words:
I want ALL Providers who DON'T have any current or upcoming adverts.
My issue:
I don't know and find any information how to do it.
I use Doctrine2 with Symfony 2.8 / 3.0.
Please note that some MySQL specific funtions are not supported by default in Doctrine. You can have an extension installed for that. I am going to propose a way without extensions. (But you should opt out for a Bundle on your own judgement)
In your Provider repository you can do something like this:
public function getProvidersWithoutAdverts()
{
$now = date("Y-m-d H:i:s");
$qb = $this->createQueryBuilder('provider');
$qb->leftJoin('provider.adverts', 'advert', Join::WITH)
->where("advert.end < {$now}") //Advert has ended
->andWhere("advert.begin < {$now}") //Advert is not scheduled
;
return $qb->getQuery()->getResult();
}
This code works fine but maybe it is not fully optimized.
Warning: You should create a repository for the Provider entity. The following code is working if you have $em as Doctrine EntityManager.
$qb = $em->createQueryBuilder();
$qb = $qb->select('IDENTITY(advert.provider)')
->from('AppBundle:Advert', 'advert')
->where("advert.begin <= :now AND advert.end > :now")
->andWhere('advert.active = true')
->setParameter(':now', new \DateTime(), Type::DATETIME)
$nots = $qb->getQuery()->getArrayResult();
$qb = $em->createQueryBuilder();
$qb = $qb->select('p')
->from('AppBundle:Provider', 'provider')
->leftJoin('provider.adverts', 'advert');
if (isset($nots[0])) {
$qb->where($qb->expr()->notIn('provider.id', $nots[0]));
}
$providers = $qb->getQuery()->getArrayResult();
Maybe "not exists" would be better: NOT IN vs NOT EXISTS

module overriding in zen cart

I am new to Zen Cart and currently working on a project which has custom template. I am now stuck on override of module file new_products.php !! how to override new_products.php ? I want to change HTML in it. how can I do it ? I have made changes in new_products.php itself. I know it is not right way to do it, but I am confused where do I make changes/override module file ?
Here is the code where I made changes in main new_products.php file
while (!$new_products->EOF) {
$products_price = zen_get_products_display_price($new_products->fields['products_id']);
if (!isset($productsInCategory[$new_products->fields['products_id']])) $productsInCategory[$new_products->fields['products_id']] = zen_get_generated_category_path_rev($new_products->fields['master_categories_id']);
$list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<center><h2>'.$new_products->fields['products_name'].'</h2>' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</center>') . '<h3>' . $products_price.'</h3><p>'.$new_products->fields['products_description'].'</p>
<div class="button black"><a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">Add To Cart' .'</div>');
$col ++;
if ($col > (SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS - 1)) {
$col = 0;
$row ++;
}
$new_products->MoveNextRandom();}
It's perfectly fine to modify new_products.php, but first copy
includes/modules/new_products.php
to
includes/modules/YOUR_TEMPLATE/new_products.php
(where YOUR_TEMPLATE is the name of your custom template).
Then make changes in the file
includes/modules/YOUR_TEMPLATE/new_products.php
You can determine your template name by going to admin->tools->template selection.
If you don't know how to create a custom template in Zen Cart, read this:
http://www.zen-cart.com/content.php?180

how to change the default message displayed by tooltip when error occurs in dojo

whenever i submit the form without entering anything into the text field by default i get a mesaage "please fill out this field".
how do i change the message to first name is required
< html >
< head >< /head >
< body >
< form action="a.html" >
< label for="firstName">First Name: < /label >
< input type="text" id="firstName" name="firstName"
dojoType="dijit.form.ValidationTextBox"
required="true"
propercase="true"
promptMessage="Enter first name."
invalidMessage="First name is required."
trim="true"
/>< br>
< input type="submit" value="submit"/>
< /form>
< /body >
< /html>
It sounds like you want to set "missingMessage", too:
http://livedocs.dojotoolkit.org/dijit/form/ValidationTextBox