Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0.4 #155

Merged
merged 59 commits into from
Feb 12, 2022
Merged

2.0.4 #155

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
5935267
refactoring
baimard Jan 22, 2022
184c16e
refactoring
baimard Jan 22, 2022
75ad70f
clean
baimard Jan 26, 2022
b527046
Merge branch 'master' of github.com:baimard/gestion into dev
baimard Jan 27, 2022
3f14409
transifex
baimard Jan 27, 2022
b0ea08d
Merge branch 'master' of github.com:baimard/gestion into dev
baimard Jan 28, 2022
cf20196
transifex
baimard Jan 28, 2022
0504719
Merge branch 'master' of github.com:baimard/gestion into dev
baimard Jan 29, 2022
54fa1c2
test
baimard Jan 29, 2022
9b23b2e
Translation
baimard Jan 29, 2022
d827efa
translation
baimard Jan 29, 2022
32a78c5
Merge branch 'master' into dev
baimard Jan 29, 2022
dca3b71
Merge branch 'master' of github.com:baimard/gestion into dev
baimard Jan 31, 2022
85f6179
hotfix
baimard Jan 31, 2022
02449f0
Merge branch 'dev' of github.com:baimard/gestion into dev
baimard Jan 31, 2022
475ed07
Merge branch 'master' of github.com:baimard/gestion into dev
baimard Feb 1, 2022
3cabf21
https://github.com/baimard/gestion/issues/123
baimard Feb 1, 2022
ac86d2a
Update lib/Migration/Version20002Date20220201085856.php
baimard Feb 1, 2022
804d73a
Update lib/Migration/Version20002Date20220201085856.php
baimard Feb 1, 2022
328cfbe
Update lib/Migration/Version7Date20220125174818.php
baimard Feb 1, 2022
dbddf9b
Update lib/Migration/Version7Date20220125174818.php
baimard Feb 1, 2022
fd52eb6
Update lib/Migration/Version7Date20220125174818.php
baimard Feb 1, 2022
2b4bab5
https://github.com/baimard/gestion/issues/135
baimard Feb 3, 2022
ea17117
Merge branch 'dev' of github.com:baimard/gestion into dev
baimard Feb 3, 2022
acd098d
Merge branch 'master' of github.com:baimard/gestion into dev
baimard Feb 3, 2022
fa8ab8e
Update lib/Migration/Version20002Date20220201085856.php
baimard Feb 3, 2022
9bb3d7a
Merge branch 'dev' of github.com:baimard/gestion into dev
baimard Feb 3, 2022
b6e6b91
valide
baimard Feb 3, 2022
0ca5f43
valide
baimard Feb 3, 2022
5981760
final
baimard Feb 3, 2022
3ea4ebd
Final
baimard Feb 3, 2022
a3f5f4e
Final
baimard Feb 3, 2022
90015f2
Update lib/Migration/Version20002Date20220201085856.php
baimard Feb 3, 2022
3ee5976
Update lib/Migration/Version20002Date20220201085856.php
baimard Feb 3, 2022
5fd7a03
Update lib/Migration/Version7Date20220125174818.php
baimard Feb 3, 2022
c8aacb8
Update lib/Migration/Version7Date20220125174818.php
baimard Feb 3, 2022
73eab43
Update lib/Migration/Version7Date20220125174818.php
baimard Feb 3, 2022
4578dfd
[tx-robot] updated from transifex
nextcloud-bot Feb 3, 2022
de54fd8
l10n: Fixed grammar
rakekniven Feb 3, 2022
7044077
l10n: Improve styling
Valdnet Feb 3, 2022
a6a8aa6
l10n: Improve styling
Valdnet Feb 3, 2022
3423b50
l10n: Add "an"
Valdnet Feb 3, 2022
53cec53
l10n: Add "an"
Valdnet Feb 3, 2022
9a34c28
l10n: Replace a word
Valdnet Feb 3, 2022
b9e233b
l10n: Replace a word
Valdnet Feb 3, 2022
894c831
[tx-robot] updated from transifex
nextcloud-bot Feb 3, 2022
76a995c
Update lib/Migration/Version20002Date20220201085856.php
baimard Feb 3, 2022
ab62c72
valide
baimard Feb 3, 2022
1ce19cb
valide
baimard Feb 3, 2022
987f873
final
baimard Feb 3, 2022
1db800d
Final
baimard Feb 3, 2022
dfa42dc
Final
baimard Feb 3, 2022
a025d9f
Merge branch 'dev' of github.com:baimard/gestion into dev
baimard Feb 3, 2022
38ca610
Merge branch 'master' of github.com:baimard/gestion into dev
baimard Feb 4, 2022
c398927
Hotfix 2.0.2
baimard Feb 4, 2022
28749a1
Hotfix 2.0.3
baimard Feb 4, 2022
d9c2a2e
enhancement tests !
baimard Feb 4, 2022
6f4c12e
Merge branch 'master' of github.com:baimard/gestion into dev
baimard Feb 12, 2022
e9d63ba
https://github.com/baimard/gestion/issues/143
baimard Feb 12, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ appstore:

