Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22a78d1fef | ||
|
|
6eb02e94ce | ||
|
|
5116f6b60d | ||
|
|
9edfa4f40e | ||
|
|
4b9fd45d92 | ||
|
|
42b07fea6a | ||
|
|
04a526e728 | ||
|
|
e28efeab7e | ||
|
|
bc939a5bdb | ||
|
|
4a052ea707 | ||
|
|
f139fcfefb | ||
|
|
347a81dc66 | ||
|
|
d142fc1eac | ||
|
|
e039ed4fe5 | ||
|
|
44d2248ba5 | ||
|
|
34e7527442 | ||
|
|
ecffe9bb4e | ||
|
|
6e7382633f | ||
|
|
bb50c92230 | ||
|
|
98dffaebed |
+1
-1
@@ -1 +1 @@
|
|||||||
1.11.1
|
1.11.8
|
||||||
|
|||||||
@@ -73,8 +73,9 @@ templates:
|
|||||||
haxe cagette.hxml -D i18n_generation
|
haxe cagette.hxml -D i18n_generation
|
||||||
@make LANG=fr ctemplates
|
@make LANG=fr ctemplates
|
||||||
msgfmt www/lang/texts_fr.po -o www/lang/texts_fr.mo
|
msgfmt www/lang/texts_fr.po -o www/lang/texts_fr.mo
|
||||||
|
|
||||||
chown www-data:www-data -R www
|
chown www-data:www-data -R www
|
||||||
chown www-data:www-data -R lang/fr
|
chown www-data:www-data -R lang
|
||||||
|
|
||||||
ctemplates:
|
ctemplates:
|
||||||
(cd lang/$(LANG)/tpl; temploc2 -macros macros.mtt -output ../tmp/ *.mtt */*.mtt */*/*.mtt)
|
(cd lang/$(LANG)/tpl; temploc2 -macros macros.mtt -output ../tmp/ *.mtt */*.mtt */*/*.mtt)
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
CAGETTE PEI
|
CAGETTE PEI
|
||||||
===========
|
===========
|
||||||
|
|
||||||
|
Cagette Péi est un logiciel libre qui favorise les circuits courts.
|
||||||
|
Il a été adapté pour les besoins des AMAPs sur le marché réunionnais.
|
||||||
|
|
||||||
> <french>
|
> <french>
|
||||||
> Fourche du logiciel [Cagette.net](https://github.com/CagetteNet) à partir de la version 0.9.2 Novembre 2018
|
> Fourche du logiciel [Cagette.net](https://github.com/CagetteNet) à partir de la version 0.9.2 Novembre 2018. Certaines portions de code n'étant plus disponibles en téléchargement à partir de cette date, le logiciel a été repris, adapté puis réactualisé. Pour plus d'information, contact@artcode.re
|
||||||
>
|
|
||||||
> Certaines portions du code source de Cagette.net n'étant plus disponibles en téléchargement à partir de cette date,
|
|
||||||
> j'ai repris sur la base d'un existant pour adapter au marché local réunionnais et leurs AMAPéi.
|
|
||||||
> </french>
|
> </french>
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## PREREQUISITE MARIADB
|
## PREREQUISITE MARIADB
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -28,30 +30,24 @@ curl -L https://deb.nodesource.com/setup_8.x | bash -
|
|||||||
apt install -y nodejs=8.17.0-1nodesource1
|
apt install -y nodejs=8.17.0-1nodesource1
|
||||||
apt install -y sudo haxe apache2 make git imagemagick gettext libapache2-mod-neko mariadb-server sendemail libio-socket-ssl-perl libnet-ssleay-perl
|
apt install -y sudo haxe apache2 make git imagemagick gettext libapache2-mod-neko mariadb-server sendemail libio-socket-ssl-perl libnet-ssleay-perl
|
||||||
|
|
||||||
mysql -u root <<EOF
|
|
||||||
CREATE DATABASE cagettepei;
|
|
||||||
GRANT ALL ON cagettepei.* TO 'cagettepei'@'%' IDENTIFIED BY 'cagettepei';
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cd /var/www
|
cd /var/www
|
||||||
git clone https://git.artcode.re/cagetters/cagettepei.git
|
git clone https://git.artcode.re/cagetters/cagettepei.git
|
||||||
cd cagettepei
|
cd cagettepei
|
||||||
make install ENV=dev
|
make install ENV=dev
|
||||||
|
|
||||||
vim /etc/apache2/sites-available/cagettepei.conf
|
vim /etc/apache2/sites-available/cagettepei.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
ServerName cagettepei
|
DocumentRoot /var/www/cagettepei/www
|
||||||
DirectoryIndex index.n
|
DirectoryIndex index.n
|
||||||
DocumentRoot /var/www/cagettepei/www/
|
CustomLog ${APACHE_LOG_DIR}/cagettepei/access.log combined
|
||||||
|
|
||||||
CustomLog ${APACHE_LOG_DIR}/cagettepei/access.log combined
|
|
||||||
ErrorLog ${APACHE_LOG_DIR}/cagettepei/debug.log
|
|
||||||
ErrorLogFormat "[%{uc}t] %M"
|
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
|
sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
|
||||||
a2dissite 000-default.conf
|
a2dissite 000-default.conf
|
||||||
@@ -69,18 +65,18 @@ vim config.xml
|
|||||||
```
|
```
|
||||||
```
|
```
|
||||||
<config
|
<config
|
||||||
host="<DOMAIN.TLD>"
|
host = "<DOMAIN.TLD>"
|
||||||
database="mysql://cagettepei:cagettepei@localhost/cagettepei"
|
database = "mysql://cagettepei:cagettepei@localhost/cagettepei"
|
||||||
key="<SECRET_PHRASE>"
|
key = "<SECRET_PHRASE>"
|
||||||
default_email = "<EMAIL>"
|
default_email = "<EMAIL>"
|
||||||
webmaster_email = "<EMAIL>"
|
webmaster_email = "<EMAIL>"
|
||||||
|
|
||||||
debug="0"
|
debug = "0"
|
||||||
sqllog="0"
|
sqllog = "0"
|
||||||
maintain="0"
|
maintain = "0"
|
||||||
|
|
||||||
cache="1"
|
cache = "1"
|
||||||
cachetpl="0"
|
cachetpl = "0"
|
||||||
/>
|
/>
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -91,7 +87,7 @@ go to http://localhost for ERROR + table regeneration, then
|
|||||||
|
|
||||||
```
|
```
|
||||||
cd /var/www/cagettepei
|
cd /var/www/cagettepei
|
||||||
SECRET=$(grep key= config.xml | cut -d= -f2 | cut -d'"' -f2)
|
SECRET=$(grep key config.xml | cut -d= -f2 | cut -d'"' -f2)
|
||||||
echo "insert into User values (1,'fr',MD5('${SECRET}cagettepei'),1,'Administrateur','Cagette Péi', 'admin', null, null, null, null, null, null, null, null, null, now(), now(),6,null, null)" | mysql -h localhost -u cagettepei -pcagettepei cagettepei
|
echo "insert into User values (1,'fr',MD5('${SECRET}cagettepei'),1,'Administrateur','Cagette Péi', 'admin', null, null, null, null, null, null, null, null, null, now(), now(),6,null, null)" | mysql -h localhost -u cagettepei -pcagettepei cagettepei
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
+1
-51
@@ -1,51 +1 @@
|
|||||||
{
|
{"name": "cagette-pei", "description": "le logiciel libre du circuit court", "license": "AGPL-3.0", "dependencies": {"bootstrap": "^3.3.4", "eonasdan-bootstrap-datetimepicker": "^4.7.14", "geolib": "^2.0.24", "haxe-modular": "^0.7.0", "jquery": "^2.2.4", "leaflet": "^1.3.1", "react": "^15.6.1", "react-bootstrap-typeahead": "1.4.2", "react-datetime": "^2.9.0", "react-dom": "^15.6.1", "react-leaflet": "^1.8.0", "react-places-autocomplete": "^6.0.2", "react-router": "^4.2.0", "react-router-dom": "^4.2.2"}, "devDependencies": {"babel-preset-es2015": "^6.24.1", "babel-preset-react": "^6.24.1", "babelify": "^7.3.0", "browserify": "^14.4.0", "cross-env": "^5.1.1", "node-sass": "^4.5.3", "npm-run-all": "^4.1.2", "uglify-js": "^3.1.9", "watchify": "^3.9.0"}, "scripts": {"build": "npm-run-all --parallel build:*", "build:js": "haxe cagetteJs.hxml", "build:sass": "node-sass www/css -o www/css", "watch:sass": "npm run build:sass -- --watch", "build2": "babel src -d lib", "libs:dev": "browserify js/libs/libs.js -o www/js/libs.js -d", "libs:prod": "cross-env NODE_ENV=production browserify js/libs/libs.js | uglifyjs -c -m > www/js/libs.js", "test": "haxe testsJS.hxml && node js/test/tests.js", "prepush": "npm test"}, "repository": {"type": "git", "url": "git+https://github.com/bablukid/cagette.git"}, "bugs": {"url": "https://github.com/bablukid/cagette/issues"}, "version": "1.11.8"}
|
||||||
"name": "cagette-pei",
|
|
||||||
"description": "le logiciel libre du circuit court",
|
|
||||||
"license": "AGPL-3.0",
|
|
||||||
"dependencies": {
|
|
||||||
"bootstrap": "^3.3.4",
|
|
||||||
"eonasdan-bootstrap-datetimepicker": "^4.7.14",
|
|
||||||
"geolib": "^2.0.24",
|
|
||||||
"haxe-modular": "^0.7.0",
|
|
||||||
"jquery": "^2.2.4",
|
|
||||||
"leaflet": "^1.3.1",
|
|
||||||
"react": "^15.6.1",
|
|
||||||
"react-bootstrap-typeahead": "1.4.2",
|
|
||||||
"react-datetime": "^2.9.0",
|
|
||||||
"react-dom": "^15.6.1",
|
|
||||||
"react-leaflet": "^1.8.0",
|
|
||||||
"react-places-autocomplete": "^6.0.2",
|
|
||||||
"react-router": "^4.2.0",
|
|
||||||
"react-router-dom": "^4.2.2"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"babel-preset-es2015": "^6.24.1",
|
|
||||||
"babel-preset-react": "^6.24.1",
|
|
||||||
"babelify": "^7.3.0",
|
|
||||||
"browserify": "^14.4.0",
|
|
||||||
"cross-env": "^5.1.1",
|
|
||||||
"node-sass": "^4.5.3",
|
|
||||||
"npm-run-all": "^4.1.2",
|
|
||||||
"uglify-js": "^3.1.9",
|
|
||||||
"watchify": "^3.9.0"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"build": "npm-run-all --parallel build:*",
|
|
||||||
"build:js": "haxe cagetteJs.hxml",
|
|
||||||
"build:sass": "node-sass www/css -o www/css",
|
|
||||||
"watch:sass": "npm run build:sass -- --watch",
|
|
||||||
"build2": "babel src -d lib",
|
|
||||||
"libs:dev": "browserify js/libs/libs.js -o www/js/libs.js -d",
|
|
||||||
"libs:prod": "cross-env NODE_ENV=production browserify js/libs/libs.js | uglifyjs -c -m > www/js/libs.js",
|
|
||||||
"test": "haxe testsJS.hxml && node js/test/tests.js",
|
|
||||||
"prepush": "npm test"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/bablukid/cagette.git"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/bablukid/cagette/issues"
|
|
||||||
},
|
|
||||||
"version": "1.11.1"
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class Contract extends Controller {
|
|||||||
@tpl("contract/default.mtt")
|
@tpl("contract/default.mtt")
|
||||||
function doDefault() {
|
function doDefault() {
|
||||||
// Create the list of links to change the language
|
// Create the list of links to change the language
|
||||||
var langs = App.config.get("langs").split(";");
|
var langs = App.config.get("langs", "fr").split(";");
|
||||||
var langNames = App.config.get("langnames", "Français").split(";");
|
var langNames = App.config.get("langnames", "Français").split(";");
|
||||||
var i = 0;
|
var i = 0;
|
||||||
var langLinks = "";
|
var langLinks = "";
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
package controller.admin;
|
package controller.admin;
|
||||||
|
|
||||||
import haxe.web.Dispatch;
|
import haxe.web.Dispatch;
|
||||||
import Common;
|
import Common;
|
||||||
|
|
||||||
class Admin extends Controller {
|
class Admin extends Controller {
|
||||||
|
|
||||||
public function new() {
|
public function new() {
|
||||||
super();
|
super();
|
||||||
view.category = 'admin';
|
view.category = 'admin';
|
||||||
|
|
||||||
//trigger a "Nav" event
|
// trigger a "Nav" event
|
||||||
var nav = new Array<Link>();
|
var nav = new Array<Link>();
|
||||||
var e = Nav(nav,"admin");
|
var e = Nav(nav, "admin");
|
||||||
app.event(e);
|
app.event(e);
|
||||||
view.nav = e.getParameters()[0];
|
view.nav = e.getParameters()[0];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@tpl("admin/default.mtt")
|
@tpl("admin/default.mtt")
|
||||||
@@ -24,44 +23,36 @@ class Admin extends Controller {
|
|||||||
@tpl("admin/emails.mtt")
|
@tpl("admin/emails.mtt")
|
||||||
function doEmails() {
|
function doEmails() {
|
||||||
var browse = function(index:Int, limit:Int) {
|
var browse = function(index:Int, limit:Int) {
|
||||||
return sugoi.db.BufferedMail.manager.search($sdate==null,{limit:[index,limit],orderBy:-cdate},false);
|
return sugoi.db.BufferedMail.manager.search($sdate == null, {limit: [index, limit], orderBy: -cdate}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
var count = sugoi.db.BufferedMail.manager.count($sdate==null);
|
var count = sugoi.db.BufferedMail.manager.count($sdate == null);
|
||||||
view.browser = new sugoi.tools.ResultsBrowser(count,10,browse);
|
view.browser = new sugoi.tools.ResultsBrowser(count, 10, browse);
|
||||||
view.num = count;
|
view.num = count;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@tpl("form.mtt")
|
@tpl("form.mtt")
|
||||||
function doSmtp() {
|
function doSmtp() {
|
||||||
|
|
||||||
var f = new sugoi.form.Form("emails");
|
var f = new sugoi.form.Form("emails");
|
||||||
var data = [
|
var data = [{label: "SMTP", value: "smtp"}, {label: "Mandrill API", value: "mandrill"},];
|
||||||
{label:"SMTP",value:"smtp"},
|
|
||||||
{label:"Mandrill API",value:"mandrill"},
|
|
||||||
];
|
|
||||||
|
|
||||||
var mailer = sugoi.db.Variable.get("mailer")==null ? "smtp" : sugoi.db.Variable.get("mailer");
|
var mailer = sugoi.db.Variable.get("mailer") == null ? "smtp" : sugoi.db.Variable.get("mailer");
|
||||||
var host = sugoi.db.Variable.get("smtp_host")==null ? App.config.get("smtp_host") : sugoi.db.Variable.get("smtp_host");
|
var host = sugoi.db.Variable.get("smtp_host") == null ? "<SMTP_SERVER>" : sugoi.db.Variable.get("smtp_host");
|
||||||
var port = sugoi.db.Variable.get("smtp_port")==null ? App.config.get("smtp_port") : sugoi.db.Variable.get("smtp_port");
|
var port = sugoi.db.Variable.get("smtp_port") == null ? "587" : sugoi.db.Variable.get("smtp_port");
|
||||||
var user = sugoi.db.Variable.get("smtp_user")==null ? App.config.get("smtp_user") : sugoi.db.Variable.get("smtp_user");
|
var user = sugoi.db.Variable.get("smtp_user") == null ? "" : sugoi.db.Variable.get("smtp_user");
|
||||||
var pass = sugoi.db.Variable.get("smtp_pass")==null ? App.config.get("smtp_pass") : sugoi.db.Variable.get("smtp_pass");
|
var pass = sugoi.db.Variable.get("smtp_pass") == null ? "" : sugoi.db.Variable.get("smtp_pass");
|
||||||
|
|
||||||
|
f.addElement(new sugoi.form.elements.StringSelect("mailer", "Mailer", data, mailer));
|
||||||
f.addElement(new sugoi.form.elements.StringSelect("mailer", "Mailer", data, mailer ));
|
|
||||||
f.addElement(new sugoi.form.elements.StringInput("smtp_host", "host", host));
|
f.addElement(new sugoi.form.elements.StringInput("smtp_host", "host", host));
|
||||||
f.addElement(new sugoi.form.elements.StringInput("smtp_port", "port", port));
|
f.addElement(new sugoi.form.elements.StringInput("smtp_port", "port", port));
|
||||||
f.addElement(new sugoi.form.elements.StringInput("smtp_user", "user", user));
|
f.addElement(new sugoi.form.elements.StringInput("smtp_user", "user", user));
|
||||||
f.addElement(new sugoi.form.elements.StringInput("smtp_pass", "pass", pass));
|
f.addElement(new sugoi.form.elements.StringInput("smtp_pass", "pass", pass));
|
||||||
|
|
||||||
|
if (f.isValid()) {
|
||||||
if (f.isValid()){
|
for (k in ["mailer", "smtp_host", "smtp_port", "smtp_user", "smtp_pass"]) {
|
||||||
for ( k in ["mailer","smtp_host","smtp_port","smtp_user","smtp_pass"]){
|
|
||||||
sugoi.db.Variable.set(k, f.getValueOf(k));
|
sugoi.db.Variable.set(k, f.getValueOf(k));
|
||||||
}
|
}
|
||||||
throw Ok("/admin/emails", t._("Configuration updated") );
|
throw Ok("/admin/emails", t._("Configuration updated"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
view.title = t._("Email service configuration");
|
view.title = t._("Email service configuration");
|
||||||
@@ -72,67 +63,60 @@ class Admin extends Controller {
|
|||||||
d.dispatch(new controller.admin.Plugins());
|
d.dispatch(new controller.admin.Plugins());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@tpl("admin/taxo.mtt")
|
@tpl("admin/taxo.mtt")
|
||||||
function doTaxo(){
|
function doTaxo() {
|
||||||
|
|
||||||
view.categ = db.TxpCategory.manager.all();
|
view.categ = db.TxpCategory.manager.all();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display errors logged in DB
|
* Display errors logged in DB
|
||||||
*/
|
*/
|
||||||
@tpl("admin/errors.mtt")
|
@tpl("admin/errors.mtt")
|
||||||
function doErrors( args:{?user: Int, ?like: String, ?empty:Bool} ) {
|
function doErrors(args:{?user:Int, ?like:String, ?empty:Bool}) {
|
||||||
view.now = Date.now();
|
view.now = Date.now();
|
||||||
|
|
||||||
view.u = args.user!=null ? db.User.manager.get(args.user,false) : null;
|
view.u = args.user != null ? db.User.manager.get(args.user, false) : null;
|
||||||
view.like = args.like!=null ? args.like : "";
|
view.like = args.like != null ? args.like : "";
|
||||||
|
|
||||||
var sql = "";
|
var sql = "";
|
||||||
if( args.user!=null ) sql += " AND uid="+args.user;
|
if (args.user != null)
|
||||||
//if( args.like!=null && args.like != "" ) sql += " AND error like "+sys.db.Manager.cnx.quote("%"+args.like+"%");
|
sql += " AND uid=" + args.user;
|
||||||
|
// if( args.like!=null && args.like != "" ) sql += " AND error like "+sys.db.Manager.cnx.quote("%"+args.like+"%");
|
||||||
if (args.empty) {
|
if (args.empty) {
|
||||||
sys.db.Manager.cnx.request("truncate table Error");
|
sys.db.Manager.cnx.request("truncate table Error");
|
||||||
}
|
}
|
||||||
|
|
||||||
var errorsStats = sys.db.Manager.cnx.request("select count(id) as c, DATE_FORMAT(date,'%y-%m-%d') as day from Error where date > NOW()- INTERVAL 1 MONTH "+sql+" group by day order by day").results();
|
var errorsStats = sys.db.Manager.cnx.request("select count(id) as c, DATE_FORMAT(date,'%y-%m-%d') as day from Error where date > NOW()- INTERVAL 1 MONTH "
|
||||||
|
+ sql
|
||||||
|
+ " group by day order by day")
|
||||||
|
.results();
|
||||||
view.errorsStats = errorsStats;
|
view.errorsStats = errorsStats;
|
||||||
|
|
||||||
view.browser = new sugoi.tools.ResultsBrowser(
|
view.browser = new sugoi.tools.ResultsBrowser(sugoi.db.Error.manager.unsafeCount("SELECT count(*) FROM Error WHERE 1 " + sql), 20,
|
||||||
sugoi.db.Error.manager.unsafeCount("SELECT count(*) FROM Error WHERE 1 "+sql),
|
function(start, limit) {
|
||||||
20,
|
return sugoi.db.Error.manager.unsafeObjects("SELECT * FROM Error WHERE 1 " + sql + " ORDER BY date DESC LIMIT " + start + "," + limit, false);
|
||||||
function(start, limit) { return sugoi.db.Error.manager.unsafeObjects("SELECT * FROM Error WHERE 1 "+sql+" ORDER BY date DESC LIMIT "+start+","+limit,false); }
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@tpl("admin/graph.mtt")
|
@tpl("admin/graph.mtt")
|
||||||
function doGraph(?key:String,?year:Int,?month:Int){
|
function doGraph(?key:String, ?year:Int, ?month:Int) {
|
||||||
|
var from = new Date(year, month, 1, 0, 0, 0);
|
||||||
|
var to = new Date(year, month + 1, 0, 23, 59, 59);
|
||||||
|
|
||||||
|
if (app.params.exists("recompute")) {
|
||||||
var from = new Date(year,month,1,0,0,0);
|
switch (key) {
|
||||||
var to = new Date(year,month+1,0,23,59,59);
|
|
||||||
|
|
||||||
if(app.params.exists("recompute")){
|
|
||||||
|
|
||||||
switch(key){
|
|
||||||
case "basket":
|
case "basket":
|
||||||
for( d in 1...to.getDate()){
|
for (d in 1...to.getDate()) {
|
||||||
var _from = new Date(year,month,d,0,0,0);
|
var _from = new Date(year, month, d, 0, 0, 0);
|
||||||
var _to = new Date(year,month,d,23,59,59);
|
var _to = new Date(year, month, d, 23, 59, 59);
|
||||||
var value = db.Basket.manager.count($cdate>=_from && $cdate<=_to);
|
var value = db.Basket.manager.count($cdate >= _from && $cdate <= _to);
|
||||||
var g = db.Graph.record(key,value, _from );
|
var g = db.Graph.record(key, value, _from);
|
||||||
// trace(value,_from,g);
|
// trace(value,_from,g);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var data = db.Graph.getRange(key, from, to);
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
var data = db.Graph.getRange(key,from,to);
|
|
||||||
view.data = data;
|
view.data = data;
|
||||||
view.from = from;
|
view.from = from;
|
||||||
view.to = to;
|
view.to = to;
|
||||||
@@ -140,55 +124,46 @@ class Admin extends Controller {
|
|||||||
|
|
||||||
var averageValue = 0.0;
|
var averageValue = 0.0;
|
||||||
var total = 0.0;
|
var total = 0.0;
|
||||||
for( d in data) total += d.value;
|
for (d in data)
|
||||||
averageValue = total/data.length;
|
total += d.value;
|
||||||
|
averageValue = total / data.length;
|
||||||
view.total = total;
|
view.total = total;
|
||||||
view.averageValue = averageValue;
|
view.averageValue = averageValue;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function doFixDistribValidation() {
|
function doFixDistribValidation() {
|
||||||
|
|
||||||
Sys.println("===== Liste des distributions ayant été re-validées ====<br>");
|
Sys.println("===== Liste des distributions ayant été re-validées ====<br>");
|
||||||
|
|
||||||
//Get the current group
|
// Get the current group
|
||||||
var group = app.user.amap;
|
var group = app.user.amap;
|
||||||
//Get all the contracts for this given group
|
// Get all the contracts for this given group
|
||||||
var contractIds = Lambda.map(group.getContracts(),function(x) return x.id);
|
var contractIds = Lambda.map(group.getContracts(), function(x) return x.id);
|
||||||
//Get all the validated distributions for this given group
|
// Get all the validated distributions for this given group
|
||||||
var validatedDistribs = db.Distribution.manager.search( ($contractId in contractIds) && $validated == true, {orderBy:date}, false);
|
var validatedDistribs = db.Distribution.manager.search(($contractId in contractIds) && $validated == true, {orderBy: date}, false);
|
||||||
for (distrib in validatedDistribs){
|
for (distrib in validatedDistribs) {
|
||||||
|
|
||||||
service.PaymentService.validateDistribution(distrib);
|
service.PaymentService.validateDistribution(distrib);
|
||||||
Sys.println(distrib.toString() + "<br>");
|
Sys.println(distrib.toString() + "<br>");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Sys.println("===== Fin de la liste ====");
|
Sys.println("===== Fin de la liste ====");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function doCheckDistribValidation() {
|
function doCheckDistribValidation() {
|
||||||
|
|
||||||
Sys.println("===== Liste des distributions validées ayant des opérations/paiements non validés ====<br>");
|
Sys.println("===== Liste des distributions validées ayant des opérations/paiements non validés ====<br>");
|
||||||
|
|
||||||
//Get the current group
|
// Get the current group
|
||||||
var group = app.user.amap;
|
var group = app.user.amap;
|
||||||
//Get all the contracts for this given group
|
// Get all the contracts for this given group
|
||||||
var contractIds = Lambda.map(group.getContracts(),function(x) return x.id);
|
var contractIds = Lambda.map(group.getContracts(), function(x) return x.id);
|
||||||
//Get all the validated distributions for this given group
|
// Get all the validated distributions for this given group
|
||||||
var validatedDistribs = db.Distribution.manager.search( ($contractId in contractIds) && $validated == true, {orderBy:date}, false);
|
var validatedDistribs = db.Distribution.manager.search(($contractId in contractIds) && $validated == true, {orderBy: date}, false);
|
||||||
for (distrib in validatedDistribs){
|
for (distrib in validatedDistribs) {
|
||||||
|
for (user in distrib.getUsers()) {
|
||||||
for (user in distrib.getUsers()){
|
|
||||||
|
|
||||||
var basket = db.Basket.get(user, distrib.place, distrib.date);
|
var basket = db.Basket.get(user, distrib.place, distrib.date);
|
||||||
if (basket == null || basket.isValidated()) continue;
|
if (basket == null || basket.isValidated())
|
||||||
|
continue;
|
||||||
|
|
||||||
for (order in basket.getOrders()){
|
for (order in basket.getOrders()) {
|
||||||
if (!order.paid) {
|
if (!order.paid) {
|
||||||
Sys.println(order.distribution.toString() + "<br>");
|
Sys.println(order.distribution.toString() + "<br>");
|
||||||
Sys.println(order.toString() + "<br>");
|
Sys.println(order.toString() + "<br>");
|
||||||
@@ -196,28 +171,22 @@ class Admin extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var operation = basket.getOrderOperation(false);
|
var operation = basket.getOrderOperation(false);
|
||||||
if (operation != null){
|
if (operation != null) {
|
||||||
|
|
||||||
if (operation.pending) {
|
if (operation.pending) {
|
||||||
Sys.println(distrib.toString() + "<br>");
|
Sys.println(distrib.toString() + "<br>");
|
||||||
Sys.println(operation.toString() + "<br>");
|
Sys.println(operation.toString() + "<br>");
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( payment in basket.getPayments()){
|
for (payment in basket.getPayments()) {
|
||||||
|
if (payment.pending) {
|
||||||
if (payment.pending){
|
|
||||||
Sys.println(distrib.toString() + "<br>");
|
Sys.println(distrib.toString() + "<br>");
|
||||||
Sys.println(payment.toString() + "<br>");
|
Sys.println(payment.toString() + "<br>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Sys.println("===== Fin de la liste ====");
|
Sys.println("===== Fin de la liste ====");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+395
-444
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 112 KiB |
Reference in New Issue
Block a user