Skip to content

Commit

Permalink
Merge pull request #76 from frederic34/dev
Browse files Browse the repository at this point in the history
wip
  • Loading branch information
frederic34 authored Dec 19, 2024
2 parents 39c6c24 + 3f2810e commit 17d0a98
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 27 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ For more information, see the [translator's documentation](https://wiki.dolibarr
There is a [Transifex project](https://transifex.com/projects/p/dolibarr-module-template) for this module.
-->


## Installation

Prerequisites: You must have the Dolibarr ERP CRM software installed. You can down it from [Dolistore.org](https://www.dolibarr.org).
You can also get a ready to use instance in the cloud from htts://saas.dolibarr.org


### From the ZIP file and GUI interface

If the module is a ready to deploy zip file, so with a name module_xxx-version.zip (like when downloading it from a market place like [Dolistore](https://www.dolistore.com)),
Expand Down
10 changes: 5 additions & 5 deletions core/modules/bom/doc/doc_easydoc_bom_html.modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ public function __construct($db)

// Page size for A4 format
$this->type = 'pdf';
$this->page_largeur = 0;
$this->page_hauteur = 0;
$this->page_largeur = 210;
$this->page_hauteur = 297;
$this->format = [$this->page_largeur, $this->page_hauteur];
$this->marge_gauche = 0;
$this->marge_gauche = getDolGlobalInt('EASYDOC_PDF_MARGIN_LEFT', 10);
$this->marge_droite = 0;
$this->marge_haute = 0;
$this->marge_basse = 0;
Expand Down Expand Up @@ -507,8 +507,8 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
}
// print $html;
$mpdf = new \Mpdf\Mpdf([
'format' => [210, 297],
'margin_left' => getDolGlobalInt('EASYDOC_PDF_MARGIN_LEFT', 10),
'format' => $this->format,
'margin_left' => $this->marge_gauche,
'margin_right' => getDolGlobalInt('EASYDOC_PDF_MARGIN_RIGHT', 10),
'margin_top' => getDolGlobalInt('EASYDOC_PDF_MARGIN_TOP', 48),
'margin_bottom' => getDolGlobalInt('EASYDOC_PDF_MARGIN_BOTTOM', 25),
Expand Down
22 changes: 11 additions & 11 deletions core/modules/contract/doc/doc_easydoc_contract_html.modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ public function __construct($db)

// Page size for A4 format
$this->type = 'pdf';
$this->page_largeur = 0;
$this->page_hauteur = 0;
$this->page_largeur = 210;
$this->page_hauteur = 297;
$this->format = [$this->page_largeur, $this->page_hauteur];
$this->marge_gauche = 0;
$this->marge_droite = 0;
$this->marge_haute = 0;
$this->marge_basse = 0;
$this->marge_gauche = getDolGlobalInt('EASYDOC_PDF_MARGIN_LEFT', 10);
$this->marge_droite = getDolGlobalInt('EASYDOC_PDF_MARGIN_RIGHT', 10);
$this->marge_haute = getDolGlobalInt('EASYDOC_PDF_MARGIN_TOP', 48);
$this->marge_basse = getDolGlobalInt('EASYDOC_PDF_MARGIN_BOTTOM', 48);

$this->option_logo = 1; // Display logo
$this->option_tva = 0; // Manage the vat option COMMANDE_TVAOPTION
Expand Down Expand Up @@ -504,11 +504,11 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
}
// print $html;
$mpdf = new \Mpdf\Mpdf([
'format' => [210, 297],
'margin_left' => getDolGlobalInt('EASYDOC_PDF_MARGIN_LEFT', 10),
'margin_right' => getDolGlobalInt('EASYDOC_PDF_MARGIN_RIGHT', 10),
'margin_top' => getDolGlobalInt('EASYDOC_PDF_MARGIN_TOP', 48),
'margin_bottom' => getDolGlobalInt('EASYDOC_PDF_MARGIN_BOTTOM', 25),
'format' => $this->format,
'margin_left' => $this->marge_gauche,
'margin_right' => $this->marge_droite,
'margin_top' => $this->marge_haute,
'margin_bottom' => $this->marge_basse,
'margin_header' => getDolGlobalInt('EASYDOC_PDF_MARGIN_HEADER', 10),
'margin_footer' => getDolGlobalInt('EASYDOC_PDF_MARGIN_FOOTER', 10),
]);
Expand Down
12 changes: 6 additions & 6 deletions core/modules/stock/doc/doc_easydoc_stock_html.modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ public function info($langs)
$text .= '<input type="hidden" name="token" value="' . newToken() . '">';
$text .= '<input type="hidden" name="page_y" value="">';
$text .= '<input type="hidden" name="action" value="setModuleOptions">';
$text .= '<input type="hidden" name="param1" value="STOCK_ADDON_EASYDOC_TEMPLATES_PATH">';
$text .= '<input type="hidden" name="param1" value="' . $this->scandir . '">';
$text .= '<table class="nobordernopadding" width="100%">';

// List of directories area
$text .= '<tr><td>';
$texttitle = $langs->trans("ListOfDirectoriesForHtmlTemplates");
$listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim(getDolGlobalString('STOCK_ADDON_EASYDOC_TEMPLATES_PATH'))));
$listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim(getDolGlobalString($this->scandir))));
$listoffiles = [];
foreach ($listofdir as $key => $tmpdir) {
$tmpdir = trim($tmpdir);
Expand All @@ -153,15 +153,15 @@ public function info($langs)
$text .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
$text .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$text .= '<textarea class="flat" cols="60" name="value1">';
$text .= getDolGlobalString('STOCK_ADDON_EASYDOC_TEMPLATES_PATH');
$text .= getDolGlobalString($this->scandir);
$text .= '</textarea>';
$text .= '</div><div style="display: inline-block; vertical-align: middle;">';
$text .= '<input type="submit" class="button button-edit reposition smallpaddingimp" name="modify" value="' . dol_escape_htmltag($langs->trans("Modify")) . '">';
$text .= '<br></div></div>';

// Scan directories
$nbofiles = count($listoffiles);
if (getDolGlobalString('STOCK_ADDON_EASYDOC_TEMPLATES_PATH')) {
if (getDolGlobalString($this->scandir)) {
$text .= $langs->trans("NumberOfModelHTMLFilesFound") . ': <b>';
//$text.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':'';
$text .= count($listoffiles);
Expand All @@ -174,7 +174,7 @@ public function info($langs)
// Show list of found files
foreach ($listoffiles as $file) {
$text .= '- ' . $file['name'] . ' <a href="' . DOL_URL_ROOT . '/document.php?modulepart=doctemplates&file=stocks/' . urlencode(basename($file['name'])) . '">' . img_picto('', 'listlight') . '</a>';
$text .= ' &nbsp; <a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?modulepart=doctemplates&keyforuploaddir=STOCK_ADDON_EASYDOC_TEMPLATES_PATH&action=deletefile&token=' . newToken() . '&file=' . urlencode(basename($file['name'])) . '">' . img_picto('', 'delete') . '</a>';
$text .= ' &nbsp; <a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?modulepart=doctemplates&keyforuploaddir=' . $this->scandir . '&action=deletefile&token=' . newToken() . '&file=' . urlencode(basename($file['name'])) . '">' . img_picto('', 'delete') . '</a>';
$text .= '<br>';
}
$text .= '</div>';
Expand All @@ -188,7 +188,7 @@ public function info($langs)
$text .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">';
}
$text .= ' <input type="file" name="uploadfile">';
$text .= '<input type="hidden" value="STOCK_ADDON_EASYDOC_TEMPLATES_PATH" name="keyforuploaddir">';
$text .= '<input type="hidden" value="' . $this->scandir . '" name="keyforuploaddir">';
$text .= '<input type="submit" class="button reposition smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("Upload")) . '" name="upload">';
$text .= '</div>';

Expand Down
6 changes: 3 additions & 3 deletions core/modules/ticket/doc/doc_easydoc_ticket_html.modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function __construct($db)
$langs->loadLangs(['main', 'companies', 'easydocgenerator@easydocgenerator']);

$this->db = $db;
$this->name = "Easydoc templates";
$this->name = "Easydoc tickets templates";
$this->description = $langs->trans("DocumentModelEasydocgeneratorTemplate");
// Name of constant that is used to save list of directories to scan
$this->scandir = 'TICKET_ADDON_EASYDOC_TEMPLATES_PATH';
Expand Down Expand Up @@ -120,7 +120,7 @@ public function info($langs)
$text .= '<input type="hidden" name="token" value="' . newToken() . '">';
$text .= '<input type="hidden" name="page_y" value="">';
$text .= '<input type="hidden" name="action" value="setModuleOptions">';
$text .= '<input type="hidden" name="param1" value="TICKET_ADDON_EASYDOC_TEMPLATES_PATH">';
$text .= '<input type="hidden" name="param1" value="' . $this->scandir . '">';
$text .= '<table class="nobordernopadding" width="100%">';

// List of directories area
Expand Down Expand Up @@ -174,7 +174,7 @@ public function info($langs)
// Show list of found files
foreach ($listoffiles as $file) {
$text .= '- ' . $file['name'] . ' <a href="' . DOL_URL_ROOT . '/document.php?modulepart=doctemplates&file=tickets/' . urlencode(basename($file['name'])) . '">' . img_picto('', 'listlight') . '</a>';
$text .= ' &nbsp; <a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?modulepart=doctemplates&keyforuploaddir=TICKET_ADDON_EASYDOC_TEMPLATES_PATH&action=deletefile&token=' . newToken() . '&file=' . urlencode(basename($file['name'])) . '">' . img_picto('', 'delete') . '</a>';
$text .= ' &nbsp; <a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?modulepart=doctemplates&keyforuploaddir=' . $this->scandir . '&action=deletefile&token=' . newToken() . '&file=' . urlencode(basename($file['name'])) . '">' . img_picto('', 'delete') . '</a>';
$text .= '<br>';
}
$text .= '</div>';
Expand Down

0 comments on commit 17d0a98

Please sign in to comment.