.PHONY: test
test:
$(CURDIR)/vendor/phpunit/phpunit/phpunit -c phpunit.xml --debug --colors
sudo -u www-data $(CURDIR)/vendor/phpunit/phpunit/phpunit -c phpunit.xml --debug --colors
#$(CURDIR)/vendor/phpunit/phpunit/phpunit -c phpunit.integration.xml

.PHONY: testPanther
Expand All @@ -177,4 +177,19 @@ composer.phar:

cleanComposer:
rm -f translationtool.phar composer.lock src/composer.lock
rm -rf vendor src/vendor
rm -rf vendor src/vendor

fulltest: runContainer testPanther test stopContainer

runContainer:
sudo service apache2 stop
docker run -d --rm --network next --name database -p 3306:3306 -e MYSQL_DATABASE=nextcloud -e MARIADB_ROOT_PASSWORD=nextcloud -e MYSQL_USER=nextcloud -e MYSQL_PASSWORD=nextcloud mariadb
docker run -d --rm --network next --name nextcloud -p 80:80 nextcloud:23-apache
sleep 5
killall geckodriver; php tests/Unit/Panther/initTest.php
docker exec -i database sh -c 'exec mysql -uroot -p"$$MARIADB_ROOT_PASSWORD"' < ./tests/dataset.sql

stopContainer:
docker stop -t 0 database
docker stop -t 0 nextcloud
sudo service apache2 start
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

