2
0
forked from Wavyzz/dolibarr

NEW Add dictionary to store public holidays.

This commit is contained in:
Laurent Destailleur
2019-09-05 20:06:09 +02:00
parent e7e663a27e
commit 37a32af7b0
8 changed files with 158 additions and 34 deletions

View File

@@ -88,7 +88,7 @@ $hookmanager->initHooks(array('admin'));
// Put here declaration of dictionaries properties // Put here declaration of dictionaries properties
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this. // Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,37,0,25,0); $taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,32,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,37,0,25,0);
// Name of SQL tables of dictionaries // Name of SQL tables of dictionaries
$tabname=array(); $tabname=array();
@@ -123,9 +123,10 @@ $tabname[28]= MAIN_DB_PREFIX."c_holiday_types";
$tabname[29]= MAIN_DB_PREFIX."c_lead_status"; $tabname[29]= MAIN_DB_PREFIX."c_lead_status";
$tabname[30]= MAIN_DB_PREFIX."c_format_cards"; $tabname[30]= MAIN_DB_PREFIX."c_format_cards";
//$tabname[31]= MAIN_DB_PREFIX."accounting_system"; //$tabname[31]= MAIN_DB_PREFIX."accounting_system";
//$tabname[32]= MAIN_DB_PREFIX."c_accounting_category"; $tabname[32]= MAIN_DB_PREFIX."c_hrm_public_holiday";
$tabname[33]= MAIN_DB_PREFIX."c_hrm_department"; $tabname[33]= MAIN_DB_PREFIX."c_hrm_department";
$tabname[34]= MAIN_DB_PREFIX."c_hrm_function"; $tabname[34]= MAIN_DB_PREFIX."c_hrm_function";
$tabname[35]= MAIN_DB_PREFIX."c_exp_tax_cat"; $tabname[35]= MAIN_DB_PREFIX."c_exp_tax_cat";
$tabname[36]= MAIN_DB_PREFIX."c_exp_tax_range"; $tabname[36]= MAIN_DB_PREFIX."c_exp_tax_range";
$tabname[37]= MAIN_DB_PREFIX."c_units"; $tabname[37]= MAIN_DB_PREFIX."c_units";
@@ -163,7 +164,7 @@ $tablib[28]= "DictionaryHolidayTypes";
$tablib[29]= "DictionaryOpportunityStatus"; $tablib[29]= "DictionaryOpportunityStatus";
$tablib[30]= "DictionaryFormatCards"; $tablib[30]= "DictionaryFormatCards";
//$tablib[31]= "DictionaryAccountancysystem"; //$tablib[31]= "DictionaryAccountancysystem";
//$tablib[32]= "DictionaryAccountancyCategory"; $tablib[32]= "DictionaryPublicHolidays";
$tablib[33]= "DictionaryDepartment"; $tablib[33]= "DictionaryDepartment";
$tablib[34]= "DictionaryFunction"; $tablib[34]= "DictionaryFunction";
$tablib[35]= "DictionaryExpenseTaxCat"; $tablib[35]= "DictionaryExpenseTaxCat";
@@ -203,7 +204,7 @@ $tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.new
$tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status"; $tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
$tabsql[30]= "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards"; $tabsql[30]= "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
//$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s"; //$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s";
//$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1"; $tabsql[32]= "SELECT a.id as rowid, a.entity, a.code, a.fk_country as country_id, c.code as country_code, c.label as country, a.day, a.month, a.year, a.active FROM ".MAIN_DB_PREFIX."c_hrm_public_holiday as a LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON a.fk_country=c.rowid AND c.active=1";
$tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department"; $tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department";
$tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function"; $tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
$tabsql[35]= "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c"; $tabsql[35]= "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c";
@@ -243,7 +244,7 @@ $tabsqlsort[28]="country ASC, code ASC";
$tabsqlsort[29]="position ASC"; $tabsqlsort[29]="position ASC";
$tabsqlsort[30]="code ASC"; $tabsqlsort[30]="code ASC";
//$tabsqlsort[31]="pcg_version ASC"; //$tabsqlsort[31]="pcg_version ASC";
//$tabsqlsort[32]="position ASC"; $tabsqlsort[32]="year ASC, month ASC, day ASC";
$tabsqlsort[33]="code ASC"; $tabsqlsort[33]="code ASC";
$tabsqlsort[34]="code ASC"; $tabsqlsort[34]="code ASC";
$tabsqlsort[35]="c.label ASC"; $tabsqlsort[35]="c.label ASC";
@@ -283,7 +284,7 @@ $tabfield[28]= "code,label,affect,delay,newbymonth,country_id,country";
$tabfield[29]= "code,label,percent,position"; $tabfield[29]= "code,label,percent,position";
$tabfield[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; $tabfield[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfield[31]= "pcg_version,label"; //$tabfield[31]= "pcg_version,label";
//$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country"; $tabfield[32]= "code,year,month,day,country_id,country";
$tabfield[33]= "code,label"; $tabfield[33]= "code,label";
$tabfield[34]= "code,label"; $tabfield[34]= "code,label";
$tabfield[35]= "label"; $tabfield[35]= "label";
@@ -323,7 +324,7 @@ $tabfieldvalue[28]= "code,label,affect,delay,newbymonth,country";
$tabfieldvalue[29]= "code,label,percent,position"; $tabfieldvalue[29]= "code,label,percent,position";
$tabfieldvalue[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; $tabfieldvalue[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfieldvalue[31]= "pcg_version,label"; //$tabfieldvalue[31]= "pcg_version,label";
//$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country"; $tabfieldvalue[32]= "code,day,month,year,country";
$tabfieldvalue[33]= "code,label"; $tabfieldvalue[33]= "code,label";
$tabfieldvalue[34]= "code,label"; $tabfieldvalue[34]= "code,label";
$tabfieldvalue[35]= "label"; $tabfieldvalue[35]= "label";
@@ -364,15 +365,16 @@ $tabfieldinsert[29]= "code,label,percent,position";
$tabfieldinsert[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; $tabfieldinsert[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfieldinsert[31]= "pcg_version,label"; //$tabfieldinsert[31]= "pcg_version,label";
//$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country"; //$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
$tabfieldinsert[32]= "code,day,month,year,fk_country";
$tabfieldinsert[33]= "code,label"; $tabfieldinsert[33]= "code,label";
$tabfieldinsert[34]= "code,label"; $tabfieldinsert[34]= "code,label";
$tabfieldinsert[35]= "label"; $tabfieldinsert[35]= "label";
$tabfieldinsert[36]= "range_ik,fk_c_exp_tax_cat"; $tabfieldinsert[36]= "range_ik,fk_c_exp_tax_cat";
$tabfieldinsert[37]= "code,label,short_label,unit_type,scale"; $tabfieldinsert[37]= "code,label,short_label,unit_type,scale";
// Rowid name if the field is not autoincrement type // Rowid name of field depending if field is autoincrement on or off..
// Example: "" if id field is "rowid" and has autoincrement on // Use "" if id field is "rowid" and has autoincrement on
// "nameoffield" if id field is not "rowid" or has not autoincrement on // Use "nameoffield" if id field is not "rowid" or has not autoincrement on
$tabrowid=array(); $tabrowid=array();
$tabrowid[1] = ""; $tabrowid[1] = "";
$tabrowid[2] = ""; $tabrowid[2] = "";
@@ -405,7 +407,7 @@ $tabrowid[28]= "";
$tabrowid[29]= ""; $tabrowid[29]= "";
$tabrowid[30]= ""; $tabrowid[30]= "";
//$tabrowid[31]= ""; //$tabrowid[31]= "";
//$tabrowid[32]= ""; $tabrowid[32]= "id";
$tabrowid[33]= "rowid"; $tabrowid[33]= "rowid";
$tabrowid[34]= "rowid"; $tabrowid[34]= "rowid";
$tabrowid[35]= ""; $tabrowid[35]= "";
@@ -445,7 +447,7 @@ $tabcond[28]= ! empty($conf->holiday->enabled);
$tabcond[29]= ! empty($conf->projet->enabled); $tabcond[29]= ! empty($conf->projet->enabled);
$tabcond[30]= ! empty($conf->label->enabled); $tabcond[30]= ! empty($conf->label->enabled);
//$tabcond[31]= ! empty($conf->accounting->enabled); //$tabcond[31]= ! empty($conf->accounting->enabled);
//$tabcond[32]= ! empty($conf->accounting->enabled); $tabcond[32]= (! empty($conf->holiday->enabled) || ! empty($conf->hrm->enabled));
$tabcond[33]= ! empty($conf->hrm->enabled); $tabcond[33]= ! empty($conf->hrm->enabled);
$tabcond[34]= ! empty($conf->hrm->enabled); $tabcond[34]= ! empty($conf->hrm->enabled);
$tabcond[35]= ! empty($conf->expensereport->enabled); $tabcond[35]= ! empty($conf->expensereport->enabled);
@@ -485,12 +487,12 @@ $tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"),'delay'=>$lan
$tabhelp[29] = array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList")); $tabhelp[29] = array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[30] = array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->trans("LabelName"), 'paper_size'=>$langs->trans("LabelPaperSize")); $tabhelp[30] = array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->trans("LabelName"), 'paper_size'=>$langs->trans("LabelPaperSize"));
//$tabhelp[31] = array('pcg_version'=>$langs->trans("EnterAnyCode")); //$tabhelp[31] = array('pcg_version'=>$langs->trans("EnterAnyCode"));
//$tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode"), 'daterule'=>"Use 'date'", 'country'=>$langs->trans("EnterACountryOnlyIfSpecificToOneCountry"), 'year'=>$langs->trans("ZeroMeansEveryYear"));
$tabhelp[33] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[33] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[35]= array(); $tabhelp[35] = array();
$tabhelp[36]= array('range_ik'=>$langs->trans('PrevRangeToThisRange')); $tabhelp[36] = array('range_ik'=>$langs->trans('PrevRangeToThisRange'));
$tabhelp[37]= array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[37] = array('code'=>$langs->trans("EnterAnyCode"));
// List of check for fields (NOT USED YET) // List of check for fields (NOT USED YET)
$tabfieldcheck=array(); $tabfieldcheck=array();
@@ -525,12 +527,12 @@ $tabfieldcheck[28] = array();
$tabfieldcheck[29] = array(); $tabfieldcheck[29] = array();
$tabfieldcheck[30] = array(); $tabfieldcheck[30] = array();
//$tabfieldcheck[31] = array(); //$tabfieldcheck[31] = array();
//$tabfieldcheck[32] = array(); $tabfieldcheck[32] = array();
$tabfieldcheck[33] = array(); $tabfieldcheck[33] = array();
$tabfieldcheck[34] = array(); $tabfieldcheck[34] = array();
$tabfieldcheck[35]= array(); $tabfieldcheck[35] = array();
$tabfieldcheck[36]= array(); $tabfieldcheck[36] = array();
$tabfieldcheck[37]= array(); $tabfieldcheck[37] = array();
// Complete all arrays with entries found into modules // Complete all arrays with entries found into modules
complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabfieldcheck); complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabfieldcheck);
@@ -621,8 +623,10 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$ok=1; $ok=1;
foreach ($listfield as $f => $value) foreach ($listfield as $f => $value)
{ {
if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp','DictionaryAccountancysystem','DictionaryAccountancyCategory'))) continue; // For some pages, country is not mandatory // Discard check of mandatory fields for country for some tables
if ($value == 'country' && in_array($tablib[$id], array('DictionaryCanton','DictionaryCompanyType','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryPublicHolidays','DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp','DictionaryAccountancysystem','DictionaryAccountancyCategory'))) continue; // For some pages, country is not mandatory
if ($value == 'country' && in_array($tablib[$id], array('DictionaryPublicHolidays','DictionaryCanton','DictionaryCompanyType','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
// Discard check of mandatory fiedls for other fields
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue; if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue; if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
if ($value == 'color' && empty($_POST['color'])) continue; if ($value == 'color' && empty($_POST['color'])) continue;
@@ -992,8 +996,10 @@ if ($id)
if (! preg_match('/ WHERE /', $sql)) $sql.= " WHERE 1 = 1"; if (! preg_match('/ WHERE /', $sql)) $sql.= " WHERE 1 = 1";
if ($search_country_id > 0) $sql.= " AND c.rowid = ".$search_country_id; if ($search_country_id > 0) $sql.= " AND c.rowid = ".$search_country_id;
if ($search_code != '' && $id != 9) $sql.= natural_search("code", $search_code);
if ($search_code != '' && $id == 9) $sql.= natural_search("code_iso", $search_code); if ($search_code != '' && $id == 9) $sql.= natural_search("code_iso", $search_code);
elseif ($search_code != '' && $id == 28) $sql.= natural_search("h.code", $search_code);
elseif ($search_code != '' && $id == 32) $sql.= natural_search("a.code", $search_code);
elseif ($search_code != '' && $id != 9) $sql.= natural_search("code", $search_code);
if ($sortfield) if ($sortfield)
{ {
@@ -1053,7 +1059,7 @@ if ($id)
continue; continue;
} }
// Define field friedly name from its technical name // Define field friendly name from its technical name
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
$valuetoshow=$langs->trans($valuetoshow); // try to translate $valuetoshow=$langs->trans($valuetoshow); // try to translate
$class=''; $class='';
@@ -1156,7 +1162,8 @@ if ($id)
print '</tr>'; print '</tr>';
// Line to enter new values // Line to enter new values
print '<!-- line to add new entry --><tr class="oddeven nodrag nodrop nohover">'; print '<!-- line to add new entry -->';
print '<tr class="oddeven nodrag nodrop nohover">';
$obj = new stdClass(); $obj = new stdClass();
// If data was already input, we define them in obj to populate input fields. // If data was already input, we define them in obj to populate input fields.
@@ -1632,10 +1639,10 @@ if ($id)
if ($obj->code == 'RECEP') $canbemodified=1; if ($obj->code == 'RECEP') $canbemodified=1;
if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm") $canbemodified=1; if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm") $canbemodified=1;
// Url // Build Url. The table is id=, the id of line is rowid=
$rowidcol=$tabrowid[$id]; $rowidcol=$tabrowid[$id];
// If rowidcol not defined // If rowidcol not defined
if (empty($rowidcol) || in_array($id, array(6,7,8,13,17,19,27))) $rowidcol='rowid'; if (empty($rowidcol) || in_array($id, array(6,7,8,13,17,19,27,32))) $rowidcol='rowid';
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.((! empty($obj->{$rowidcol}) || $obj->{$rowidcol} == '0')?$obj->{$rowidcol}:(! empty($obj->code)?urlencode($obj->code):'')).'&code='.(! empty($obj->code)?urlencode($obj->code):''); $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.((! empty($obj->{$rowidcol}) || $obj->{$rowidcol} == '0')?$obj->{$rowidcol}:(! empty($obj->code)?urlencode($obj->code):'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
if (! empty($param)) $url .= '&'.$param; if (! empty($param)) $url .= '&'.$param;
if (! is_null($withentity)) $url .= '&entity='.$withentity; if (! is_null($withentity)) $url .= '&entity='.$withentity;
@@ -1971,7 +1978,6 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
} }
else else
{ {
$fieldValue = isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''; $fieldValue = isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'';
if ($fieldlist[$field]=='sortorder') if ($fieldlist[$field]=='sortorder')
@@ -1981,11 +1987,11 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
$classtd=''; $class=''; $classtd=''; $class='';
if ($fieldlist[$field]=='code') $class='maxwidth100'; if ($fieldlist[$field]=='code') $class='maxwidth100';
if (in_array($fieldlist[$field], array('pos', 'use_default', 'affect', 'delay', 'position', 'sortorder', 'sens', 'category_type'))) $class='maxwidth50'; if (in_array($fieldlist[$field], array('dayrule', 'day', 'month', 'year', 'pos', 'use_default', 'affect', 'delay', 'position', 'sortorder', 'sens', 'category_type'))) $class='maxwidth50';
if (in_array($fieldlist[$field], array('libelle', 'label', 'tracking'))) $class='quatrevingtpercent'; if (in_array($fieldlist[$field], array('libelle', 'label', 'tracking'))) $class='quatrevingtpercent';
print '<td class="'.$classtd.'">'; print '<td class="'.$classtd.'">';
$transfound=0; $transfound=0;
if (in_array($fieldlist[$field], array('label','libelle'))) if (in_array($fieldlist[$field], array('label','libelle'))) // For label
{ {
$transkey=''; $transkey='';
// Special case for labels // Special case for labels

View File

@@ -1094,6 +1094,8 @@ function complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tab
{ {
global $db, $modules, $conf, $langs; global $db, $modules, $conf, $langs;
dol_syslog("complete_dictionary_with_modules Search external modules to complete the list of dictionnary tables", LOG_DEBUG, 1);
// Search modules // Search modules
$modulesdir = dolGetModulesDirs(); $modulesdir = dolGetModulesDirs();
$i = 0; // is a sequencer of modules found $i = 0; // is a sequencer of modules found
@@ -1191,6 +1193,8 @@ function complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tab
} }
} }
dol_syslog("", LOG_DEBUG, -1);
return 1; return 1;
} }
@@ -1259,7 +1263,7 @@ function activateModulesRequiredByCountry($country_code)
} }
/** /**
* Add external modules to list of contact element * Search external modules to complete the list of contact element
* *
* @param array $elementList elementList * @param array $elementList elementList
* @return int 1 * @return int 1
@@ -1278,6 +1282,8 @@ function complete_elementList_with_modules(&$elementList)
$i = 0; // is a sequencer of modules found $i = 0; // is a sequencer of modules found
$j = 0; // j is module number. Automatically affected if module number not defined. $j = 0; // j is module number. Automatically affected if module number not defined.
dol_syslog("complete_elementList_with_modules Search external modules to complete the list of contact element", LOG_DEBUG, 1);
$modulesdir = dolGetModulesDirs(); $modulesdir = dolGetModulesDirs();
foreach ($modulesdir as $dir) foreach ($modulesdir as $dir)
@@ -1355,6 +1361,8 @@ function complete_elementList_with_modules(&$elementList)
} }
} }
dol_syslog("", LOG_DEBUG, -1);
return 1; return 1;
} }

View File

@@ -0,0 +1,43 @@
-- Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
-- Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
-- Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be>
-- Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
-- Copyright (C) 2019 Markus Welters <markus@welters.de>
--
-- 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
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
--
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
-- de l'install et tous les sigles '--' sont supprimés.
--
-- LIST ON https://fr.wikipedia.org/wiki/Jour_férié
-- A lot of countries
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('NEWYEARDAY1', 0, 0, 0, 1, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('LABORDAY1', 0, 0, 0, 5, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('CHRISTMASDAY1', 0, 0, 0, 12, 25, 1);
-- France only
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('FRVICTORYDAY', 0, 1, 0, 5, 8, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('FRNATIONALDAY', 0, 1, 0, 7, 14, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('FRASSOMPTION', 0, 1, 0, 8, 15, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('FRTOUSSAINT', 0, 1, 0, 11, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('FRARMISTICE', 0, 1, 0, 11, 11, 1);

View File

@@ -90,4 +90,19 @@ ALTER TABLE llx_projet ADD COLUMN usage_organize_event integer DEFAULT 0;
UPDATE llx_projet set usage_opportunity = 1 WHERE fk_opp_status > 0; UPDATE llx_projet set usage_opportunity = 1 WHERE fk_opp_status > 0;
create table llx_c_hrm_public_holiday
(
id integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 0 NOT NULL, -- multi company id, 0 = all
fk_country integer,
code varchar(62),
dayrule varchar(255) DEFAULT 'date', -- 'date', 'xxx', ...
day integer,
month integer,
year integer, -- 0 for all years
active integer DEFAULT 1,
import_key varchar(14)
)ENGINE=innodb;

View File

@@ -36,5 +36,4 @@ create table llx_c_field_list
visible tinyint DEFAULT 1 NOT NULL, -- visibility of field. 0=Never visible, 1=Visible on list and forms, 2=Visible on list only visible tinyint DEFAULT 1 NOT NULL, -- visibility of field. 0=Never visible, 1=Visible on list and forms, 2=Visible on list only
enabled varchar(255) DEFAULT 1, -- Condition to show or hide enabled varchar(255) DEFAULT 1, -- Condition to show or hide
rang integer DEFAULT 0 rang integer DEFAULT 0
)ENGINE=innodb; )ENGINE=innodb;

View File

@@ -0,0 +1,21 @@
-- ========================================================================
-- Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- 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
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ========================================================================
ALTER TABLE llx_c_hrm_public_holiday ADD UNIQUE INDEX uk_c_hrm_public_holiday(entity, code);
ALTER TABLE llx_c_hrm_public_holiday ADD UNIQUE INDEX uk_c_hrm_public_holiday2(entity, day, month, year);

View File

@@ -0,0 +1,31 @@
-- ========================================================================
-- Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- 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
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ========================================================================
create table llx_c_hrm_public_holiday
(
id integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 0 NOT NULL, -- multi company id, 0 = all
fk_country integer,
code varchar(62),
dayrule varchar(255) DEFAULT 'date', -- 'date', 'xxx', ...
day integer,
month integer,
year integer, -- 0 for all years
active integer DEFAULT 1,
import_key varchar(14)
)ENGINE=innodb;

View File

@@ -9,6 +9,7 @@ ConfirmDeleteEstablishment=Are you sure you wish to delete this establishment?
OpenEtablishment=Open establishment OpenEtablishment=Open establishment
CloseEtablishment=Close establishment CloseEtablishment=Close establishment
# Dictionary # Dictionary
DictionaryPublicHolidays=HRM - Public holidays
DictionaryDepartment=HRM - Department list DictionaryDepartment=HRM - Department list
DictionaryFunction=HRM - Function list DictionaryFunction=HRM - Function list
# Module # Module