Merge branch '9.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	.travis.yml
	htdocs/public/payment/newpayment.php
This commit is contained in:
Laurent Destailleur 2019-02-12 13:39:39 +01:00
commit 205152501e
8 changed files with 49 additions and 27 deletions

View File

@ -248,7 +248,7 @@ class BookKeeping extends CommonObject
// First check if line not yet already in bookkeeping. // 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 // 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. // 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. // The page to make journalization make the test on couple doc_type - fk_doc only.
$sql = "SELECT count(*) as nb"; $sql = "SELECT count(*) as nb";
@ -1700,11 +1700,11 @@ class BookKeeping extends CommonObject
$error++; $error++;
} }
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element.'(doc_date, doc_type,'; $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 .= ' numero_compte, label_compte, label_operation, debit, credit,';
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num)'; $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num)';
$sql .= 'SELECT doc_date, doc_type,'; $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 .= ' numero_compte, label_compte, label_operation, debit, credit,';
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.$next_piecenum.''; $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; $sql .= ' FROM '.MAIN_DB_PREFIX . $this->table_element.'_tmp WHERE piece_num = '.$piece_num;

View File

@ -352,7 +352,6 @@ if ($result)
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
print "\n"; print "\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -383,10 +382,7 @@ if ($result)
print '</td>'; print '</td>';
} }
if (! empty($conf->multicompany->enabled) && !$user->entity) print '<td></td>';
{
print '<td></td>';
}
// Actions // Actions
print '<td align="center">'; print '<td align="center">';
@ -416,7 +412,6 @@ else
dol_print_error($db); dol_print_error($db);
} }
print '</table>'; print '</table>';
print '</div>'; print '</div>';

View File

@ -613,12 +613,13 @@ class Utils
$FILENAMEASCII=strtolower($module).'.asciidoc'; $FILENAMEASCII=strtolower($module).'.asciidoc';
$FILENAMEDOC=strtolower($module).'.html'; // TODO Use/text PDF $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'; $dirofmoduletmp = dol_buildpath(strtolower($module), 0).'/doc/temp';
$outputfiledoc = $dirofmodule.'/'.$FILENAMEDOC; $outputfiledoc = $dirofmoduledoc.'/'.$FILENAMEDOC;
if ($dirofmodule) 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 (! dol_is_dir($dirofmoduletmp)) dol_mkdir($dirofmoduletmp);
if (! is_writable($dirofmoduletmp)) if (! is_writable($dirofmoduletmp))
{ {
@ -626,6 +627,13 @@ class Utils
return -1; 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; $destfile=$dirofmoduletmp.'/'.$FILENAMEASCII;
$fhandle = fopen($destfile, 'w+'); $fhandle = fopen($destfile, 'w+');
@ -637,6 +645,7 @@ class Utils
foreach ($specs as $spec) foreach ($specs as $spec)
{ {
if (preg_match('/notindoc/', $spec['relativename'])) continue; // Discard file 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 if (preg_match('/disabled/', $spec['relativename'])) continue; // Discard file
$pathtofile = strtolower($module).'/doc/'.$spec['relativename']; $pathtofile = strtolower($module).'/doc/'.$spec['relativename'];
@ -662,17 +671,26 @@ class Utils
// TODO // TODO
fwrite($fhandle, "TODO..."); fwrite($fhandle, "TODO...");
fwrite($fhandle, "\n\n\n== CHANGELOG...\n\n");
// TODO
fwrite($fhandle, "TODO...");
fclose($fhandle); fclose($fhandle);
} }
$conf->global->MODULEBUILDER_ASCIIDOCTOR='asciidoctor'; // Copy some files into temp directory
if (empty($conf->global->MODULEBUILDER_ASCIIDOCTOR)) dol_copy($dirofmodule.'/README.md', $dirofmoduletmp.'/README.md', 0, 1);
{ dol_copy($dirofmodule.'/ChangeLog.md', $dirofmoduletmp.'/ChangeLog.md', 0, 1);
dol_print_error('', 'Module setup not complete');
exit;
}
$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'; $outfile=$dirofmoduletmp.'/out.tmp';
require_once DOL_DOCUMENT_ROOT.'/core/class/utils.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/utils.class.php';
@ -683,6 +701,8 @@ class Utils
$this->error = $resarray['error'].' '.$resarray['output']; $this->error = $resarray['error'].' '.$resarray['output'];
} }
$result = ($resarray['result'] == 0) ? 1 : 0; $result = ($resarray['result'] == 0) ? 1 : 0;
chdir($currentdir);
} }
else else
{ {

View File

@ -67,7 +67,7 @@ class modProduct extends DolibarrModules
// Dependencies // Dependencies
$this->hidden = false; // A condition to hide module $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->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->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 $this->phpmin = array(5,4); // Minimum version of PHP required by module

View File

@ -100,3 +100,4 @@ UseAboutPage=Disable the about page
UseDocFolder=Disable the documentation folder UseDocFolder=Disable the documentation folder
UseSpecificReadme=Use a specific ReadMe UseSpecificReadme=Use a specific ReadMe
RealPathOfModule=Real path of module RealPathOfModule=Real path of module
ContentCantBeEmpty=Content of file can't be empty

View File

@ -94,6 +94,8 @@ if (empty($newmask)) // This should no happen
if ($dirins && $action == 'initmodule' && $modulename) if ($dirins && $action == 'initmodule' && $modulename)
{ {
$modulename = ucfirst($modulename); // Force first letter in uppercase
if (preg_match('/[^a-z0-9_]/i', $modulename)) if (preg_match('/[^a-z0-9_]/i', $modulename))
{ {
$error++; $error++;
@ -150,6 +152,7 @@ if ($dirins && $action == 'initmodule' && $modulename)
dol_delete_file($destdir.'/img/object_myobject.png'); dol_delete_file($destdir.'/img/object_myobject.png');
dol_delete_file($destdir.'/class/myobject.class.php'); dol_delete_file($destdir.'/class/myobject.class.php');
dol_delete_file($destdir.'/class/api_mymodule.class.php'); dol_delete_file($destdir.'/class/api_mymodule.class.php');
dol_delete_file($destdir.'/doc/*example*');
} }
// Edit PHP files // Edit PHP files
@ -1124,11 +1127,6 @@ elseif (! empty($module))
$head2[$h][2] = 'description'; $head2[$h][2] = 'description';
$h++; $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][0] = $_SERVER["PHP_SELF"].'?tab=languages&module='.$module.($forceddirread?'@'.$dirread:'');
$head2[$h][1] = $langs->trans("Languages"); $head2[$h][1] = $langs->trans("Languages");
$head2[$h][2] = 'languages'; $head2[$h][2] = 'languages';
@ -1169,6 +1167,11 @@ elseif (! empty($module))
$head2[$h][2] = 'cron'; $head2[$h][2] = 'cron';
$h++; $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][0] = $_SERVER["PHP_SELF"].'?tab=buildpackage&module='.$module.($forceddirread?'@'.$dirread:'');
$head2[$h][1] = $langs->trans("BuildPackage"); $head2[$h][1] = $langs->trans("BuildPackage");
$head2[$h][2] = 'buildpackage'; $head2[$h][2] = 'buildpackage';

View File

@ -8,7 +8,7 @@
This document describe specifications of module MyModule This document describe specifications of module MyModule
*Log of versions* *Log of versions of document*
[options="header",format="csv"] [options="header",format="csv"]
|=== |===
@ -24,3 +24,6 @@ This document was generated using Dolibarr ERP CRM process
<<< <<<
///include::README.md[]
///include::ChangeLog.md[]