[Love my work ? Buy me a coffee !](https://www.buymeacoffee.com/benjaminaimard)
</description>
<version>2.0.2</version>
<version>2.0.4</version>
<licence>agpl</licence>
<author mail="benjamin@cybercorp.fr" homepage="https://github.com/baimard">Benjamin AIMARD</author>
<namespace>Gestion</namespace>
Expand Down
10,099 changes: 10,098 additions & 1 deletion js/820.app.js

Large diffs are not rendered by default.

10,099 changes: 10,098 additions & 1 deletion js/820.devisShow.app.js

Large diffs are not rendered by default.

10,099 changes: 10,098 additions & 1 deletion js/820.factureShow.app.js

Large diffs are not rendered by default.

1,453 changes: 1,451 additions & 2 deletions js/856.app.js

Large diffs are not rendered by default.

1,453 changes: 1,451 additions & 2 deletions js/856.devisShow.app.js

Large diffs are not rendered by default.

1,453 changes: 1,451 additions & 2 deletions js/856.factureShow.app.js

Large diffs are not rendered by default.

37,332 changes: 37,330 additions & 2 deletions js/client.app.js

Large diffs are not rendered by default.

37,463 changes: 37,461 additions & 2 deletions js/configuration.app.js

Large diffs are not rendered by default.

37,333 changes: 37,331 additions & 2 deletions js/devis.app.js

Large diffs are not rendered by default.

47,559 changes: 47,557 additions & 2 deletions js/devisShow.app.js

Large diffs are not rendered by default.

37,333 changes: 37,331 additions & 2 deletions js/facture.app.js

Large diffs are not rendered by default.

47,559 changes: 47,557 additions & 2 deletions js/factureShow.app.js

Large diffs are not rendered by default.

31,203 changes: 31,201 additions & 2 deletions js/main.app.js

Large diffs are not rendered by default.

37,330 changes: 37,328 additions & 2 deletions js/produit.app.js

Large diffs are not rendered by default.

37,219 changes: 37,217 additions & 2 deletions js/statistique.app.js

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions lib/Db/Bdd.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function insertClient($idNextcloud){
* Insert quote
*/
public function insertDevis($idNextcloud){
$sql = "INSERT INTO `".$this->tableprefix."devis` (`id`, `date`,`id_nextcloud`,`num`,`id_client`,version,mentions,comment) VALUES (NULL, NOW(),?,?,0,'0.1',?,?);";
$sql = "INSERT INTO `".$this->tableprefix."devis` (`date`,`id_nextcloud`,`num`,`id_client`,version,mentions,comment) VALUES (NOW(),?,?,0,'0.1',?,?);";
$this->execSQLNoData($sql, array($idNextcloud,$this->l->t('Quote number'),$this->l->t('New'),$this->l->t('Comment')));
return true;
}
Expand All @@ -109,7 +109,7 @@ public function insertDevis($idNextcloud){
* Insert invoice
*/
public function insertFacture($idNextcloud){
$sql = "INSERT INTO `".$this->tableprefix."facture` (`id`, `date`,`id_nextcloud`,`num`,`date_paiement`,`type_paiement`,`id_devis`) VALUES (NULL,?,?,?,NOW(),?,0);";
$sql = "INSERT INTO `".$this->tableprefix."facture` (`date`,`id_nextcloud`,`num`,`date_paiement`,`type_paiement`,`id_devis`) VALUES (?,?,?,NOW(),?,0);";
$this->execSQLNoData($sql, array($this->l->t('Text free'),$idNextcloud,$this->l->t('Invoice number'),$this->l->t('Means of payment')));

if(json_decode($this->getConfiguration(($idNextcloud)))[0]->auto_invoice_number == 1){
Expand Down Expand Up @@ -169,7 +169,7 @@ public function checkConfig($idNextcloud){
$sql = "SELECT count(*) as res FROM `".$this->tableprefix."configuration` WHERE `id_nextcloud` = ?";
$res = json_decode($this->execSQL($sql, array($idNextcloud)))[0]->res;
if ( $res < 1 ){
$sql = "INSERT INTO `".$this->tableprefix."configuration` (`id`, `entreprise`, `nom`, `prenom`, `legal_one`, `legal_two`, `mail`, `telephone`, `adresse`, `path`, `id_nextcloud`,`mentions_default`,`tva_default`,`devise`) VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?, '/', ?, ?, '0',?);";
$sql = "INSERT INTO `".$this->tableprefix."configuration` (`entreprise`, `nom`, `prenom`, `legal_one`, `legal_two`, `mail`, `telephone`, `adresse`, `path`, `id_nextcloud`,`mentions_default`,`tva_default`,`devise`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, '/', ?, ?, '0',?);";
$this->execSQLNoData($sql, array($this->l->t('Your company name'),
$this->l->t('Your company contact surname'),
$this->l->t('Your company contact name'),
Expand Down Expand Up @@ -242,15 +242,15 @@ public function numberProduit($idNextcloud){
* Annual turnover per month without VAT
*/
public function getAnnualTurnoverPerMonthNoVat($idNextcloud){
$sql = "SELECT YEAR(oc_gestion_facture.date_paiement) as y,
MONTH(oc_gestion_facture.date_paiement) as m,
sum(oc_gestion_produit.prix_unitaire * oc_gestion_produit_devis.quantite) as total
FROM `oc_gestion_facture`, `oc_gestion_produit_devis`, `oc_gestion_produit`
WHERE oc_gestion_facture.id_devis = oc_gestion_produit_devis.devis_id
AND oc_gestion_produit_devis.produit_id = oc_gestion_produit.id
AND oc_gestion_facture.id_nextcloud = ?
GROUP BY YEAR(oc_gestion_facture.date_paiement), MONTH(oc_gestion_facture.date_paiement)
ORDER BY YEAR(oc_gestion_facture.date_paiement) DESC, MONTH(oc_gestion_facture.date_paiement);";
$sql = "SELECT YEAR(".$this->tableprefix."facture.date_paiement) as y,
MONTH(".$this->tableprefix."facture.date_paiement) as m,
sum(".$this->tableprefix."produit.prix_unitaire * ".$this->tableprefix."produit_devis.quantite) as total
FROM `".$this->tableprefix."facture`, `".$this->tableprefix."produit_devis`, `".$this->tableprefix."produit`
WHERE ".$this->tableprefix."facture.id_devis = ".$this->tableprefix."produit_devis.devis_id
AND ".$this->tableprefix."produit_devis.produit_id = ".$this->tableprefix."produit.id
AND ".$this->tableprefix."facture.id_nextcloud = ?
GROUP BY YEAR(".$this->tableprefix."facture.date_paiement), MONTH(".$this->tableprefix."facture.date_paiement)
ORDER BY YEAR(".$this->tableprefix."facture.date_paiement) DESC, MONTH(".$this->tableprefix."facture.date_paiement);";
return $this->execSQL($sql, array($idNextcloud));
}

Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions src/js/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ import '@nextcloud/dialogs/styles/toast.scss'
import 'datatables.net-dt/css/jquery.dataTables.css';
import '../css/mycss.less';


import DataTable from 'datatables.net';
import { globalConfiguration, optionDatatable, path } from "./modules/mainFunction.mjs";
import { globalConfiguration, optionDatatable } from "./modules/mainFunction.mjs";
import './listener/main_listener';
import { Client } from "./objects/client.mjs";
// import 'bootstrap/js/dist/util';


window.addEventListener('DOMContentLoaded', function () {
globalConfiguration();
Client.loadClientDT(new DataTable('.tabledt',optionDatatable));

});

6 changes: 3 additions & 3 deletions src/js/modules/mainFunction.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { showSuccess } from "@nextcloud/dialogs";
import { translate as t, translatePlural as n } from '@nextcloud/l10n'
import { configuration, getStats, isconfig } from "./ajaxRequest.mjs";

import { generateUrl, getRootUrl } from "@nextcloud/router";
import { generateUrl } from "@nextcloud/router";
import { Devis } from "../objects/devis.mjs";
import { Client } from "../objects/client.mjs";

Expand All @@ -12,7 +12,7 @@ export var cur = null;
/**
*
*/
export const optionDatatable = {
export var optionDatatable = {
autoWidth: false,
stateSave: true,
language: {
Expand Down Expand Up @@ -88,7 +88,7 @@ export function LoadDT(DT, response, cls) {
let c = new cls(myresp);
DT.row.add(c.getDTRow());
});
DT.columns.adjust().draw();
DT.columns.adjust(optionDatatable).draw(true);
configureDT();
}

Expand Down
2 changes: 1 addition & 1 deletion templates/content/changelog.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div syle="display: none;" id="modalConfig" class="modal">
<div class="modal-content">
<span class="modalClose">&times;</span>
<h2><?php p($l->t('Welcome to GESTION 2.0.2 ')); ?></h2>
<h2><?php p($l->t('Welcome to GESTION')); ?> 2.0.4</h2>
<p style="margin-bottom:20px;"><b><?php p($l->t('To start with this application you need to configure your company information, follow this link')); ?></b> &#128073; <a href="<?php echo ($_['url']['config']); ?>"><?php p($l->t('My company')); ?></a></p>
<p style="margin-bottom:20px;">&#9888; <u><?php p($l->t('If you have updated this application, do not forget to clear your cache')); ?></u> &#9888;</p>
<p style="margin-bottom:20px;"><?php p($l->t('This application is open source and is designed by Benjamin AIMARD.')); ?></p>
Expand Down
5 changes: 5 additions & 0 deletions tests/Unit/Controller/PageControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,9 @@ public function testGetStats(){
$this->assertArrayHasKey('facture', $result);
$this->assertArrayHasKey('produit', $result);
}

public function testGetAnnualTurnoverPerMonthNoVat(){
$result = (array) json_decode($this->controller->getAnnualTurnoverPerMonthNoVat());
$this->assertIsArray($result);
}
}
4 changes: 2 additions & 2 deletions tests/Unit/Panther/IhmTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

$client->request('GET', 'http://next.cybercorp.fr');
$client->submitForm('submit-form', [
'user' => 'baimard',
'password' => 'baimardbaimard' // Not my real pass ...
'user' => 'nextcloud',
'password' => 'nextcloud' // Not my real pass ...
]);

$client->request('GET', 'http://next.cybercorp.fr/index.php/apps/gestion/config');
Expand Down
34 changes: 34 additions & 0 deletions tests/Unit/Panther/initTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Symfony\Component\Panther\Client;
require __DIR__.'/../../../vendor/autoload.php';

$client = Client::createFirefoxClient();

$client->request('GET', 'http://next.cybercorp.fr');

$client->executeScript("document.getElementById('showAdvanced').click()");
$client->waitForVisibility('#mysql');
$client->executeScript("document.getElementById('mysql').click()");

$client->submitForm('Terminer l\'installation', [
'adminlogin' => 'nextcloud',
'adminpass' => 'nextcloud',
'dbuser' => 'root',
'dbpass' => 'nextcloud',
'dbname' => 'nextcloud',
'dbhost' => 'database',
'dbtype' => 'mysql'
]);

$client = Client::createFirefoxClient();

$client->request('GET', 'http://next.cybercorp.fr/login');
$client->submitForm('submit-form', [
'user' => 'nextcloud',
'password' => 'nextcloud'
]);
sleep(5);
$client->executeScript("document.getElementById('firstrunwizard').getElementsByClassName('icon-close')[0].click()");
$client->request('GET', 'http://next.cybercorp.fr/settings/apps/organization');
$client->executeScript("var els = document.getElementsByClassName('app-name');for(var i = 0; i < els.length; i++){if(els[i].innerHTML.indexOf('Gestion') > -1){els[i].parentNode.getElementsByClassName('enable')[0].click()}}");
Binary file modified tests/Unit/Panther/screens/about.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/Unit/Panther/screens/config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/Unit/Panther/screens/devis.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/Unit/Panther/screens/facture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/Unit/Panther/screens/index.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/Unit/Panther/screens/produit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/Unit/Panther/screens/selectFolder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/Unit/Panther/screens/statistique.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading