forked from Wavyzz/dolibarr
NEW Can set/unset the usual working day of the week
This commit is contained in:
@@ -274,147 +274,141 @@ print '</div>';
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
|
|
||||||
print dol_get_fiche_end();
|
|
||||||
// End of page
|
|
||||||
llxFooter();
|
|
||||||
$db->close();
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Documents models for Holidays
|
* Documents models for Holidays
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("TemplatePDFHolidays"), '', '');
|
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||||
|
print load_fiche_titre($langs->trans("TemplatePDFHolidays"), '', '');
|
||||||
|
|
||||||
// Defined model definition table
|
// Defined model definition table
|
||||||
$def = array();
|
$def = array();
|
||||||
$sql = "SELECT nom";
|
$sql = "SELECT nom";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
|
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||||
$sql .= " WHERE type = '".$db->escape($type)."'";
|
$sql .= " WHERE type = '".$db->escape($type)."'";
|
||||||
$sql .= " AND entity = ".$conf->entity;
|
$sql .= " AND entity = ".$conf->entity;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$num_rows = $db->num_rows($resql);
|
$num_rows = $db->num_rows($resql);
|
||||||
while ($i < $num_rows) {
|
while ($i < $num_rows) {
|
||||||
$array = $db->fetch_array($resql);
|
$array = $db->fetch_array($resql);
|
||||||
array_push($def, $array[0]);
|
array_push($def, $array[0]);
|
||||||
$i++;
|
$i++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Name").'</td>';
|
print '<td>'.$langs->trans("Name").'</td>';
|
||||||
print '<td>'.$langs->trans("Description").'</td>';
|
print '<td>'.$langs->trans("Description").'</td>';
|
||||||
print '<td align="center" width="60">'.$langs->trans("Status")."</td>\n";
|
print '<td align="center" width="60">'.$langs->trans("Status")."</td>\n";
|
||||||
print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
|
print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
|
||||||
print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
|
print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
|
||||||
print '<td align="center" width="80">'.$langs->trans("Preview").'</td>';
|
print '<td align="center" width="80">'.$langs->trans("Preview").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
|
|
||||||
foreach ($dirmodels as $reldir) {
|
foreach ($dirmodels as $reldir) {
|
||||||
foreach (array('', '/doc') as $valdir) {
|
foreach (array('', '/doc') as $valdir) {
|
||||||
$realpath = $reldir."core/modules/holiday".$valdir;
|
$realpath = $reldir."core/modules/holiday".$valdir;
|
||||||
$dir = dol_buildpath($realpath);
|
$dir = dol_buildpath($realpath);
|
||||||
|
|
||||||
if (is_dir($dir)) {
|
if (is_dir($dir)) {
|
||||||
$handle = opendir($dir);
|
$handle = opendir($dir);
|
||||||
if (is_resource($handle)) {
|
if (is_resource($handle)) {
|
||||||
while (($file = readdir($handle)) !== false) {
|
while (($file = readdir($handle)) !== false) {
|
||||||
$filelist[] = $file;
|
$filelist[] = $file;
|
||||||
}
|
}
|
||||||
closedir($handle);
|
closedir($handle);
|
||||||
arsort($filelist);
|
arsort($filelist);
|
||||||
|
|
||||||
foreach ($filelist as $file) {
|
foreach ($filelist as $file) {
|
||||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
|
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
|
||||||
if (file_exists($dir.'/'.$file)) {
|
if (file_exists($dir.'/'.$file)) {
|
||||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||||
|
|
||||||
require_once $dir.'/'.$file;
|
require_once $dir.'/'.$file;
|
||||||
$module = new $classname($db);
|
$module = new $classname($db);
|
||||||
|
|
||||||
$modulequalified = 1;
|
$modulequalified = 1;
|
||||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
|
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
|
||||||
$modulequalified = 0;
|
$modulequalified = 0;
|
||||||
}
|
}
|
||||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
|
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
|
||||||
$modulequalified = 0;
|
$modulequalified = 0;
|
||||||
}
|
|
||||||
|
|
||||||
if ($modulequalified) {
|
|
||||||
print '<tr class="oddeven"><td width="100">';
|
|
||||||
print (empty($module->name) ? $name : $module->name);
|
|
||||||
print "</td><td>\n";
|
|
||||||
if (method_exists($module, 'info')) {
|
|
||||||
print $module->info($langs);
|
|
||||||
} else {
|
|
||||||
print $module->description;
|
|
||||||
}
|
}
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Active
|
if ($modulequalified) {
|
||||||
if (in_array($name, $def)) {
|
print '<tr class="oddeven"><td width="100">';
|
||||||
print '<td class="center">'."\n";
|
print (empty($module->name) ? $name : $module->name);
|
||||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
|
print "</td><td>\n";
|
||||||
print img_picto($langs->trans("Enabled"), 'switch_on');
|
if (method_exists($module, 'info')) {
|
||||||
print '</a>';
|
print $module->info($langs);
|
||||||
|
} else {
|
||||||
|
print $module->description;
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
} else {
|
|
||||||
print '<td class="center">'."\n";
|
// Active
|
||||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
if (in_array($name, $def)) {
|
||||||
print "</td>";
|
print '<td class="center">'."\n";
|
||||||
|
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
|
||||||
|
print img_picto($langs->trans("Enabled"), 'switch_on');
|
||||||
|
print '</a>';
|
||||||
|
print '</td>';
|
||||||
|
} else {
|
||||||
|
print '<td class="center">'."\n";
|
||||||
|
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||||
|
print "</td>";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default
|
||||||
|
print '<td class="center">';
|
||||||
|
if ($conf->global->HOLIDAY_ADDON_PDF == $name) {
|
||||||
|
print img_picto($langs->trans("Default"), 'on');
|
||||||
|
} else {
|
||||||
|
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Info
|
||||||
|
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||||
|
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||||
|
if ($module->type == 'pdf') {
|
||||||
|
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||||
|
}
|
||||||
|
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||||
|
|
||||||
|
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||||
|
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||||
|
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||||
|
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||||
|
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||||
|
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
|
||||||
|
|
||||||
|
|
||||||
|
print '<td class="center">';
|
||||||
|
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Preview
|
||||||
|
print '<td class="center">';
|
||||||
|
if ($module->type == 'pdf') {
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
|
||||||
|
} else {
|
||||||
|
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default
|
|
||||||
print '<td class="center">';
|
|
||||||
if ($conf->global->HOLIDAY_ADDON_PDF == $name) {
|
|
||||||
print img_picto($langs->trans("Default"), 'on');
|
|
||||||
} else {
|
|
||||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Info
|
|
||||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
|
||||||
if ($module->type == 'pdf') {
|
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
|
||||||
}
|
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
|
||||||
|
|
||||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
|
||||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
|
||||||
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
|
||||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
|
||||||
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
|
|
||||||
|
|
||||||
|
|
||||||
print '<td class="center">';
|
|
||||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Preview
|
|
||||||
print '<td class="center">';
|
|
||||||
if ($module->type == 'pdf') {
|
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
|
|
||||||
} else {
|
|
||||||
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -422,11 +416,11 @@ foreach ($dirmodels as $reldir) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print "<br>";
|
print "<br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -446,34 +440,118 @@ print '<td>'.$langs->trans("Parameter").'</td>';
|
|||||||
print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$substitutionarray = pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
|
/*var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
|
||||||
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
|
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
|
||||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
|
||||||
foreach ($substitutionarray as $key => $val) {
|
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
|
||||||
$htmltext .= $key.'<br>';
|
*/
|
||||||
|
if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) {
|
||||||
|
$conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY = 1;
|
||||||
}
|
}
|
||||||
$htmltext .= '</i>';
|
if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) {
|
||||||
|
$conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY = 1;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
|
||||||
|
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
|
||||||
|
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
|
||||||
|
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
|
||||||
|
*/
|
||||||
|
|
||||||
print '<tr class="oddeven"><td colspan="2">';
|
// Set working days
|
||||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
|
print '<tr class="oddeven">';
|
||||||
print '<br>';
|
print "<td>".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Monday"))."</td>";
|
||||||
$variablename = 'HOLIDAY_FREE_TEXT';
|
print '<td class="center">';
|
||||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
|
if ($conf->use_javascript_ajax) {
|
||||||
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY', array(), null, 0);
|
||||||
} else {
|
} else {
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY)) {
|
||||||
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||||
print $doleditor->Create();
|
} else {
|
||||||
|
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print '</td></tr>'."\n";
|
print "</td>";
|
||||||
|
print "</tr>";
|
||||||
|
|
||||||
//Use draft Watermark
|
// Set working days
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print "<td>".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Friday"))."</td>";
|
||||||
|
print '<td class="center">';
|
||||||
|
if ($conf->use_javascript_ajax) {
|
||||||
|
print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY', array(), null, 0);
|
||||||
|
} else {
|
||||||
|
if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY)) {
|
||||||
|
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||||
|
} else {
|
||||||
|
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print "</td>";
|
||||||
|
print "</tr>";
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
// Set working days
|
||||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftHolidayCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
print '<tr class="oddeven">';
|
||||||
print '</td><td>';
|
print "<td>".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Saturday"))."</td>";
|
||||||
print '<input class="flat minwidth200" type="text" name="HOLIDAY_DRAFT_WATERMARK" value="'.$conf->global->HOLIDAY_DRAFT_WATERMARK.'">';
|
print '<td class="center">';
|
||||||
print '</td></tr>'."\n";
|
if ($conf->use_javascript_ajax) {
|
||||||
|
print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY', array(), null, 0, 0, 0, 2, 0, 1);
|
||||||
|
} else {
|
||||||
|
if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) {
|
||||||
|
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||||
|
} else {
|
||||||
|
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print "</td>";
|
||||||
|
print "</tr>";
|
||||||
|
|
||||||
|
// Set working days
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print "<td>".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Sunday"))."</td>";
|
||||||
|
print '<td class="center">';
|
||||||
|
if ($conf->use_javascript_ajax) {
|
||||||
|
print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY', array(), null, 0, 0, 0, 2, 0, 1);
|
||||||
|
} else {
|
||||||
|
if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) {
|
||||||
|
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||||
|
} else {
|
||||||
|
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print "</td>";
|
||||||
|
print "</tr>";
|
||||||
|
|
||||||
|
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||||
|
$substitutionarray = pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
|
||||||
|
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
|
||||||
|
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||||
|
foreach ($substitutionarray as $key => $val) {
|
||||||
|
$htmltext .= $key.'<br>';
|
||||||
|
}
|
||||||
|
$htmltext .= '</i>';
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td colspan="2">';
|
||||||
|
print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
|
||||||
|
print '<br>';
|
||||||
|
$variablename = 'HOLIDAY_FREE_TEXT';
|
||||||
|
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
|
||||||
|
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
||||||
|
} else {
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
|
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||||
|
print $doleditor->Create();
|
||||||
|
}
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
//Use draft Watermark
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>';
|
||||||
|
print $form->textwithpicto($langs->trans("WatermarkOnDraftHolidayCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||||
|
print '</td><td>';
|
||||||
|
print '<input class="flat minwidth200" type="text" name="HOLIDAY_DRAFT_WATERMARK" value="'.$conf->global->HOLIDAY_DRAFT_WATERMARK.'">';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2011-2015 Regis Houssin <regis.houssin@inodbox.com>
|
/* Copyright (C) 2011-2015 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
|
* Copyright (C) 2021 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -47,6 +48,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
|||||||
|
|
||||||
$action = GETPOST('action', 'aZ09'); // set or del
|
$action = GETPOST('action', 'aZ09'); // set or del
|
||||||
$name = GETPOST('name', 'alpha');
|
$name = GETPOST('name', 'alpha');
|
||||||
|
$entity = GETPOST('entity', 'int');
|
||||||
|
$value = ((GETPOST('value', 'int') || GETPOST('value', 'int') == '0') ? GETPOST('value', 'int') : 1);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -64,9 +67,6 @@ top_httphead();
|
|||||||
|
|
||||||
// Registering the new value of constant
|
// Registering the new value of constant
|
||||||
if (!empty($action) && !empty($name)) {
|
if (!empty($action) && !empty($name)) {
|
||||||
$entity = GETPOST('entity', 'int');
|
|
||||||
$value = (GETPOST('value') ?GETPOST('value') : 1);
|
|
||||||
|
|
||||||
if ($user->admin) {
|
if ($user->admin) {
|
||||||
if ($action == 'set') {
|
if ($action == 'set') {
|
||||||
dolibarr_set_const($db, $name, $value, 'chaine', 0, '', $entity);
|
dolibarr_set_const($db, $name, $value, 'chaine', 0, '', $entity);
|
||||||
|
|||||||
@@ -549,20 +549,27 @@ function hideMessage(fieldId,message) {
|
|||||||
* @param int strict Strict
|
* @param int strict Strict
|
||||||
* @param int forcereload Force reload
|
* @param int forcereload Force reload
|
||||||
* @param int userid User id
|
* @param int userid User id
|
||||||
|
* @param int value Value to set
|
||||||
* @param string token Token
|
* @param string token Token
|
||||||
*/
|
*/
|
||||||
function setConstant(url, code, input, entity, strict, forcereload, userid, token) {
|
function setConstant(url, code, input, entity, strict, forcereload, userid, token, value) {
|
||||||
var saved_url = url; /* avoid undefined url */
|
var saved_url = url; /* avoid undefined url */
|
||||||
$.post( url, {
|
$.post( url, {
|
||||||
action: "set",
|
action: "set",
|
||||||
name: code,
|
name: code,
|
||||||
entity: entity,
|
entity: entity,
|
||||||
token: token
|
token: token,
|
||||||
|
value: value
|
||||||
},
|
},
|
||||||
function() { /* handler for success of post */
|
function() { /* handler for success of post */
|
||||||
console.log("url request success forcereload="+forcereload);
|
console.log("url request success forcereload="+forcereload+" value="+value);
|
||||||
$("#set_" + code).hide();
|
if (value == 0) {
|
||||||
$("#del_" + code).show();
|
$("#set_" + code).show();
|
||||||
|
$("#del_" + code).hide();
|
||||||
|
} else {
|
||||||
|
$("#set_" + code).hide();
|
||||||
|
$("#del_" + code).show();
|
||||||
|
}
|
||||||
$.each(input, function(type, data) {
|
$.each(input, function(type, data) {
|
||||||
// Enable another element
|
// Enable another element
|
||||||
if (type == "disabled" && strict != 1) {
|
if (type == "disabled" && strict != 1) {
|
||||||
@@ -610,7 +617,7 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke
|
|||||||
if (forcereload) {
|
if (forcereload) {
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
}).fail(function(error) { location.reload(); }); /* When it fails, we always force reload to have setEventErrorMEssage in session visible */
|
}).fail(function(error) { location.reload(); }); /* When it fails, we always force reload to have setEventErrorMessages in session visible */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -681,7 +688,7 @@ function delConstant(url, code, input, entity, strict, forcereload, userid, toke
|
|||||||
if (forcereload) {
|
if (forcereload) {
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
}).fail(function(error) { location.reload(); }); /* When it fails, we always force reload to have setEventErrorMEssage in session visible */
|
}).fail(function(error) { location.reload(); }); /* When it fails, we always force reload to have setEventErrorMessages in session visible */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -716,7 +723,7 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
|
|||||||
text : yesButton,
|
text : yesButton,
|
||||||
click : function() {
|
click : function() {
|
||||||
if (action == "set") {
|
if (action == "set") {
|
||||||
setConstant(url, code, input, entity, strict, 0, userid, token);
|
setConstant(url, code, input, entity, strict, 0, userid, token, 1);
|
||||||
} else if (action == "del") {
|
} else if (action == "del") {
|
||||||
delConstant(url, code, input, entity, strict, 0, userid, token);
|
delConstant(url, code, input, entity, strict, 0, userid, token);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -540,14 +540,15 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
|
|||||||
* @param string $code Name of constant
|
* @param string $code Name of constant
|
||||||
* @param array $input Array of complementary actions to do if success ("disabled"|"enabled'|'set'|'del') => CSS element to switch, 'alert' => message to show, ... Example: array('disabled'=>array(0=>'cssid'))
|
* @param array $input Array of complementary actions to do if success ("disabled"|"enabled'|'set'|'del') => CSS element to switch, 'alert' => message to show, ... Example: array('disabled'=>array(0=>'cssid'))
|
||||||
* @param int $entity Entity. Current entity is used if null.
|
* @param int $entity Entity. Current entity is used if null.
|
||||||
* @param int $revertonoff Revert on/off
|
* @param int $revertonoff 1=Revert on/off
|
||||||
* @param int $strict Use only "disabled" with delConstant and "enabled" with setConstant
|
* @param int $strict Use only "disabled" with delConstant and "enabled" with setConstant
|
||||||
* @param int $forcereload Force to reload page if we click/change value (this is supported only when there is no 'alert' option in input)
|
* @param int $forcereload Force to reload page if we click/change value (this is supported only when there is no 'alert' option in input)
|
||||||
* @param string $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No left margin. Works for fontawesome picto only.
|
* @param string $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No left margin. Works for fontawesome picto only.
|
||||||
* @param int $forcenoajax 1 = Force to use a ahref link instead of ajax code.
|
* @param int $forcenoajax 1 = Force to use a ahref link instead of ajax code.
|
||||||
|
* @param int $setzeroinsteadofdel 1 = Set constantto '0' instead of deleting it
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0)
|
function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0, $setzeroinsteadofdel = 0)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
|
|
||||||
@@ -593,9 +594,13 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
|
|||||||
if (input.alert.del.yesButton) yesButton = input.alert.del.yesButton;
|
if (input.alert.del.yesButton) yesButton = input.alert.del.yesButton;
|
||||||
if (input.alert.del.noButton) noButton = input.alert.del.noButton;
|
if (input.alert.del.noButton) noButton = input.alert.del.noButton;
|
||||||
confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton, strict, userid, token);
|
confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton, strict, userid, token);
|
||||||
} else {
|
} else {';
|
||||||
delConstant(url, code, input, entity, 0, '.$forcereload.', userid, token);
|
if (empty($setzeroinsteadofdel)) {
|
||||||
}
|
$out .=' delConstant(url, code, input, entity, 0, '.$forcereload.', userid, token);';
|
||||||
|
} else {
|
||||||
|
$out .=' setConstant(url, code, input, entity, 0, '.$forcereload.', userid, token, 0);';
|
||||||
|
}
|
||||||
|
$out .= ' }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>'."\n";
|
</script>'."\n";
|
||||||
|
|||||||
@@ -668,15 +668,16 @@ function getGMTEasterDatetime($year)
|
|||||||
*
|
*
|
||||||
* @param int $timestampStart Timestamp start (UTC with hour, min, sec = 0)
|
* @param int $timestampStart Timestamp start (UTC with hour, min, sec = 0)
|
||||||
* @param int $timestampEnd Timestamp end (UTC with hour, min, sec = 0)
|
* @param int $timestampEnd Timestamp end (UTC with hour, min, sec = 0)
|
||||||
* @param string $country_code Country code
|
* @param string $country_code Country code
|
||||||
* @param int $lastday Last day is included, 0: no, 1:yes
|
* @param int $lastday Last day is included, 0: no, 1:yes
|
||||||
* @param int $includesaturday Include saturday as non working day (-1=use setup, 0=no, 1=yes)
|
* @param int $includesaturday Include saturday as non working day (-1=use setup, 0=no, 1=yes)
|
||||||
* @param int $includesunday Include sunday as non working day (-1=use setup, 0=no, 1=yes)
|
* @param int $includesunday Include sunday as non working day (-1=use setup, 0=no, 1=yes)
|
||||||
* @param int $includefriday Include friday as non working day (-1=use setup, 0=no, 1=yes)
|
* @param int $includefriday Include friday as non working day (-1=use setup, 0=no, 1=yes)
|
||||||
* @return int|string Number of non working days or error message string if error
|
* @param int $includemonday Include monday as non working day (-1=use setup, 0=no, 1=yes)
|
||||||
|
* @return int|string Number of non working days or error message string if error
|
||||||
* @see num_between_day(), num_open_day()
|
* @see num_between_day(), num_open_day()
|
||||||
*/
|
*/
|
||||||
function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', $lastday = 0, $includesaturday = -1, $includesunday = -1, $includefriday = -1)
|
function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', $lastday = 0, $includesaturday = -1, $includesunday = -1, $includefriday = -1, $includemonday = -1)
|
||||||
{
|
{
|
||||||
global $db, $conf, $mysoc;
|
global $db, $conf, $mysoc;
|
||||||
|
|
||||||
@@ -690,6 +691,9 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '',
|
|||||||
if (empty($country_code)) {
|
if (empty($country_code)) {
|
||||||
$country_code = $mysoc->country_code;
|
$country_code = $mysoc->country_code;
|
||||||
}
|
}
|
||||||
|
if ($includemonday < 0) {
|
||||||
|
$includemonday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY : 0);
|
||||||
|
}
|
||||||
if ($includefriday < 0) {
|
if ($includefriday < 0) {
|
||||||
$includefriday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY : 0);
|
$includefriday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY : 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,3 +133,4 @@ WatermarkOnDraftHolidayCards=Watermarks on draft leave requests
|
|||||||
HolidaysToApprove=Holidays to approve
|
HolidaysToApprove=Holidays to approve
|
||||||
NobodyHasPermissionToValidateHolidays=Nobody has permission to validate holidays
|
NobodyHasPermissionToValidateHolidays=Nobody has permission to validate holidays
|
||||||
HolidayBalanceMonthlyUpdate=Monthly update of holiday balance
|
HolidayBalanceMonthlyUpdate=Monthly update of holiday balance
|
||||||
|
XIsAUsualNonWorkingDay=%s is usualy a NON working day
|
||||||
Reference in New Issue
Block a user