From 856b83a202578f74aa4fd29e695d25a80cf0aa70 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Feb 2022 09:26:03 +0100 Subject: [PATCH 1/2] CSS --- htdocs/core/class/html.formwebsite.class.php | 5 +++-- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 2 +- htdocs/website/index.php | 22 ++++++++++---------- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/htdocs/core/class/html.formwebsite.class.php b/htdocs/core/class/html.formwebsite.class.php index 4210113f990..a4db07f95c0 100644 --- a/htdocs/core/class/html.formwebsite.class.php +++ b/htdocs/core/class/html.formwebsite.class.php @@ -104,9 +104,10 @@ class FormWebsite * @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. * @param string $moreattrib More attributes on HTML select tag * @param int $addjscombo Add js combo + * @param string $morecss More CSS * @return void */ - public function selectTypeOfContainer($htmlname, $selected = '', $useempty = 0, $moreattrib = '', $addjscombo = 0) + public function selectTypeOfContainer($htmlname, $selected = '', $useempty = 0, $moreattrib = '', $addjscombo = 0, $morecss = 'minwidth200') { global $langs, $conf, $user; @@ -123,7 +124,7 @@ class FormWebsite $num = $this->db->num_rows($result); $i = 0; if ($num) { - print ''; if ($useempty == 1 || ($useempty == 2 && $num > 1)) { print ''; } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 8c315b7badf..f25efc97168 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -4953,7 +4953,7 @@ tr.visible { .websiteformtoolbar { position: sticky; - top: ; + top: ; } .exampleapachesetup { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 6b1cd6cfd0a..a207e128cc1 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -4883,7 +4883,7 @@ tr.visible { .websiteformtoolbar { position: sticky; - top: ; + top: ; } .exampleapachesetup { diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 33f3c89f32e..610607f0321 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3181,7 +3181,7 @@ if (!GETPOST('hide_websitemenu')) { field: \'editval_virtualhost\', element: \'website\', table_element: \'website\', - fk_element: '.$object->id.', + fk_element: '.((int) $object->id).', value: newurl, }, context: document.body @@ -4144,9 +4144,9 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction = print $langs->trans("SearchReplaceInto"); print ''; print '
'; - print '
'; - print '
'; - print '
'; + print '
'; + print '
'; + print '
'; print '
'; print ''; @@ -4166,32 +4166,32 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction = print '
'; print '
'; - print '
'; + print '
'; print $langs->trans("WEBSITE_TYPE_CONTAINER"); print '
'; print '
'; print img_picto('', 'object_technic', 'class="paddingrightonly"').' '; - $formwebsite->selectTypeOfContainer('optioncontainertype', (GETPOST('optioncontainertype', 'alpha') ? GETPOST('optioncontainertype', 'alpha') : ''), 1); + $formwebsite->selectTypeOfContainer('optioncontainertype', (GETPOST('optioncontainertype', 'alpha') ? GETPOST('optioncontainertype', 'alpha') : ''), 1, '', 1, 'minwidth125 maxwidth400 widthcentpercentminusx'); print '
'; print '
'; print '
'; - print '
'; + print '
'; print $langs->trans("Language"); print '
'; print '
'; - print img_picto('', 'language', 'class="paddingrightonly"').' '.$formadmin->select_language(GETPOSTISSET('optionlanguage') ? GETPOST('optionlanguage') : '', 'optionlanguage', 0, null, '1', 0, 0, 'minwidth300', 2, 0, 0, null, 1); + print img_picto('', 'language', 'class="paddingrightonly"').' '.$formadmin->select_language(GETPOSTISSET('optionlanguage') ? GETPOST('optionlanguage') : '', 'optionlanguage', 0, null, '1', 0, 0, 'minwidth125 maxwidth400 widthcentpercentminusx', 2, 0, 0, null, 1); print '
'; print '
'; // Categories if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { print '
'; - print '
'; + print '
'; print $langs->trans("Category"); print '
'; print '
'; - print img_picto('', 'category', 'class="paddingrightonly"').' '.$form->select_all_categories(Categorie::TYPE_WEBSITE_PAGE, GETPOSTISSET('optioncategory') ? GETPOST('optioncategory') : '', 'optioncategory', null, null); + print img_picto('', 'category', 'class="paddingrightonly"').' '.$form->select_all_categories(Categorie::TYPE_WEBSITE_PAGE, GETPOSTISSET('optioncategory') ? GETPOST('optioncategory') : '', 'optioncategory', 0, 0, 0, 0, 'minwidth125 maxwidth400 widthcentpercentminusx'); include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; print ajax_combobox('optioncategory'); print '
'; @@ -4200,7 +4200,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction = print '
'; - print ''; + print ''; print '
'; From e8acb551f9b33ea709acc34c2bf16b23cf91f06f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Feb 2022 09:50:07 +0100 Subject: [PATCH 2/2] Fix section of attached files for salaries --- htdocs/core/class/html.formfile.class.php | 4 +- .../modulebuilder/template/myobject_card.php | 4 +- htdocs/salaries/card.php | 70 ++++++++++++++++++- 3 files changed, 72 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 296ef7eb251..bfbe8366139 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -359,7 +359,7 @@ class FormFile * Return a string to show the box with list of available documents for object. * This also set the property $this->numoffiles * - * @param string $modulepart Module the files are related to ('propal', 'facture', 'facture_fourn', 'mymodule', 'mymodule:myobject', 'mymodule_temp', ...) + * @param string $modulepart Module the files are related to ('propal', 'facture', 'facture_fourn', 'mymodule', 'mymodule:MyObject', 'mymodule_temp', ...) * @param string $modulesubdir Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module. * @param string $filedir Directory to scan * @param string $urlsource Url of origin page (for return) @@ -719,7 +719,7 @@ class FormFile if (class_exists($class)) { $modellist = call_user_func($class.'::liste_modeles', $this->db); } else { - dol_print_error($this->db, "Bad value for modulepart '".$modulepart."' in showdocuments"); + dol_print_error($this->db, "Bad value for modulepart '".$modulepart."' in showdocuments (class ".$class." for Doc generation not found)"); return -1; } } diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index a493508878c..180ece04fa8 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -548,8 +548,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $relativepath = $objref.'/'.$objref.'.pdf'; $filedir = $conf->mymodule->dir_output.'/'.$object->element.'/'.$objref; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = $user->rights->mymodule->myobject->read; // If you can read, you can build the PDF to read content - $delallowed = $user->rights->mymodule->myobject->write; // If you can create/edit, you can remove a file on card + $genallowed = $permissiontoread; // If you can read, you can build the PDF to read content + $delallowed = $permissiontoadd; // If you can create/edit, you can remove a file on card print $formfile->showdocuments('mymodule:MyObject', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); } diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 689a2664c0a..935b8deb83d 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/salaries.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; if (!empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; @@ -103,6 +104,10 @@ if ($user->socid) { restrictedArea($user, 'salaries', $object->id, 'salary', ''); +$permissiontoread = $user->rights->salaries->read; +$permissiontoadd = $user->rights->salaries->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontodelete = $user->rights->salaries->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); + /** * Actions @@ -434,12 +439,14 @@ if ($action == "update_extras" && !empty($user->rights->salaries->read)) { * View */ +$form = new Form($db); +$formfile = new FormFile($db); +if (!empty($conf->projet->enabled)) $formproject = new FormProjets($db); + $title = $langs->trans('Salary')." - ".$langs->trans('Card'); $help_url = ""; llxHeader("", $title, $help_url); -$form = new Form($db); -if (!empty($conf->projet->enabled)) $formproject = new FormProjets($db); if ($id > 0) { $result = $object->fetch($id); @@ -1013,6 +1020,7 @@ if ($id) { $resteapayer = price2num($resteapayer, 'MT'); + /* * Action bar */ @@ -1052,6 +1060,64 @@ if ($id) { } } print "
"; + + + + // Select mail models is same action as presend + if (GETPOST('modelselected')) { + $action = 'presend'; + } + + if ($action != 'presend') { + print '
'; + print ''; // ancre + + $includedocgeneration = 1; + + // Documents + if ($includedocgeneration) { + $objref = dol_sanitizeFileName($object->ref); + $relativepath = $objref.'/'.$objref.'.pdf'; + $filedir = $conf->salaries->dir_output.'/'.$objref; + $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; + //$genallowed = $permissiontoread; // If you can read, you can build the PDF to read content + $genallowed = 0; // If you can read, you can build the PDF to read content + $delallowed = $permissiontoadd; // If you can create/edit, you can remove a file on card + print $formfile->showdocuments('salaries', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); + } + + // Show links to link elements + /* + $linktoelem = $form->showLinkToObjectBlock($object, null, array('salaries')); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + */ + + print '
'; + + $MAXEVENT = 10; + + $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id); + + // List of actions on element + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + //$somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); + + print '
'; + } + + //Select mail models is same action as presend + if (GETPOST('modelselected')) { + $action = 'presend'; + } + + // Presend form + $modelmail = 'salary'; + $defaulttopic = 'InformationMessage'; + $diroutput = $conf->salaries->dir_output; + $trackid = 'salary'.$object->id; + + include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; } // End of page