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

This commit is contained in:
Laurent Destailleur 2022-02-07 10:07:30 +01:00
commit 19fdf3dc18
7 changed files with 88 additions and 21 deletions

View File

@ -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)
@ -720,7 +720,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;
}
}

View File

@ -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 '<select id="select'.$htmlname.'" class="flat selectTypeOfContainer minwidth200" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
print '<select id="select'.$htmlname.'" class="flat selectTypeOfContainer'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
print '<option value="-1">&nbsp;</option>';
}

View File

@ -558,8 +558,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);
}

View File

@ -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);
@ -1027,6 +1034,7 @@ if ($id) {
$resteapayer = price2num($resteapayer, 'MT');
/*
* Action bar
*/
@ -1066,6 +1074,64 @@ if ($id) {
}
}
print "</div>";
// Select mail models is same action as presend
if (GETPOST('modelselected')) {
$action = 'presend';
}
if ($action != 'presend') {
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // 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 '</div><div class="fichehalfright">';
$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 '</div></div>';
}
//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

View File

@ -4953,7 +4953,7 @@ tr.visible {
.websiteformtoolbar {
position: sticky;
top: <?php echo $disableimages ? '32px' : '52px'; ?>;
top: <?php echo empty($dol_hide_topmenu) ? ($disableimages ? '32px' : '52px') : '0'; ?>;
}
.exampleapachesetup {

View File

@ -4894,7 +4894,7 @@ tr.visible {
.websiteformtoolbar {
position: sticky;
top: <?php echo $disableimages ? '36px' : '50px'; ?>;
top: <?php echo empty($dol_hide_topmenu) ? ($disableimages ? '36px' : '50px') : '0'; ?>;
}
.exampleapachesetup {

View File

@ -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 '</div>';
print '<div class="tagtd">';
print '<input type="checkbox" class="marginleftonly" id="checkboxoptioncontent" name="optioncontent" value="content"'.((!GETPOSTISSET('buttonreplacesitesearch') || GETPOST('optioncontent', 'aZ09')) ? ' checked' : '').'> <label for="checkboxoptioncontent">'.$langs->trans("Content").'</label><br>';
print '<input type="checkbox" class="marginleftonly" id="checkboxoptionmeta" name="optionmeta" value="meta"'.(GETPOST('optionmeta', 'aZ09') ? ' checked' : '').'> <label for="checkboxoptionmeta">'.$langs->trans("Title").' | '.$langs->trans("Description").' | '.$langs->trans("Keywords").'</label><br>';
print '<input type="checkbox" class="marginleftonly" id="checkboxoptionsitefiles" name="optionsitefiles" value="sitefiles"'.(GETPOST('optionsitefiles', 'aZ09') ? ' checked' : '').'> <label for="checkboxoptionsitefiles">'.$langs->trans("GlobalCSSorJS").'</label><br>';
print '<input type="checkbox" class="marginleftonly" id="checkboxoptioncontent" name="optioncontent" value="content"'.((!GETPOSTISSET('buttonreplacesitesearch') || GETPOST('optioncontent', 'aZ09')) ? ' checked' : '').'> <label for="checkboxoptioncontent" class="tdoverflowmax150onsmartphone inline-block valignmiddle">'.$langs->trans("Content").'</label><br>';
print '<input type="checkbox" class="marginleftonly" id="checkboxoptionmeta" name="optionmeta" value="meta"'.(GETPOST('optionmeta', 'aZ09') ? ' checked' : '').'> <label for="checkboxoptionmeta" class="tdoverflowmax150onsmartphone inline-block valignmiddle">'.$langs->trans("Title").' | '.$langs->trans("Description").' | '.$langs->trans("Keywords").'</label><br>';
print '<input type="checkbox" class="marginleftonly" id="checkboxoptionsitefiles" name="optionsitefiles" value="sitefiles"'.(GETPOST('optionsitefiles', 'aZ09') ? ' checked' : '').'> <label for="checkboxoptionsitefiles" class="tdoverflowmax150onsmartphone inline-block valignmiddle">'.$langs->trans("GlobalCSSorJS").'</label><br>';
print '</div>';
print '</div>';
@ -4166,32 +4166,32 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction =
print '<div class="tagtable">';
print '<div class="tagtr">';
print '<div class="tagtd paddingrightonly opacitymedium" style="padding-right: 10px !important">';
print '<div class="tagtd paddingrightonly opacitymedium tdoverflowmax100onsmartphone" style="padding-right: 10px !important">';
print $langs->trans("WEBSITE_TYPE_CONTAINER");
print '</div>';
print '<div class="tagtd">';
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 '</div>';
print '</div>';
print '<div class="tagtr">';
print '<div class="tagtd paddingrightonly opacitymedium" style="padding-right: 10px !important">';
print '<div class="tagtd paddingrightonly opacitymedium tdoverflowmax100onsmartphone" style="padding-right: 10px !important">';
print $langs->trans("Language");
print '</div>';
print '<div class="tagtd">';
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 '</div>';
print '</div>';
// Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
print '<div class="tagtr">';
print '<div class="tagtd paddingrightonly marginrightonly opacitymedium" style="padding-right: 10px !important">';
print '<div class="tagtd paddingrightonly marginrightonly opacitymedium tdoverflowmax100onsmartphone" style="padding-right: 10px !important">';
print $langs->trans("Category");
print '</div>';
print '<div class="tagtd">';
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 '</div>';
@ -4200,7 +4200,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction =
print '</div>';
print '<input type="submit" class="button" name="buttonreplacesitesearch" value="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="submit" class="button margintoponly" name="buttonreplacesitesearch" value="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</div></div>';