From da361f0ea5100086ef1f79b8cf3e313c5d3a732b Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 8 Feb 2019 12:24:07 +0100 Subject: [PATCH 1/8] Fix wrong column name in purchase journal --- htdocs/accountancy/journal/purchasesjournal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index caaf0b24d37..7c5a567cbf2 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -93,7 +93,7 @@ if (! GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end) $idpays = $mysoc->country_id; -$sql = "SELECT f.rowid, f.facnumber as ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, f.close_code,"; +$sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, f.close_code,"; $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,"; $sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; $sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte"; From a9167080685c9f8c122dae64b99f64bbb88750a2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Feb 2019 19:01:47 +0100 Subject: [PATCH 2/8] Fix missing disable dependency --- htdocs/core/modules/modProduct.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 05215f8aea8..b725ef878a3 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -67,7 +67,7 @@ class modProduct extends DolibarrModules // Dependencies $this->hidden = false; // A condition to hide module $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled - $this->requiredby = array("modStock","modBarcode","modProductBatch"); // List of module ids to disable if this one is disabled + $this->requiredby = array("modStock","modBarcode","modProductBatch","modVariants"); // List of module ids to disable if this one is disabled $this->conflictwith = array(); // List of module class names as string this module is in conflict with $this->phpmin = array(5,4); // Minimum version of PHP required by module From 7f4bbcf9a50775aecc66b4358eaf6d9af9a696b7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 9 Feb 2019 13:40:22 +0100 Subject: [PATCH 3/8] Some minor fix in default values and modulebuilder --- htdocs/admin/defaultvalues.php | 7 +------ htdocs/langs/en_US/modulebuilder.lang | 1 + htdocs/modulebuilder/index.php | 3 +++ ...oc.asciidoc => Specifications_full_en.example.asciidoc} | 0 4 files changed, 5 insertions(+), 6 deletions(-) rename htdocs/modulebuilder/template/doc/{Specifications_full_en.notindoc.asciidoc => Specifications_full_en.example.asciidoc} (100%) diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index dcd6548b498..32fc475e638 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -352,7 +352,6 @@ if ($result) { $obj = $db->fetch_object($result); - print "\n"; print ''; @@ -383,10 +382,7 @@ if ($result) print ''; } - if (! empty($conf->multicompany->enabled) && !$user->entity) - { - print ''; - } + print ''; // Actions print ''; @@ -416,7 +412,6 @@ else dol_print_error($db); } - print ''; print ''; diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index f8d4669b8e5..765edad6687 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -100,3 +100,4 @@ UseAboutPage=Disable the about page UseDocFolder=Disable the documentation folder UseSpecificReadme=Use a specific ReadMe RealPathOfModule=Real path of module +ContentCantBeEmpty=Content of file can't be empty \ No newline at end of file diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 24596255043..869e5cbe965 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -94,6 +94,8 @@ if (empty($newmask)) // This should no happen if ($dirins && $action == 'initmodule' && $modulename) { + $modulename = ucfirst($modulename); // Force first letter in uppercase + if (preg_match('/[^a-z0-9_]/i', $modulename)) { $error++; @@ -150,6 +152,7 @@ if ($dirins && $action == 'initmodule' && $modulename) dol_delete_file($destdir.'/img/object_myobject.png'); dol_delete_file($destdir.'/class/myobject.class.php'); dol_delete_file($destdir.'/class/api_mymodule.class.php'); + dol_delete_file($destdir.'/doc/*example*'); } // Edit PHP files diff --git a/htdocs/modulebuilder/template/doc/Specifications_full_en.notindoc.asciidoc b/htdocs/modulebuilder/template/doc/Specifications_full_en.example.asciidoc similarity index 100% rename from htdocs/modulebuilder/template/doc/Specifications_full_en.notindoc.asciidoc rename to htdocs/modulebuilder/template/doc/Specifications_full_en.example.asciidoc From 2d4ccec309fcb2a761a5c891ecb08d8b8918f842 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 9 Feb 2019 14:12:36 +0100 Subject: [PATCH 4/8] Fix document generation of modulebuilder --- htdocs/core/class/utils.class.php | 42 ++++++++++++++----- htdocs/modulebuilder/index.php | 10 ++--- .../template/doc/Specifications.asciidoc | 5 ++- 3 files changed, 40 insertions(+), 17 deletions(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 9061539a804..8c051c85b33 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -613,12 +613,13 @@ class Utils $FILENAMEASCII=strtolower($module).'.asciidoc'; $FILENAMEDOC=strtolower($module).'.html'; // TODO Use/text PDF - $dirofmodule = dol_buildpath(strtolower($module), 0).'/doc'; + $dirofmodule = dol_buildpath(strtolower($module), 0); + $dirofmoduledoc = dol_buildpath(strtolower($module), 0).'/doc'; $dirofmoduletmp = dol_buildpath(strtolower($module), 0).'/doc/temp'; - $outputfiledoc = $dirofmodule.'/'.$FILENAMEDOC; - if ($dirofmodule) + $outputfiledoc = $dirofmoduledoc.'/'.$FILENAMEDOC; + if ($dirofmoduledoc) { - if (! dol_is_dir($dirofmodule)) dol_mkdir($dirofmodule); + if (! dol_is_dir($dirofmoduledoc)) dol_mkdir($dirofmoduledoc); if (! dol_is_dir($dirofmoduletmp)) dol_mkdir($dirofmoduletmp); if (! is_writable($dirofmoduletmp)) { @@ -626,6 +627,13 @@ class Utils return -1; } + $conf->global->MODULEBUILDER_ASCIIDOCTOR='asciidoctor'; + if (empty($conf->global->MODULEBUILDER_ASCIIDOCTOR)) + { + $this->error = 'Setup of module ModuleBuilder not complete'; + return -1; + } + $destfile=$dirofmoduletmp.'/'.$FILENAMEASCII; $fhandle = fopen($destfile, 'w+'); @@ -637,6 +645,7 @@ class Utils foreach ($specs as $spec) { if (preg_match('/notindoc/', $spec['relativename'])) continue; // Discard file + if (preg_match('/example/', $spec['relativename'])) continue; // Discard file if (preg_match('/disabled/', $spec['relativename'])) continue; // Discard file $pathtofile = strtolower($module).'/doc/'.$spec['relativename']; @@ -662,17 +671,26 @@ class Utils // TODO fwrite($fhandle, "TODO..."); + + fwrite($fhandle, "\n\n\n== CHANGELOG...\n\n"); + + // TODO + fwrite($fhandle, "TODO..."); + + + fclose($fhandle); } - $conf->global->MODULEBUILDER_ASCIIDOCTOR='asciidoctor'; - if (empty($conf->global->MODULEBUILDER_ASCIIDOCTOR)) - { - dol_print_error('', 'Module setup not complete'); - exit; - } + // Copy some files into temp directory + dol_copy($dirofmodule.'/README.md', $dirofmoduletmp.'/README.md', 0, 1); + dol_copy($dirofmodule.'/ChangeLog.md', $dirofmoduletmp.'/ChangeLog.md', 0, 1); - $command=$conf->global->MODULEBUILDER_ASCIIDOCTOR.' '.$destfile.' -n -o '.$dirofmodule.'/'.$FILENAMEDOC; + // Launch doc generation + $currentdir = getcwd(); + chdir($dirofmodule); + + $command=$conf->global->MODULEBUILDER_ASCIIDOCTOR.' '.$destfile.' -n -o '.$dirofmoduledoc.'/'.$FILENAMEDOC; $outfile=$dirofmoduletmp.'/out.tmp'; require_once DOL_DOCUMENT_ROOT.'/core/class/utils.class.php'; @@ -683,6 +701,8 @@ class Utils $this->error = $resarray['error'].' '.$resarray['output']; } $result = ($resarray['result'] == 0) ? 1 : 0; + + chdir($currentdir); } else { diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 869e5cbe965..10c2d44c82c 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1127,11 +1127,6 @@ elseif (! empty($module)) $head2[$h][2] = 'description'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=specifications&module='.$module.($forceddirread?'@'.$dirread:''); - $head2[$h][1] = $langs->trans("Specifications"); - $head2[$h][2] = 'specifications'; - $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=languages&module='.$module.($forceddirread?'@'.$dirread:''); $head2[$h][1] = $langs->trans("Languages"); $head2[$h][2] = 'languages'; @@ -1172,6 +1167,11 @@ elseif (! empty($module)) $head2[$h][2] = 'cron'; $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=specifications&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][1] = $langs->trans("Documentation"); + $head2[$h][2] = 'specifications'; + $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=buildpackage&module='.$module.($forceddirread?'@'.$dirread:''); $head2[$h][1] = $langs->trans("BuildPackage"); $head2[$h][2] = 'buildpackage'; diff --git a/htdocs/modulebuilder/template/doc/Specifications.asciidoc b/htdocs/modulebuilder/template/doc/Specifications.asciidoc index 4610cb188f9..be8316c8cda 100644 --- a/htdocs/modulebuilder/template/doc/Specifications.asciidoc +++ b/htdocs/modulebuilder/template/doc/Specifications.asciidoc @@ -8,7 +8,7 @@ This document describe specifications of module MyModule -*Log of versions* +*Log of versions of document* [options="header",format="csv"] |=== @@ -24,3 +24,6 @@ This document was generated using Dolibarr ERP CRM process <<< +///include::README.md[] + +///include::ChangeLog.md[] From 2dc4edb68c5b7995a3423abddde313b4a99d18ac Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 11 Feb 2019 11:36:12 +0100 Subject: [PATCH 5/8] FIX: Accountancy - Add transaction with multicompany use all the time 1st entity --- htdocs/accountancy/class/bookkeeping.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 0ad91a30f56..10ec82a4f3b 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -195,7 +195,7 @@ class BookKeeping extends CommonObject // First check if line not yet already in bookkeeping. // Note that we must include doc_type - fk_doc - numero_compte - label to be sure to have unicity of line (we may have several lines - // with same doc_type, fk_odc, numero_compte for 1 invoice line when using localtaxes with same account) + // with same doc_type, fk_doc, numero_compte for 1 invoice line when using localtaxes with same account) // WARNING: This is not reliable, label may have been modified. This is just a small protection. // The page to make journalization make the test on couple doc_type - fk_doc only. $sql = "SELECT count(*) as nb"; @@ -1618,11 +1618,11 @@ class BookKeeping extends CommonObject $error++; } $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element.'(doc_date, doc_type,'; - $sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,'; + $sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,'; $sql .= ' numero_compte, label_compte, label_operation, debit, credit,'; $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num)'; $sql .= 'SELECT doc_date, doc_type,'; - $sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,'; + $sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,'; $sql .= ' numero_compte, label_compte, label_operation, debit, credit,'; $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.$next_piecenum.''; $sql .= ' FROM '.MAIN_DB_PREFIX . $this->table_element.'_tmp WHERE piece_num = '.$piece_num; From 930bd13664e8c6289dd7a02fd56d084d00533ca7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Feb 2019 21:22:48 +0100 Subject: [PATCH 6/8] Merge --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9539d08b231..5585718a744 100644 --- a/.travis.yml +++ b/.travis.yml @@ -298,7 +298,7 @@ script: # Ensure we catch errors set -e #parallel-lint --exclude htdocs/includes --blame . - parallel-lint --exclude htdocs/includes/sabre --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame . + parallel-lint --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame . set +e echo From f288ba466ff758a246e641a0dfd6a69b87502afa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Feb 2019 21:22:48 +0100 Subject: [PATCH 7/8] Fix non need to exclude From 456a76cb11ca56570fad33f887de30adc4d99614 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Feb 2019 01:11:37 +0100 Subject: [PATCH 8/8] Fix suffix --- htdocs/public/payment/newpayment.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 39d21ebbc0c..ca78ef8c71e 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -665,7 +665,7 @@ print '
'."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''; print ''; @@ -1877,7 +1877,7 @@ if (preg_match('/^dopayment/',$action)) } -htmlPrintOnlinePaymentFooter($mysoc,$langs,1,$suffix,$object); +htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); llxFooter('', 'public');