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

This commit is contained in:
Laurent Destailleur 2021-08-18 22:15:39 +02:00
commit e0f8a87129
5 changed files with 541 additions and 436 deletions

View File

@ -43,12 +43,12 @@ if (!$user->admin) {
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminihm'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminihm'; // To manage different context of search
$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'language'; // 'language', 'template', 'login', 'other'
if (!defined("MAIN_MOTD")) { if (!defined("MAIN_MOTD")) {
define("MAIN_MOTD", ""); define("MAIN_MOTD", "");
} }
/* /*
* Action * Action
*/ */
@ -94,10 +94,15 @@ if ($action == 'removebackgroundlogin' && !empty($conf->global->MAIN_LOGIN_BACKG
} }
if ($action == 'update') { if ($action == 'update') {
$error = 0;
if ($mode == 'language') {
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", GETPOST("MAIN_LANG_DEFAULT", 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_LANG_DEFAULT", GETPOST("MAIN_LANG_DEFAULT", 'aZ09'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
//dolibarr_set_const($db, "MAIN_MULTILANGS", GETPOST("MAIN_MULTILANGS"), 'chaine', 0, '', $conf->entity); //dolibarr_set_const($db, "MAIN_MULTILANGS", GETPOST("MAIN_MULTILANGS"), 'chaine', 0, '', $conf->entity);
}
if ($mode == 'template') {
dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity);
/*$val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE'); /*$val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
@ -199,7 +204,9 @@ if ($action == 'update') {
} else { } else {
dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $val, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $val, 'chaine', 0, '', $conf->entity);
} }
}
if ($mode == 'other') {
dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", GETPOST("main_size_liste_limit", 'int'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", GETPOST("main_size_liste_limit", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOST("main_size_shortliste_limit", 'int'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOST("main_size_shortliste_limit", 'int'), 'chaine', 0, '', $conf->entity);
@ -216,10 +223,14 @@ if ($action == 'update') {
dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'restricthtml')), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'restricthtml')), 'chaine', 0, '', $conf->entity);
}
if ($mode == 'login') {
dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'restricthtml')), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'restricthtml')), 'chaine', 0, '', $conf->entity);
//dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities //dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
$varforimage = 'imagebackground'; $dirforimage = $conf->mycompany->dir_output.'/logos/'; $varforimage = 'imagebackground';
$dirforimage = $conf->mycompany->dir_output . '/logos/';
if ($_FILES[$varforimage]["tmp_name"]) { if ($_FILES[$varforimage]["tmp_name"]) {
$reg = array(); $reg = array();
if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) { if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) {
@ -227,11 +238,11 @@ if ($action == 'update') {
$isimage = image_format_supported($original_file); $isimage = image_format_supported($original_file);
if ($isimage >= 0) { if ($isimage >= 0) {
dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file); dol_syslog("Move file " . $_FILES[$varforimage]["tmp_name"] . " to " . $dirforimage . $original_file);
if (!is_dir($dirforimage)) { if (!is_dir($dirforimage)) {
dol_mkdir($dirforimage); dol_mkdir($dirforimage);
} }
$result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']); $result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage . $original_file, 1, 0, $_FILES[$varforimage]['error']);
if ($result > 0) { if ($result > 0) {
dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND", $original_file, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND", $original_file, 'chaine', 0, '', $conf->entity);
} elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) { } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) {
@ -250,12 +261,11 @@ if ($action == 'update') {
} }
} }
} }
}
$_SESSION["mainmenu"] = ""; // The menu manager may have changed
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".'&mode='.$mode.(GETPOSTISSET('page_y', 'int') ? '&page_y='.GETPOST('page_y', 'int') : ''));
$_SESSION["mainmenu"] = ""; // Le gestionnaire de menu a pu changer
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".(GETPOSTISSET('page_y', 'int') ? '&page_y='.GETPOST('page_y', 'int') : ''));
exit; exit;
} }
@ -274,6 +284,7 @@ $formadmin = new FormAdmin($db);
print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup'); print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup');
print '<span class="opacitymedium">'.$langs->trans("DisplayDesc")."</span><br>\n"; print '<span class="opacitymedium">'.$langs->trans("DisplayDesc")."</span><br>\n";
print "<br>\n";
//WYSIWYG Editor //WYSIWYG Editor
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
@ -282,77 +293,67 @@ print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="page_y" value="">'; print '<input type="hidden" name="page_y" value="">';
print '<input type="hidden" id="mode" name="mode" value="'.dol_escape_htmltag($mode).'">';
$head = ihm_prepare_head();
print dol_get_fiche_head($head, $mode, '', -1, '');
clearstatcache(); clearstatcache();
print '<br>'; if ($mode == 'language') {
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table summary="edit" class="noborder centpercent editmode tableforfield">'; print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
print '<tr class="liste_titre"><th>'.img_picto('', 'language').' '.$langs->trans("Language").'</th><th></th>';
print '</tr>';
// Default language // Default language
print '<tr class="oddeven"><td>'.$langs->trans("DefaultLanguage").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("DefaultLanguage").'</td><td>';
print img_picto('', 'language', 'class="pictofixedwidth"'); print img_picto('', 'language', 'class="pictofixedwidth"');
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, null, '', 0, 0, 'minwidth300', 2); print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, null, '', 0, 0, 'minwidth300', 2);
//print '<input class="button button-save smallpaddingimp" type="submit" name="submit" value="'.$langs->trans("Save").'">'; //print '<input class="button button-save smallpaddingimp" type="submit" name="submit" value="'.$langs->trans("Save").'">';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Multilingual GUI // Multilingual GUI
print '<tr class="oddeven"><td>'.$langs->trans("EnableMultilangInterface").'</td><td>'; print '<tr class="oddeven"><td>' . $langs->trans("EnableMultilangInterface") . '</td><td>';
print ajax_constantonoff("MAIN_MULTILANGS", array(), $conf->entity, 0, 0, 1, 0); print ajax_constantonoff("MAIN_MULTILANGS", array(), $conf->entity, 0, 0, 1, 0);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '</table>'."\n"; print '</table>' . "\n";
print '</div>'; print '</div>';
}
print '<br>'; if ($mode == 'template') {
print '<div class="center">'; // Themes and themes options
print '<input class="button button-save" type="submit" name="submit" value="'.$langs->trans("Save").'">'; showSkins(null, 1);
print '</div>'; }
print '<br><br>'; if ($mode == 'other') {
// Other
print '<div class="div-table-responsive-no-min">';
print '<table summary="otherparameters" class="noborder centpercent editmode tableforfield">';
// Themes and themes options // Disable javascript and ajax
showSkins(null, 1); print '<tr class="oddeven"><td>' . $langs->trans("DisableJavascript") . '</td><td>';
print '<br>'; print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0);
print '<div class="center">'; print ' <span class="opacitymedium"> &nbsp; &nbsp; ' . $langs->trans("DisableJavascriptNote") . '</span>';
print '<input class="button button-save reposition" type="submit" name="submit" value="'.$langs->trans("Save").'">'; print '</td>';
print '</div>'; print '<td>';
print '</td>';
print '</tr>';
print '<br><br>'; // Max size of lists
print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeList") . '</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Other // Max size of short lists on customer card
print '<div class="div-table-responsive-no-min">'; print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeShortList") . '</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . '"></td>';
print '<table summary="otherparameters" class="noborder centpercent editmode tableforfield">'; print '<td width="20">&nbsp;</td>';
print '<tr class="liste_titre"><th class="titlefieldmiddle">'.$langs->trans("Miscellaneous").'</th>'; print '</tr>';
print '<th></th>';
print '<th width="20">&nbsp;</tg>';
print '</tr>';
// Disable javascript and ajax // show input border
print '<tr class="oddeven"><td>'.$langs->trans("DisableJavascript").'</td><td>'; /*
print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0);
print ' <span class="opacitymedium"> &nbsp; &nbsp; '.$langs->trans("DisableJavascriptNote").'</span>';
print '</td>';
print '<td>';
print '</td>';
print '</tr>';
// Max size of lists
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeList").'</td><td><input class="flat" name="main_size_liste_limit" size="4" value="'.$conf->global->MAIN_SIZE_LISTE_LIMIT.'"></td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Max size of short lists on customer card
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="'.$conf->global->MAIN_SIZE_SHORTLIST_LIMIT.'"></td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// show input border
/*
print '<tr><td>'.$langs->trans("showInputBorder").'</td><td>'; print '<tr><td>'.$langs->trans("showInputBorder").'</td><td>';
print $form->selectyesno('main_showInputBorder',isset($conf->global->THEME_ELDY_SHOW_BORDER_INPUT)?$conf->global->THEME_ELDY_SHOW_BORDER_INPUT:0,1); print $form->selectyesno('main_showInputBorder',isset($conf->global->THEME_ELDY_SHOW_BORDER_INPUT)?$conf->global->THEME_ELDY_SHOW_BORDER_INPUT:0,1);
print '</td>'; print '</td>';
@ -360,164 +361,155 @@ print '</tr>';
print '</tr>'; print '</tr>';
*/ */
// First day for weeks // First day for weeks
print '<tr class="oddeven"><td>'.$langs->trans("WeekStartOnDay").'</td><td>'; print '<tr class="oddeven"><td>' . $langs->trans("WeekStartOnDay") . '</td><td>';
print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : '1'), 'MAIN_START_WEEK', 0); print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : '1'), 'MAIN_START_WEEK', 0);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// DefaultWorkingDays // DefaultWorkingDays
print '<tr class="oddeven"><td>'.$langs->trans("DefaultWorkingDays").'</td><td>'; print '<tr class="oddeven"><td>' . $langs->trans("DefaultWorkingDays") . '</td><td>';
print '<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_DAYS) ? $conf->global->MAIN_DEFAULT_WORKING_DAYS : '1-5').'">'; print '<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="' . (isset($conf->global->MAIN_DEFAULT_WORKING_DAYS) ? $conf->global->MAIN_DEFAULT_WORKING_DAYS : '1-5') . '">';
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// DefaultWorkingHours // DefaultWorkingHours
print '<tr class="oddeven"><td>'.$langs->trans("DefaultWorkingHours").'</td><td>'; print '<tr class="oddeven"><td>' . $langs->trans("DefaultWorkingHours") . '</td><td>';
print '<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_HOURS) ? $conf->global->MAIN_DEFAULT_WORKING_HOURS : '9-18').'">'; print '<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="' . (isset($conf->global->MAIN_DEFAULT_WORKING_HOURS) ? $conf->global->MAIN_DEFAULT_WORKING_HOURS : '9-18') . '">';
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Firstname/Name // Firstname/Name
print '<tr class="oddeven"><td>'.$langs->trans("FirstnameNamePosition").'</td><td>'; print '<tr class="oddeven"><td>' . $langs->trans("FirstnameNamePosition") . '</td><td>';
$array = array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"), 1=>$langs->trans("Lastname").' '.$langs->trans("Firstname")); $array = array(0 => $langs->trans("Firstname") . ' ' . $langs->trans("Lastname"), 1 => $langs->trans("Lastname") . ' ' . $langs->trans("Firstname"));
print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? $conf->global->MAIN_FIRSTNAME_NAME_POSITION : 0)); print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? $conf->global->MAIN_FIRSTNAME_NAME_POSITION : 0));
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Hide unauthorized menus // Hide unauthorized menus
print '<tr class="oddeven"><td>'.$langs->trans("HideUnauthorizedMenu").'</td><td>'; print '<tr class="oddeven"><td>' . $langs->trans("HideUnauthorizedMenu") . '</td><td>';
//print $form->selectyesno('MAIN_MENU_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_MENU_HIDE_UNAUTHORIZED : 0, 1); //print $form->selectyesno('MAIN_MENU_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_MENU_HIDE_UNAUTHORIZED : 0, 1);
print ajax_constantonoff("MAIN_MENU_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0); print ajax_constantonoff("MAIN_MENU_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Hide unauthorized button // Hide unauthorized button
print '<tr class="oddeven"><td>'.$langs->trans("ButtonHideUnauthorized").'</td><td>'; print '<tr class="oddeven"><td>' . $langs->trans("ButtonHideUnauthorized") . '</td><td>';
//print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED : 0, 1); //print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED : 0, 1);
print ajax_constantonoff("MAIN_BUTTON_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0); print ajax_constantonoff("MAIN_BUTTON_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Hide version link // Hide version link
/* /*
print '<tr><td>'.$langs->trans("HideVersionLink").'</td><td>'; print '<tr><td>'.$langs->trans("HideVersionLink").'</td><td>';
print $form->selectyesno('MAIN_HIDE_VERSION',$conf->global->MAIN_HIDE_VERSION,1); print $form->selectyesno('MAIN_HIDE_VERSION',$conf->global->MAIN_HIDE_VERSION,1);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
*/ */
// Show bugtrack link // Show bugtrack link
print '<tr class="oddeven"><td>'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>'; print '<tr class="oddeven"><td>' . $langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")) . '</td><td>';
print '<input type="text" name="MAIN_BUGTRACK_ENABLELINK" value="'.(empty($conf->global->MAIN_BUGTRACK_ENABLELINK) ? '' : $conf->global->MAIN_BUGTRACK_ENABLELINK).'">'; print '<input type="text" name="MAIN_BUGTRACK_ENABLELINK" value="' . (empty($conf->global->MAIN_BUGTRACK_ENABLELINK) ? '' : $conf->global->MAIN_BUGTRACK_ENABLELINK) . '">';
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Hide wiki link on login page // Hide wiki link on login page
$pictohelp = '<span class="fa fa-question-circle"></span>'; $pictohelp = '<span class="fa fa-question-circle"></span>';
print '<tr class="oddeven"><td>'.str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')).'</td><td>'; print '<tr class="oddeven"><td>' . str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')) . '</td><td>';
print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0); print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0);
//print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1); //print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Message of the day on home page // Message of the day on home page
$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount')); $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'));
complete_substitutions_array($substitutionarray, $langs); complete_substitutions_array($substitutionarray, $langs);
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted").'<br>'; $texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '<br>';
foreach ($substitutionarray as $key => $val) { foreach ($substitutionarray as $key => $val) {
$texthelp .= $key.'<br>'; $texthelp .= $key . '<br>';
}
print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
print '</td><td colspan="2">';
$doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD) ? $conf->global->MAIN_MOTD : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
$doleditor->Create();
print '</td></tr>'."\n";
print '</table>'."\n";
print '</div>';
print '<br>';
print '<div class="center">';
print '<input class="button button-save reposition" type="submit" name="submit" value="'.$langs->trans("Save").'">';
print '</div>';
print '<br><br>';
// Other
print '<div class="div-table-responsive-no-min">';
print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
print '<tr class="liste_titre"><th class="titlefieldmiddle">'.$langs->trans("LoginPage").'</th>';
print '<th></th>';
print '<th width="20">&nbsp;</th>';
print '</tr>';
// Hide helpcenter link on login page
print '<tr class="oddeven"><td>'.$langs->trans("DisableLinkToHelpCenter").'</td><td>';
print ajax_constantonoff("MAIN_HELPCENTER_DISABLELINK", array(), $conf->entity, 0, 0, 0, 0);
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Message on login page
$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user'));
complete_substitutions_array($substitutionarray, $langs);
print '<tr class="oddeven"><td>';
$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
foreach ($substitutionarray as $key => $val) {
$texthelp .= $key.'<br>';
}
print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin');
print '</td><td colspan="2">';
$doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf->global->MAIN_HOME : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
$doleditor->Create();
print '</td></tr>'."\n";
// Background
print '<tr class="oddeven"><td><label for="imagebackground">'.$langs->trans("BackgroundImageLogin").' (png,jpg)</label></td><td colspan="2">';
print '<div class="centpercent inline-block">';
$disabled = '';
if (!empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) {
$disabled = ' disabled="disabled"';
}
print '<input type="file" class="flat maxwidthinputfileonsmartphone" name="imagebackground" id="imagebackground"'.$disabled.'>';
if ($disabled) {
print '('.$langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND").') ';
}
if (!empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removebackgroundlogin">'.img_delete($langs->trans("Delete")).'</a>';
if (file_exists($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND)) {
print ' &nbsp; ';
print '<img class="paddingleft valignmiddle" width="100" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/'.$conf->global->MAIN_LOGIN_BACKGROUND).'">';
} }
} else { print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
print '<img class="paddingleft valignmiddle" width="100" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
}
print '</div>';
print '</td></tr>';
print '</table>'."\n"; print '</td><td colspan="2">';
print '</div>';
$doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD) ? $conf->global->MAIN_MOTD : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
$doleditor->Create();
print '</td></tr>' . "\n";
print '</table>' . "\n";
print '</div>';
}
if ($mode == 'login') {
// Other
print '<div class="div-table-responsive-no-min">';
print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
// Hide helpcenter link on login page
print '<tr class="oddeven"><td>' . $langs->trans("DisableLinkToHelpCenter") . '</td><td>';
print ajax_constantonoff("MAIN_HELPCENTER_DISABLELINK", array(), $conf->entity, 0, 0, 0, 0);
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Message on login page
$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user'));
complete_substitutions_array($substitutionarray, $langs);
print '<tr class="oddeven"><td>';
$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '<br>';
foreach ($substitutionarray as $key => $val) {
$texthelp .= $key . '<br>';
}
print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin');
print '</td><td colspan="2">';
$doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf->global->MAIN_HOME : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
$doleditor->Create();
print '</td></tr>' . "\n";
// Background
print '<tr class="oddeven"><td><label for="imagebackground">' . $langs->trans("BackgroundImageLogin") . ' (png,jpg)</label></td><td colspan="2">';
print '<div class="centpercent inline-block">';
$disabled = '';
if (!empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) {
$disabled = ' disabled="disabled"';
}
print '<input type="file" class="flat maxwidthinputfileonsmartphone" name="imagebackground" id="imagebackground"' . $disabled . '>';
if ($disabled) {
print '(' . $langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND") . ') ';
}
if (!empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?action=removebackgroundlogin">' . img_delete($langs->trans("Delete")) . '</a>';
if (file_exists($conf->mycompany->dir_output . '/logos/' . $conf->global->MAIN_LOGIN_BACKGROUND)) {
print ' &nbsp; ';
print '<img class="paddingleft valignmiddle" width="100" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;file=' . urlencode('logos/' . $conf->global->MAIN_LOGIN_BACKGROUND) . '">';
}
} else {
print '<img class="paddingleft valignmiddle" width="100" src="' . DOL_URL_ROOT . '/public/theme/common/nophoto.png">';
}
print '</div>';
print '</td></tr>';
print '</table>' . "\n";
print '</div>';
}
print '<br>'; print '<br>';
print '<div class="center">'; print '<div class="center">';
print '<input class="button button-save reposition" type="submit" name="submit" value="'.$langs->trans("Save").'">'; print '<input class="button button-save reposition" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
print '</div>'; print '</div>';
print '</form>'; print '</form>';

