Skip to content

Commit

Permalink
2.0.4 (#155)
Browse files Browse the repository at this point in the history
* refactoring

* refactoring

refactoring

refactoring & #46

Create help section for configuration and #47 #61

changelog

[tx-robot] updated from transifex

Signed-off-by: Nextcloud bot <bot@nextcloud.com>

[tx-robot] updated from transifex

Signed-off-by: Nextcloud bot <bot@nextcloud.com>

[tx-robot] updated from transifex

Signed-off-by: Nextcloud bot <bot@nextcloud.com>

[tx-robot] updated from transifex

Signed-off-by: Nextcloud bot <bot@nextcloud.com>

* transifex

* transifex

* test

* Translation

* translation

* hotfix

* #123

* Update lib/Migration/Version20002Date20220201085856.php

Co-authored-by: Vitor Mattos <vitor@php.rio>

* Update lib/Migration/Version20002Date20220201085856.php

Co-authored-by: Vitor Mattos <vitor@php.rio>

* Update lib/Migration/Version7Date20220125174818.php

Co-authored-by: Vitor Mattos <vitor@php.rio>

* Update lib/Migration/Version7Date20220125174818.php

Co-authored-by: Vitor Mattos <vitor@php.rio>

* Update lib/Migration/Version7Date20220125174818.php

Co-authored-by: Vitor Mattos <vitor@php.rio>

* #135

* Update lib/Migration/Version20002Date20220201085856.php

Co-authored-by: Vitor Mattos <vitor@php.rio>

* valide

* valide

* final

* Final

* Final

* Update lib/Migration/Version20002Date20220201085856.php

Co-authored-by: Vitor Mattos <vitor@php.rio>

* Update lib/Migration/Version20002Date20220201085856.php

Co-authored-by: Vitor Mattos <vitor@php.rio>

* Update lib/Migration/Version7Date20220125174818.php

Co-authored-by: Vitor Mattos <vitor@php.rio>

* Update lib/Migration/Version7Date20220125174818.php

Co-authored-by: Vitor Mattos <vitor@php.rio>

* Update lib/Migration/Version7Date20220125174818.php

Co-authored-by: Vitor Mattos <vitor@php.rio>

* [tx-robot] updated from transifex

Signed-off-by: Nextcloud bot <bot@nextcloud.com>

* l10n: Fixed grammar

Reported at Transifex.

Signed-off-by: rakekniven <2069590+rakekniven@users.noreply.github.com>

* l10n: Improve styling

A more selected description of the function setting.

* l10n: Improve styling 

A more selected description of the function setting.

* l10n: Add "an"

* l10n: Add "an"

* l10n: Replace a word

* l10n: Replace a word

* [tx-robot] updated from transifex

Signed-off-by: Nextcloud bot <bot@nextcloud.com>

* Update lib/Migration/Version20002Date20220201085856.php

Co-authored-by: Vitor Mattos <vitor@php.rio>

* valide

* valide

* final

* Final

* Final

* Hotfix 2.0.2

* Hotfix 2.0.3

* enhancement tests !

* #143

Co-authored-by: Vitor Mattos <vitor@php.rio>
Co-authored-by: Nextcloud bot <bot@nextcloud.com>
Co-authored-by: rakekniven <2069590+rakekniven@users.noreply.github.com>
Co-authored-by: Valdnet <47037905+Valdnet@users.noreply.github.com>
  • Loading branch information
5 people authored Feb 12, 2022
1 parent c2841a4 commit 2e90568
Show file tree
Hide file tree
Showing 36 changed files with 385,993 additions and 1,005 deletions.
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

0 comments on commit 2e90568

Please sign in to comment.