-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#128: The static list of property "statutProjetDemat" in class Demarc…
…hes does not match the actual data values (cherry picked from commit 9f94ef3)
- Loading branch information
Showing
2 changed files
with
87 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
wikis/wikidemat/src/main/resources/Demarches/Code/Scripts.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?xml version="1.1" encoding="UTF-8"?> | ||
|
||
<!-- | ||
* See the NOTICE file distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
--> | ||
|
||
<xwikidoc version="1.3" reference="Demarches.Code.Scripts" locale=""> | ||
<web>Demarches.Code</web> | ||
<name>Scripts</name> | ||
<language/> | ||
<defaultLanguage/> | ||
<translation>0</translation> | ||
<creator>xwiki:XWiki.Admin</creator> | ||
<creationDate>1530262804000</creationDate> | ||
<parent>wikidemat:Demarches.Code.WebHome</parent> | ||
<author>xwiki:XWiki.Admin</author> | ||
<contentAuthor>xwiki:XWiki.Admin</contentAuthor> | ||
<date>1530265472000</date> | ||
<contentUpdateDate>1530265472000</contentUpdateDate> | ||
<version>1.1</version> | ||
<title>Scripts</title> | ||
<comment/> | ||
<minorEdit>false</minorEdit> | ||
<syntaxId>xwiki/2.1</syntaxId> | ||
<hidden>false</hidden> | ||
<content>{{velocity}} | ||
|
||
#macro(listDemarchesByProperty $property) | ||
== Demarches grouped by $property | ||
|
||
#set ($xwql = "select distinct demarche.$property from Document doc, doc.object(Demarches.Code.DemarchesClass) as demarche order by demarche.$property") | ||
#set ($results = $services.query.xwql($xwql).execute()) | ||
#foreach ($entry in $results) | ||
|=(% width="20%" %)$property:${entry}|((( | ||
|
||
#set ($xwql = "from doc.object(Demarches.Code.DemarchesClass) as demarche where demarche.$property='$entry'") | ||
#set ($demarches = $services.query.xwql($xwql).execute()) | ||
#foreach ($demarche in $demarches) [[$demarche]] #end | ||
))) | ||
#end | ||
#end | ||
|
||
#listDemarchesByProperty('statutProjetDemat') | ||
|
||
#listDemarchesByProperty('direction') | ||
|
||
#if ($false) | ||
== Demarches with no "statutProjetDemat" | ||
|
||
#set ($xwql = "from doc.object(Demarches.Code.DemarchesClass) as demarche") | ||
#set ($demarches = $services.query.xwql($xwql).execute()) | ||
#set ($counter = 0) | ||
#foreach ($demarche in $demarches) | ||
#set ($ddoc = $xwiki.getDocument($demarche)) | ||
#set ($value = $ddoc.statutProjetDemat) | ||
#if ($value == '' && $counter < 10000) | ||
* [[$demarche]] - $value | ||
#set ($object = $ddoc.getObject("Demarches.Code.DemarchesClass")) | ||
#set ($discard = $object.set('statutProjetDemat','aucun')) | ||
#set ($discard = $ddoc.save('Mise à jour du champ "statutProjetDemat" à la valeur "Aucun"', true)) | ||
#set ($counter = $counter + 1) | ||
#end | ||
#end | ||
#end | ||
|
||
{{/velocity}}</content> | ||
</xwikidoc> |