View File

@ -621,7 +621,7 @@ function dolibarr_set_const($db, $name, $value, $type = 'chaine', $visible = 0,
/** /**
* Prepare array with list of tabs * Prepare array with list of tabs
* *
* @param int $nbofactivatedmodules Number f oactivated modules * @param int $nbofactivatedmodules Number if activated modules
* @param int $nboftotalmodules Nb of total modules * @param int $nboftotalmodules Nb of total modules
* @return array Array of tabs to show * @return array Array of tabs to show
*/ */
@ -664,6 +664,45 @@ function modules_prepare_head($nbofactivatedmodules, $nboftotalmodules)
return $head; return $head;
} }
/**
* Prepare array with list of tabs
*
* @return array Array of tabs to show
*/
function ihm_prepare_head()
{
global $langs, $conf, $user;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=language";
$head[$h][1] = $langs->trans("DefaultLanguage");
$head[$h][2] = 'language';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=template";
$head[$h][1] = $langs->trans("DefaultSkin");
$head[$h][2] = 'template';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=login";
$head[$h][1] = $langs->trans("LoginPage");
$head[$h][2] = 'login';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=other";
$head[$h][1] = $langs->trans("Miscellaneous");
$head[$h][2] = 'other';
$h++;
complete_head_from_modules($conf, $langs, null, $head, $h, 'ihm_admin');
complete_head_from_modules($conf, $langs, null, $head, $h, 'ihm_admin', 'remove');
return $head;
}
/** /**
* Prepare array with list of tabs * Prepare array with list of tabs

View File

@ -2130,7 +2130,7 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
global $conf, $langs; global $conf, $langs;
$ret = ''; $ret = '';
$countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR'); // See also MAIN_FORCE_STATE_INTO_ADDRESS $countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR', 'CN'); // See also MAIN_FORCE_STATE_INTO_ADDRESS
// See format of addresses on https://en.wikipedia.org/wiki/Address // See format of addresses on https://en.wikipedia.org/wiki/Address
// Address // Address
@ -2138,7 +2138,7 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
$ret .= ($extralangcode ? $object->array_languages['address'][$extralangcode] : (empty($object->address) ? '' : $object->address)); $ret .= ($extralangcode ? $object->array_languages['address'][$extralangcode] : (empty($object->address) ? '' : $object->address));
} }
// Zip/Town/State // Zip/Town/State
if (isset($object->country_code) && in_array($object->country_code, array('AU', 'CA', 'US')) || !empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) { if (isset($object->country_code) && in_array($object->country_code, array('AU', 'CA', 'US', 'CN')) || !empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) {
// US: title firstname name \n address lines \n town, state, zip \n country // US: title firstname name \n address lines \n town, state, zip \n country
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : (empty($object->town) ? '' : $object->town)); $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : (empty($object->town) ? '' : $object->town));
$ret .= ($ret ? $sep : '').$town; $ret .= ($ret ? $sep : '').$town;

View File

@ -88,8 +88,8 @@ $mesg = ''; $error = 0; $errors = array();
$refalreadyexists = 0; $refalreadyexists = 0;
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha'); $ref = (GETPOSTISSET('ref') ? GETPOST('ref', 'alpha') : null);
$type = (GETPOST('type', 'int') !== '') ? GETPOST('type', 'int') : Product::TYPE_PRODUCT; $type = (GETPOSTISSET('type') ? GETPOST('type', 'int') : Product::TYPE_PRODUCT);
$action = (GETPOST('action', 'alpha') ? GETPOST('action', 'alpha') : 'view'); $action = (GETPOST('action', 'alpha') ? GETPOST('action', 'alpha') : 'view');
$cancel = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
@ -112,6 +112,16 @@ if (!empty($user->socid)) {
$socid = $user->socid; $socid = $user->socid;
} }
// Load object modCodeProduct
$module = (!empty($conf->global->PRODUCT_CODEPRODUCT_ADDON) ? $conf->global->PRODUCT_CODEPRODUCT_ADDON : 'mod_codeproduct_leopard');
if (substr($module, 0, 16) == 'mod_codeproduct_' && substr($module, -3) == 'php') {
$module = substr($module, 0, dol_strlen($module) - 4);
}
$result = dol_include_once('/core/modules/product/'.$module.'.php');
if ($result > 0) {
$modCodeProduct = new $module();
}
$object = new Product($db); $object = new Product($db);
$object->type = $type; // so test later to fill $usercancxxx is correct $object->type = $type; // so test later to fill $usercancxxx is correct
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
@ -247,10 +257,12 @@ if (empty($reshook)) {
$error++; $error++;
} }
if (empty($ref)) { if (empty($ref)) {
if (empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Ref')), null, 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Ref')), null, 'errors');
$action = "create"; $action = "create";
$error++; $error++;
} }
}
if (!empty($duration_value) && empty($duration_unit)) { if (!empty($duration_value) && empty($duration_unit)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Unit')), null, 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Unit')), null, 'errors');
$action = "create"; $action = "create";
@ -431,6 +443,11 @@ if (empty($reshook)) {
$error++; $error++;
} }
if (!$ref && !empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) {
// Generate ref...
$ref = $modCodeProduct->getNextValue($object, $type);
}
if (!$error) { if (!$error) {
$id = $object->create($user); $id = $object->create($user);
} }
@ -470,7 +487,9 @@ if (empty($reshook)) {
if ($object->id > 0) { if ($object->id > 0) {
$object->oldcopy = clone $object; $object->oldcopy = clone $object;
if (empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) {
$object->ref = $ref; $object->ref = $ref;
}
$object->label = GETPOST('label', $label_security_check); $object->label = GETPOST('label', $label_security_check);
$desc = dol_htmlcleanlastbr(preg_replace('/&nbsp;$/', '', GETPOST('desc', 'restricthtml'))); $desc = dol_htmlcleanlastbr(preg_replace('/&nbsp;$/', '', GETPOST('desc', 'restricthtml')));
@ -1079,6 +1098,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<table class="border centpercent">'; print '<table class="border centpercent">';
if (empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) {
print '<tr>'; print '<tr>';
$tmpcode = ''; $tmpcode = '';
if (!empty($modCodeProduct->code_auto)) { if (!empty($modCodeProduct->code_auto)) {
@ -1089,6 +1109,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print $langs->trans("RefAlreadyExists"); print $langs->trans("RefAlreadyExists");
} }
print '</td></tr>'; print '</td></tr>';
}
// Label // Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" class="minwidth300 maxwidth400onsmartphone" maxlength="255" value="'.dol_escape_htmltag(GETPOST('label', $label_security_check)).'"></td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" class="minwidth300 maxwidth400onsmartphone" maxlength="255" value="'.dol_escape_htmltag(GETPOST('label', $label_security_check)).'"></td></tr>';
@ -2416,16 +2437,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
} }
} }
// Load object modCodeProduct
$module = (!empty($conf->global->PRODUCT_CODEPRODUCT_ADDON) ? $conf->global->PRODUCT_CODEPRODUCT_ADDON : 'mod_codeproduct_leopard');
if (substr($module, 0, 16) == 'mod_codeproduct_' && substr($module, -3) == 'php') {
$module = substr($module, 0, dol_strlen($module) - 4);
}
$result = dol_include_once('/core/modules/product/'.$module.'.php');
if ($result > 0) {
$modCodeProduct = new $module();
}
$tmpcode = ''; $tmpcode = '';
if (!empty($modCodeProduct->code_auto)) { if (!empty($modCodeProduct->code_auto)) {
$tmpcode = $modCodeProduct->getNextValue($object, $object->type); $tmpcode = $modCodeProduct->getNextValue($object, $object->type);

View File

@ -11,6 +11,7 @@
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com> * Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -65,6 +66,22 @@ $search_town = GETPOST('search_town', 'alpha');
$search_zip = GETPOST('search_zip', 'alpha'); $search_zip = GETPOST('search_zip', 'alpha');
$search_state = GETPOST("search_state"); $search_state = GETPOST("search_state");
$search_country = GETPOST("search_country", 'int'); $search_country = GETPOST("search_country", 'int');
$search_date_startday = GETPOST('search_date_startday', 'int');
$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
$search_date_startyear = GETPOST('search_date_startyear', 'int');
$search_date_endday = GETPOST('search_date_endday', 'int');
$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
$search_date_endyear = GETPOST('search_date_endyear', 'int');
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
$search_date_valid_startday = GETPOST('search_date_valid_startday', 'int');
$search_date_valid_startmonth = GETPOST('search_date_valid_startmonth', 'int');
$search_date_valid_startyear = GETPOST('search_date_valid_startyear', 'int');
$search_date_valid_endday = GETPOST('search_date_valid_endday', 'int');
$search_date_valid_endmonth = GETPOST('search_date_valid_endmonth', 'int');
$search_date_valid_endyear = GETPOST('search_date_valid_endyear', 'int');
$search_date_valid_start = dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear); // Use tzserver
$search_date_valid_end = dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
$search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int');
$search_montant_ht = GETPOST('search_montant_ht', 'alpha'); $search_montant_ht = GETPOST('search_montant_ht', 'alpha');
$search_montant_vat = GETPOST('search_montant_vat', 'alpha'); $search_montant_vat = GETPOST('search_montant_vat', 'alpha');
@ -83,12 +100,6 @@ $search_remove_btn = GETPOST('button_removefilter', 'alpha');
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$mesg = (GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); $mesg = (GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
$year = GETPOST("year");
$month = GETPOST("month");
$day = GETPOST("day");
$yearvalid = GETPOST("yearvalid");
$monthvalid = GETPOST("monthvalid");
$dayvalid = GETPOST("dayvalid");
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
@ -227,12 +238,22 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_type = ''; $search_type = '';
$search_country = ''; $search_country = '';
$search_type_thirdparty = ''; $search_type_thirdparty = '';
$yearvalid = ''; $search_date_startday = '';
$monthvalid = ''; $search_date_startmonth = '';
$dayvalid = ''; $search_date_startyear = '';
$year = ''; $search_date_endday = '';
$month = ''; $search_date_endmonth = '';
$day = ''; $search_date_endyear = '';
$search_date_start = '';
$search_date_end = '';
$search_date_valid_startday = '';
$search_date_valid_startmonth = '';
$search_date_valid_startyear = '';
$search_date_valid_endday = '';
$search_date_valid_endmonth = '';
$search_date_valid_endyear = '';
$search_date_valid_start = '';
$search_date_valid_end = '';
$search_status = ''; $search_status = '';
$object_statut = ''; $object_statut = '';
} }
@ -376,8 +397,18 @@ if ($socid) {
if ($search_status >= 0 && $search_status != '') { if ($search_status >= 0 && $search_status != '') {
$sql .= ' AND sp.fk_statut IN ('.$db->sanitize($db->escape($search_status)).')'; $sql .= ' AND sp.fk_statut IN ('.$db->sanitize($db->escape($search_status)).')';
} }
$sql .= dolSqlDateFilter("sp.date_livraison", $day, $month, $year); if ($search_date_start) {
$sql .= dolSqlDateFilter("sp.date_valid", $dayvalid, $monthvalid, $yearvalid); $sql .= " AND sp.date_livraison >= '".$db->idate($search_date_start)."'";
}
if ($search_date_end) {
$sql .= " AND sp.date_livraison <= '".$db->idate($search_date_end)."'";
}
if ($search_date_valid_start) {
$sql .= " AND sp.date_valid >= '".$db->idate($search_date_valid_start)."'";
}
if ($search_date_valid_end) {
$sql .= " AND sp.date_valid <= '".$db->idate($search_date_valid_end)."'";
}
if ($search_sale > 0) { if ($search_sale > 0) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
} }
@ -446,11 +477,41 @@ if ($resql) {
if ($sall) { if ($sall) {
$param .= '&sall='.urlencode($sall); $param .= '&sall='.urlencode($sall);
} }
if ($month) { if ($search_date_startday) {
$param .= '&month='.urlencode($month); $param .= '&search_date_startday='.urlencode($search_date_startday);
} }
if ($year) { if ($search_date_startmonth) {
$param .= '&year='.urlencode($year); $param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
}
if ($search_date_startyear) {
$param .= '&search_date_startyear='.urlencode($search_date_startyear);
}
if ($search_date_endday) {
$param .= '&search_date_endday='.urlencode($search_date_endday);
}
if ($search_date_endmonth) {
$param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
}
if ($search_date_endyear) {
$param .= '&search_date_endyear='.urlencode($search_date_endyear);
}
if ($search_date_valid_startday) {
$param .= '&search_date_valid_startday='.urlencode($search_date_valid_startday);
}
if ($search_date_valid_startmonth) {
$param .= '&search_date_valid_startmonth='.urlencode($search_date_valid_startmonth);
}
if ($search_date_valid_startyear) {
$param .= '&search_date_valid_startyear='.urlencode($search_date_valid_startyear);
}
if ($search_date_valid_endday) {
$param .= '&search_date_valid_endday='.urlencode($search_date_valid_endday);
}
if ($search_date_valid_endmonth) {
$param .= '&search_date_valid_endmonth='.urlencode($search_date_valid_endmonth);
}
if ($search_date_valid_endyear) {
$param .= '&search_date_valid_endyear='.urlencode($search_date_valid_endyear);
} }
if ($search_ref) { if ($search_ref) {
$param .= '&search_ref='.urlencode($search_ref); $param .= '&search_ref='.urlencode($search_ref);
@ -641,21 +702,23 @@ if ($resql) {
// Date // Date
if (!empty($arrayfields['sp.date_valid']['checked'])) { if (!empty($arrayfields['sp.date_valid']['checked'])) {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
//print $langs->trans('Month').': '; print '<div class="nowrap">';
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="monthvalid" value="'.dol_escape_htmltag($monthvalid).'">'; print $form->selectDate($search_date_valid_start ? $search_date_valid_start : -1, 'search_date_valid_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
//print '&nbsp;'.$langs->trans('Year').': '; print '</div>';
$syearvalid = $yearvalid; print '<div class="nowrap">';
$formother->select_year($syearvalid, 'yearvalid', 1, 20, 5); print $form->selectDate($search_date_valid_end ? $search_date_valid_end : -1, 'search_date_valid_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>';
print '</td>'; print '</td>';
} }
// Date // Date
if (!empty($arrayfields['sp.date_livraison']['checked'])) { if (!empty($arrayfields['sp.date_livraison']['checked'])) {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
//print $langs->trans('Month').': '; print '<div class="nowrap">';
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="month" value="'.dol_escape_htmltag($month).'">'; print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
//print '&nbsp;'.$langs->trans('Year').': '; print '</div>';
$syear = $year; print '<div class="nowrap">';
$formother->select_year($syear, 'year', 1, 20, 5); print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>';
print '</td>'; print '</td>';
} }