diff --git a/.travis.yml b/.travis.yml index 3009ff69c01..c1bed319447 100644 --- a/.travis.yml +++ b/.travis.yml @@ -406,8 +406,9 @@ script: php step5.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-3.log # Enable modules not enabled into original dump - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_PRODUCTBATCH,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP > $TRAVIS_BUILD_DIR/enablemodule.log - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT > $TRAVIS_BUILD_DIR/enablemodule.log + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_PRODUCTBATCH,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_STRIPE > $TRAVIS_BUILD_DIR/enablemodule.log + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP >> $TRAVIS_BUILD_DIR/enablemodule.log + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $TRAVIS_BUILD_DIR/enablemodule.log echo $? cd - set +e diff --git a/COPYRIGHT b/COPYRIGHT index 4f4bc3dff6d..21e37f39f1d 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -32,7 +32,7 @@ PSR/simple-cache ? Library for cache (used by PHPSp Restler 3.1.1 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer) Sabre 3.2.2 BSD Yes DAV support Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP -Stripe 6.43.1 MIT licence Yes Library for Stripe module +Stripe 7.67.0 MIT licence Yes Library for Stripe module TCPDF 6.3.2 LGPL-3+ Yes PDF generation TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement diff --git a/ChangeLog b/ChangeLog index 4877363e6be..ecf20be261f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -57,7 +57,6 @@ NEW: add option TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT NEW: add option to define a default warehouse at user level NEW: add option to include products without alert in replenish NEW: add order by lastname and firstname by default in get sales representatives -NEW: add param to not show links when output tags NEW: add PDF document templates for warehouses (list of stock) NEW: add a prospect status for the contact with managment of custom icon NEW: add public note on products ; this also partially fix the #14342 @@ -80,7 +79,7 @@ NEW: appearance tab in TakePOS with more visual parameters NEW: better currency rate editor NEW: can build vendor invoice from vendor orders NEW: can change a product in lines of a recurring invoice or contract -NEW: can change size of logo on PDF documents +NEW: can set the size of the logo on PDF documents NEW: can change VAT rate of all lines of a draft object in one step NEW: can define date range of validity of a login during creation NEW: can disable, from edit page, the whole web site @@ -189,7 +188,7 @@ NEW: show line number on intervention card (via MAIN_VIEW_LINE_NUMBER) NEW: Add some fields to link website page to an other object NEW: fill ECM src object fields in dol_add_file_process NEW: conf to allow to show the full tree in warehouse popup -NEW: can use THEME_DARKMODEENABLED=2 for a preview of theme in dark mode +NEW: can use parameter ?THEME_DARKMODEENABLED=2 for a preview of theme in dark mode NEW: can force the antivirus from conf file or autoprepend ini setup NEW: can add event to log into blockedlog module with a constant NEW: add property cssview when declaring fields of an object @@ -208,6 +207,7 @@ NEW: add a message in error_log after detection of SQL or script injection NEW: add validation of MX domain for emails NEW: calculate the virtual stock in transverse mode ( not on getEntity('commande'), ... but on getEntity('stock') ) NEW: Graphics can be horizontal bars +NEW: add param to not show links when output tags APIs NEW: API get contacts list of a given order diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index f3374c43234..e207afa5658 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -133,17 +133,15 @@ with } } elseif (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { - -* In tecnickcom/tcpdf/include/tcpdf_static, in function fopenLocal, replace +* In tecnickcom/tcpdf/include/tcpdf_static.php, in function fopenLocal, replace if (strpos($filename, '://') === false) { with - if (strpos($filename, '//') === 0) - { + if (strpos($filename, '//') === 0) { // Share folder on a (windows) server // e.g.: "//[MyServerName]/[MySharedFolder]/" // @@ -175,17 +173,17 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php TCPDI: ------ -Add fpdf_tpl.php 1.2 +Add file fpdf_tpl.php 1.2 -Add tcpdi.php +Add file tcpdi.php -Add tcpdi_parser.php and replace: -require_once(dirname(__FILE__).'/include/tcpdf_filters.php'); +Add file tcpdi_parser.php and replace: + require_once(dirname(__FILE__).'/include/tcpdf_filters.php'); with: -require_once(dirname(__FILE__).'/../tecnickcom/tcpdf/include/tcpdf_filters.php'); + require_once(dirname(__FILE__).'/../tecnickcom/tcpdf/include/tcpdf_filters.php'); -* Fix by replacing +* Fix syntax error by replacing } elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1] >= 2))) { with } elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1]) >= 2)) { @@ -195,23 +193,23 @@ with JSGANTT: -------- * Replace in function JSGantt.taskLink -var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth); + var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth); with -// LDR To open in same window -//var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth); -window.location.href=pRef + // LDR To open in same window + //var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth); + window.location.href=pRef * Replace -vTmpDiv=this.newNode(vTmpCell, 'div', null, null, vTaskList[i].getResource()); + vTmpDiv=this.newNode(vTmpCell, 'div', null, null, vTaskList[i].getResource()); with -var vTmpNode=this.newNode(vTmpCell, 'div', null, ''); -vTmpNode=this.newNode(vTmpNode, 'a', null, '', vLangs[vLang]['moreinfo']); -vTmpNode.setAttribute('href',vTaskList[i].getLink()); + var vTmpNode=this.newNode(vTmpCell, 'div', null, ''); + vTmpNode=this.newNode(vTmpNode, 'a', null, '', vLangs[vLang]['moreinfo']); + vTmpNode.setAttribute('href',vTaskList[i].getLink()); * Replace '% Comp.' to have a smaller text column header -'comp':'% Comp.' + 'comp':'% Comp.' with -'comp':'%' + 'comp':'%' diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 124b8dcf1dd..6499db671cb 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -462,10 +462,10 @@ if (empty($reshook) && $action == 'update') if (empty($cancel)) { $fulldayevent = GETPOST('fullday'); - $aphour = GETPOST('aphour'); - $apmin = GETPOST('apmin'); - $p2hour = GETPOST('p2hour'); - $p2min = GETPOST('p2min'); + $aphour = GETPOST('aphour', 'int'); + $apmin = GETPOST('apmin', 'int'); + $p2hour = GETPOST('p2hour', 'int'); + $p2min = GETPOST('p2min', 'int'); $percentage = in_array(GETPOST('status'), array(-1, 100)) ?GETPOST('status') : (in_array(GETPOST('complete'), array(-1, 100)) ?GETPOST('complete') : GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status // Clean parameters @@ -479,8 +479,8 @@ if (empty($reshook) && $action == 'update') $object->fetch_userassigned(); $object->oldcopy = clone $object; - $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); - $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); + $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int')); + $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int')); $object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm'); $object->label = GETPOST("label", "alphanohtml"); @@ -1324,8 +1324,8 @@ if ($id > 0) { $percentage = in_array(GETPOST('status'), array(-1, 100)) ?GETPOST('status') : (in_array(GETPOST('complete'), array(-1, 100)) ?GETPOST('complete') : GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status - $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); - $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); + $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int')); + $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int')); $object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm'); $object->label = GETPOST("label", "alphanohtml"); @@ -1431,7 +1431,7 @@ if ($id > 0) // Full day event print ''.$langs->trans("EventOnFullDay").'fulldayevent ? ' checked' : '').'>'; - // Date start + // Date start - end print ''.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").''; if (GETPOST("afaire") == 1) { print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart'); diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 613ac76380e..5b4cc58bb08 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -208,7 +208,7 @@ if ($object->id > 0) if (!empty($object->userassigned)) // Now concat assigned users { // Restore array with key with same value than param 'id' - $tmplist1 = $object->userassigned; $tmplist2 = array(); + $tmplist1 = $object->userassigned; foreach ($tmplist1 as $key => $val) { if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']] = $val; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index f5822669bba..b37762a644a 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -272,17 +272,17 @@ if (empty($action) || $action == 'show_month') $next_year = $next['year']; $next_month = $next['month']; - $max_day_in_prev_month = date("t", dol_mktime(0, 0, 0, $prev_month, 1, $prev_year)); // Nb of days in previous month + $max_day_in_prev_month = date("t", dol_mktime(0, 0, 0, $prev_month, 1, $prev_year, 'gmt')); // Nb of days in previous month $max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year)); // Nb of days in next month // tmpday is a negative or null cursor to know how many days before the 1st to show on month view (if tmpday=0, 1st is monday) - $tmpday = -date("w", dol_mktime(12, 0, 0, $month, 1, $year, true)) + 2; // date('w') is 0 fo sunday + $tmpday = -date("w", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')) + 2; // date('w') is 0 fo sunday $tmpday += ((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1) - 1); if ($tmpday >= 1) $tmpday -= 7; // If tmpday is 0 we start with sunday, if -6, we start with monday of previous week. // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) - $firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $max_day_in_prev_month + $tmpday, $prev_year); + $firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $max_day_in_prev_month + $tmpday, $prev_year, 'gmt'); $next_day = 7 - ($max_day_in_month + 1 - $tmpday) % 7; if ($next_day < 6) $next_day += 7; - $lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year); + $lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year, 'gmt'); } if ($action == 'show_week') { @@ -303,7 +303,7 @@ if ($action == 'show_week') $next_day = $next['day']; // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) - $firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year); + $firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year, 'gmt'); $lastdaytoshow = dol_time_plus_duree($firstdaytoshow, 7, 'd'); $max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year)); @@ -322,8 +322,8 @@ if ($action == 'show_day') $next_day = $next['day']; // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) - $firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $prev_day, $prev_year); - $lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year); + $firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $prev_day, $prev_year, 'gmt'); + $lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year, 'gmt'); } //print 'xx'.$prev_year.'-'.$prev_month.'-'.$prev_day; //print 'xx'.$next_year.'-'.$next_month.'-'.$next_day; @@ -399,13 +399,14 @@ $param .= '&year='.$year.'&month='.$month.($day ? '&day='.$day : ''); -$tabactive = ''; +/*$tabactive = ''; if ($action == 'show_month') $tabactive = 'cardmonth'; if ($action == 'show_week') $tabactive = 'cardweek'; if ($action == 'show_day') $tabactive = 'cardday'; if ($action == 'show_list') $tabactive = 'cardlist'; if ($action == 'show_pertuser') $tabactive = 'cardperuser'; if ($action == 'show_pertype') $tabactive = 'cardpertype'; +*/ $paramnoaction = preg_replace('/action=[a-z_]+/', '', $param); @@ -704,9 +705,7 @@ if ($resql) } // Check values - if ($event->date_end_in_calendar < $firstdaytoshow || - $event->date_start_in_calendar >= $lastdaytoshow) - { + if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow) { // This record is out of visible range } else { if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar = $firstdaytoshow; @@ -714,13 +713,15 @@ if ($resql) // Add an entry in actionarray for each day $daycursor = $event->date_start_in_calendar; - $annee = date('Y', $daycursor); - $mois = date('m', $daycursor); - $jour = date('d', $daycursor); + $annee = dol_print_date($daycursor, '%Y'); + $mois = dol_print_date($daycursor, '%m'); + $jour = dol_print_date($daycursor, '%d'); + //var_dump(dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt')); + //var_dump($annee.'-'.$mois.'-'.$jour); // Loop on each day covered by action to prepare an index to show on calendar $loop = true; $j = 0; - $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee); + $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); do { //if ($event->id==408) print 'daykey='.$daykey.' '.$event->datep.' '.$event->datef.'
'; @@ -787,9 +788,9 @@ if ($showbirthday) // Add an entry in actionarray for each day $daycursor = $event->date_start_in_calendar; - $annee = date('Y', $daycursor); - $mois = date('m', $daycursor); - $jour = date('d', $daycursor); + $annee = dol_print_date($daycursor, '%Y'); + $mois = dol_print_date($daycursor, '%m'); + $jour = dol_print_date($daycursor, '%d'); $loop = true; $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee); @@ -870,9 +871,11 @@ if ($conf->global->AGENDA_SHOW_HOLIDAYS) $event->label = $obj->lastname; } - $annee = date('Y', $event->date_start_in_calendar); - $mois = date('m', $event->date_start_in_calendar); - $jour = date('d', $event->date_start_in_calendar); + $daycursor = $event->date_start_in_calendar; + $annee = dol_print_date($daycursor, '%Y'); + $mois = dol_print_date($daycursor, '%m'); + $jour = dol_print_date($daycursor, '%d'); + $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee); do { @@ -1530,6 +1533,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $annee = date('Y', $daykey); $mois = date('m', $daykey); $jour = date('d', $daykey); + if ($day == $jour && $month == $mois && $year == $annee) { foreach ($eventarray[$daykey] as $index => $event) @@ -1696,6 +1700,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $tmpyearend = date('Y', $event->date_end_in_calendar); $tmpmonthend = date('m', $event->date_end_in_calendar); $tmpdayend = date('d', $event->date_end_in_calendar); + /*var_dump($tmpyearstart.' '.$tmpmonthstart.' '.$tmpdaystart); + var_dump($tmpyearend.' '.$tmpmonthend.' '.$tmpdayend); + var_dump($annee.' '.$mois.' '.$jour);*/ + // Hour start if ($tmpyearstart == $annee && $tmpmonthstart == $mois && $tmpdaystart == $jour) { diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index c5f81e358cc..29b86b96868 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -265,13 +265,13 @@ $next_month = $month; $next_day = $day; // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) -$firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year); +$firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year, 'gmt'); $lastdaytoshow = dol_time_plus_duree($firstdaytoshow, 7, 'd'); //print $firstday.'-'.$first_month.'-'.$first_year; //print dol_print_date($firstdaytoshow,'dayhour'); //print dol_print_date($lastdaytoshow,'dayhour'); -$max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year)); +$max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year, 'gmt')); $tmpday = $first_day; $picto = 'calendarweek'; @@ -291,14 +291,6 @@ $param .= '&year='.urlencode($year).'&month='.urlencode($month).($day ? '&day='. //print 'x'.$param; -$tabactive = ''; -if ($action == 'show_month') $tabactive = 'cardmonth'; -if ($action == 'show_week') $tabactive = 'cardweek'; -if ($action == 'show_day') $tabactive = 'cardday'; -if ($action == 'show_list') $tabactive = 'cardlist'; -if ($action == 'show_peruser') $tabactive = 'cardperuser'; -if ($action == 'show_pertype') $tabactive = 'cardpertype'; - $paramnoaction = preg_replace('/action=[a-z_]+/', '', $param); $head = calendars_prepare_head($paramnoaction); @@ -598,13 +590,13 @@ if ($resql) // Add an entry in actionarray for each day $daycursor = $event->date_start_in_calendar; - $annee = date('Y', $daycursor); - $mois = date('m', $daycursor); - $jour = date('d', $daycursor); + $annee = dol_print_date($daycursor, '%Y'); + $mois = dol_print_date($daycursor, '%m'); + $jour = dol_print_date($daycursor, '%d'); // Loop on each day covered by action to prepare an index to show on calendar $loop = true; $j = 0; - $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee); + $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); do { //if ($event->id==408) print 'daykey='.$daykey.' '.$event->datep.' '.$event->datef.'
'; @@ -735,7 +727,7 @@ foreach ($typeofevents as $typeofevent) if ($todayarray['mday'] == $tmpday && $todayarray['mon'] == $tmpmonth && $todayarray['year'] == $tmpyear) $today = 1; if ($today) $style = 'cal_today_peruser'; - show_day_events_pertype($typeofevent, $tmpday, $tmpmonth, $tmpyear, $mont, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype, $var); + show_day_events_pertype($typeofevent, $tmpday, $tmpmonth, $tmpyear, 0, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype, $var); $i++; } @@ -848,8 +840,6 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s $cases1 = array(); // Color first half hour $cases2 = array(); // Color second half hour - $curtime = dol_mktime(0, 0, 0, $month, $day, $year, false, 0); - $i = 0; $nummytasks = 0; $numother = 0; $numbirthday = 0; $numical = 0; $numicals = array(); $ymd = sprintf("%04d", $year).sprintf("%02d", $month).sprintf("%02d", $day); @@ -859,16 +849,16 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s // We are in a particular day for $username, now we scan all events foreach ($eventarray as $daykey => $notused) { - $annee = date('Y', $daykey); - $mois = date('m', $daykey); - $jour = date('d', $daykey); - //print $annee.'-'.$mois.'-'.$jour.' '.$year.'-'.$month.'-'.$day."
\n"; + $annee = dol_print_date($daykey, '%Y', 'gmt'); + $mois = dol_print_date($daykey, '%m', 'gmt'); + $jour = dol_print_date($daykey, '%d', 'gmt'); if ($day == $jour && $month == $mois && $year == $annee) // Is it the day we are looking for when calling function ? { // Scan all event for this date foreach ($eventarray[$daykey] as $index => $event) { + //print $daykey.' '.$year.'-'.$month.'-'.$day.' -> '.$event->id.' '.$index.' '.$annee.'-'.$mois.'-'.$jour."
\n"; //var_dump($event); $keysofuserassigned = array_keys($event->userassigned); @@ -932,9 +922,9 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s $newcolor = ''; //init if (empty($event->fulldayevent)) { - $a = dol_mktime((int) $h, 0, 0, $month, $day, $year, false, 0); - $b = dol_mktime((int) $h, 30, 0, $month, $day, $year, false, 0); - $c = dol_mktime((int) $h + 1, 0, 0, $month, $day, $year, false, 0); + $a = dol_mktime((int) $h, 0, 0, $month, $day, $year, 'auto', 0); + $b = dol_mktime((int) $h, 30, 0, $month, $day, $year, 'auto', 0); + $c = dol_mktime((int) $h + 1, 0, 0, $month, $day, $year, 'auto', 0); $dateendtouse = $event->date_end_in_calendar; if ($dateendtouse == $event->date_start_in_calendar) $dateendtouse++; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 3ddea1c0cbf..55e6725ba8d 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -268,7 +268,7 @@ $next_month = $next['month']; $next_day = $next['day']; // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) -$firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year); +$firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year, 'gmt'); $nb_weeks_to_show = (!empty($conf->global->AGENDA_NB_WEEKS_IN_VIEW_PER_USER)) ? ((int) $conf->global->AGENDA_NB_WEEKS_IN_VIEW_PER_USER * 7) : 7; $lastdaytoshow = dol_time_plus_duree($firstdaytoshow, $nb_weeks_to_show, 'd'); @@ -276,7 +276,7 @@ $lastdaytoshow = dol_time_plus_duree($firstdaytoshow, $nb_weeks_to_show, 'd'); //print dol_print_date($firstdaytoshow,'dayhour'); //print dol_print_date($lastdaytoshow,'dayhour'); -$max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year)); +$max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year, 'gmt')); $tmpday = $first_day; $picto = 'calendarweek'; @@ -296,15 +296,6 @@ $param .= '&year='.urlencode($year).'&month='.urlencode($month).($day ? '&day='. //print 'x'.$param; - -$tabactive = ''; -if ($action == 'show_month') $tabactive = 'cardmonth'; -if ($action == 'show_week') $tabactive = 'cardweek'; -if ($action == 'show_day') $tabactive = 'cardday'; -if ($action == 'show_list') $tabactive = 'cardlist'; -if ($action == 'show_peruser') $tabactive = 'cardperuser'; -if ($action == 'show_pertype') $tabactive = 'cardpertype'; - $paramnoaction = preg_replace('/action=[a-z_]+/', '', $param); $head = calendars_prepare_head($paramnoaction); @@ -605,13 +596,13 @@ if ($resql) // Add an entry in actionarray for each day $daycursor = $event->date_start_in_calendar; - $annee = date('Y', $daycursor); - $mois = date('m', $daycursor); - $jour = date('d', $daycursor); + $annee = dol_print_date($daycursor, '%Y'); + $mois = dol_print_date($daycursor, '%m'); + $jour = dol_print_date($daycursor, '%d'); // Loop on each day covered by action to prepare an index to show on calendar $loop = true; $j = 0; - $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee); + $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); do { //if ($event->id==408) print 'daykey='.$daykey.' '.$event->datep.' '.$event->datef.'
'; @@ -680,7 +671,7 @@ while ($currentdaytoshow < $lastdaytoshow) { // Filter on hours print img_picto('', 'clock', 'class="fawidth30 inline-block paddingleft"'); print ''.$langs->trans("Hours").''; - print "\n".'
'; + print "\n".'
'; print ''; if (empty($conf->dol_use_jmobile)) print ' - '; else print '
'; @@ -852,6 +843,7 @@ while ($currentdaytoshow < $lastdaytoshow) { $tmpday = $tmparray['mday']; $tmpmonth = $tmparray['mon']; $tmpyear = $tmparray['year']; + //var_dump($curtime.' '.$tmpday.' '.$tmpmonth.' '.$tmpyear); $style = 'cal_current_month'; if ($iter_day == 6) $style .= ' cal_other_month'; @@ -859,7 +851,7 @@ while ($currentdaytoshow < $lastdaytoshow) { if ($todayarray['mday'] == $tmpday && $todayarray['mon'] == $tmpmonth && $todayarray['year'] == $tmpyear) $today = 1; if ($today) $style = 'cal_today_peruser'; - show_day_events2($username, $tmpday, $tmpmonth, $tmpyear, $monthshown, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype, $var); + show_day_events2($username, $tmpday, $tmpmonth, $tmpyear, 0, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype, $var); $i++; } @@ -977,8 +969,6 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $cases1 = array(); // Color first half hour $cases2 = array(); // Color second half hour - $curtime = dol_mktime(0, 0, 0, $month, $day, $year, false, 0); - $i = 0; $numother = 0; $numbirthday = 0; $numical = 0; $numicals = array(); $ymd = sprintf("%04d", $year).sprintf("%02d", $month).sprintf("%02d", $day); @@ -989,16 +979,16 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & // We are in a particular day for $username, now we scan all events foreach ($eventarray as $daykey => $notused) { - $annee = date('Y', $daykey); - $mois = date('m', $daykey); - $jour = date('d', $daykey); - //print $annee.'-'.$mois.'-'.$jour.' '.$year.'-'.$month.'-'.$day."
\n"; + $annee = dol_print_date($daykey, '%Y', 'gmt'); + $mois = dol_print_date($daykey, '%m', 'gmt'); + $jour = dol_print_date($daykey, '%d', 'gmt'); if ($day == $jour && $month == $mois && $year == $annee) // Is it the day we are looking for when calling function ? { // Scan all event for this date foreach ($eventarray[$daykey] as $index => $event) { + //print $daykey.' '.$year.'-'.$month.'-'.$day.' -> '.$event->id.' '.$index.' '.$annee.'-'.$mois.'-'.$jour."
\n"; //var_dump($event); $keysofuserassigned = array_keys($event->userassigned); @@ -1088,9 +1078,9 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $newcolor = ''; //init if (empty($event->fulldayevent)) { - $a = dol_mktime((int) $h, 0, 0, $month, $day, $year, false, 0); - $b = dol_mktime((int) $h, 30, 0, $month, $day, $year, false, 0); - $c = dol_mktime((int) $h + 1, 0, 0, $month, $day, $year, false, 0); + $a = dol_mktime((int) $h, 0, 0, $month, $day, $year, 'auto', 0); + $b = dol_mktime((int) $h, 30, 0, $month, $day, $year, 'auto', 0); + $c = dol_mktime((int) $h + 1, 0, 0, $month, $day, $year, 'auto', 0); $dateendtouse = $event->date_end_in_calendar; if ($dateendtouse == $event->date_start_in_calendar) $dateendtouse++; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 76b22e29a96..e0f48e9498b 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -493,9 +493,10 @@ class Account extends CommonObject * @param string $banque Bank of cheque writer * @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on. * @param int $datev Date value + * @param string $num_releve Label of bank receipt for reconciliation * @return int Rowid of added entry, <0 if KO */ - public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null) + public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null, $num_releve = '') { // Deprecation warning if (is_numeric($oper)) { @@ -555,6 +556,7 @@ class Account extends CommonObject $accline->fk_account = $this->rowid; $accline->fk_type = $oper; $accline->numero_compte = $accountancycode; + $accline->num_releve = $num_releve; if ($num_chq) { $accline->num_chq = $num_chq; @@ -1886,6 +1888,7 @@ class AccountLine extends CommonObject $sql .= ", emetteur,banque"; $sql .= ", rappro"; $sql .= ", numero_compte"; + $sql .= ", num_releve"; $sql .= ") VALUES ("; $sql .= "'".$this->db->idate($this->datec)."'"; $sql .= ", '".$this->db->idate($this->dateo)."'"; @@ -1900,6 +1903,7 @@ class AccountLine extends CommonObject $sql .= ", ".($this->bank_chq ? "'".$this->db->escape($this->bank_chq)."'" : "null"); $sql .= ", ".(int) $this->rappro; $sql .= ", ".($this->numero_compte ? "'".$this->db->escape($this->numero_compte)."'" : "''"); + $sql .= ", ".($this->num_releve ? "'".$this->db->escape($this->num_releve)."'" : "null"); $sql .= ")"; dol_syslog(get_class($this)."::insert", LOG_DEBUG); diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 35104e5ed25..9ab02d8b18a 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -466,20 +466,23 @@ class BankAccounts extends DolibarrApi /** * Add a line to an account * - * @param int $id ID of account - * @param int $date Payment date (timestamp) {@from body} {@type timestamp} - * @param string $type Payment mode (TYP,VIR,PRE,LIQ,VAD,CB,CHQ...) {@from body} - * @param string $label Label {@from body} - * @param float $amount Amount (may be 0) {@from body} - * @param int $category Category - * @param string $cheque_number Cheque numberl {@from body} - * @param string $cheque_writer Name of cheque writer {@from body} - * @param string $cheque_bank Bank of cheque writer {@from body} + * @param int $id ID of account + * @param int $date Payment date (timestamp) {@from body} {@type timestamp} + * @param string $type Payment mode (TYP,VIR,PRE,LIQ,VAD,CB,CHQ...) {@from body} + * @param string $label Label {@from body} + * @param float $amount Amount (may be 0) {@from body} + * @param int $category Category + * @param string $cheque_number Cheque numero {@from body} + * @param string $cheque_writer Name of cheque writer {@from body} + * @param string $cheque_bank Bank of cheque writer {@from body} + * @param string $accountancycode Accountancy code {@from body} + * @param int $datev Payment date value (timestamp) {@from body} {@type timestamp} + * @param string $num_releve Bank statement numero {@from body} * @return int ID of line * * @url POST {id}/lines */ - public function addLine($id, $date, $type, $label, $amount, $category = 0, $cheque_number = '', $cheque_writer = '', $cheque_bank = '') + public function addLine($id, $date, $type, $label, $amount, $category = 0, $cheque_number = '', $cheque_writer = '', $cheque_bank = '', $accountancycode = '', $datev = null, $num_releve = '') { if (!DolibarrApiAccess::$user->rights->banque->modifier) { throw new RestException(401); @@ -499,7 +502,8 @@ class BankAccounts extends DolibarrApi $cheque_number, $category, DolibarrApiAccess::$user, - $cheque_writer, $cheque_bank + $cheque_writer, $cheque_bank, $accountancycode, + $datev, $num_releve ); if ($result < 0) { throw new RestException(503, 'Error when adding line to account: '.$account->error); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 23297438e19..1156e254e52 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -638,7 +638,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; } else { print ''; - print $form->select_company($socid, 'socid', '', 'SelectThirdParty'); + print img_picto('', 'company').$form->select_company($socid, 'socid', '', 'SelectThirdParty'); print ''; } } @@ -818,7 +818,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { print ''.$form->editfieldkey('Categories', 'contcats', '', $object, 0).''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, null, 'parent', null, null, 1); - print $form->multiselectarray('contcats', $cate_arbo, GETPOST('contcats', 'array'), null, null, null, null, '90%'); + print img_picto('', 'category').$form->multiselectarray('contcats', $cate_arbo, GETPOST('contcats', 'array'), null, null, null, null, '90%'); print ""; } @@ -965,7 +965,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print ''; - print $form->select_company(GETPOST('socid', 'int') ?GETPOST('socid', 'int') : ($object->socid ? $object->socid : -1), 'socid', '', $langs->trans("SelectThirdParty")); + print img_picto('', 'company').$form->select_company(GETPOST('socid', 'int') ?GETPOST('socid', 'int') : ($object->socid ? $object->socid : -1), 'socid', '', $langs->trans("SelectThirdParty")); print ''; print ''; } @@ -1087,39 +1087,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) } } } - // if (! empty($conf->socialnetworks->enabled)) - // { - // // Jabber ID - // if (! empty($conf->global->SOCIALNETWORKS_JABBER)) - // { - // print ''; - // print 'jabberid).'">'; - // } - // // Skype - // if (! empty($conf->global->SOCIALNETWORKS_SKYPE)) - // { - // print ''; - // print 'skype).'">'; - // } - // // Twitter - // if (! empty($conf->global->SOCIALNETWORKS_TWITTER)) - // { - // print ''; - // print 'twitter).'">'; - // } - // // Facebook - // if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) - // { - // print ''; - // print 'facebook).'">'; - // } - // // LinkedIn - // if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN)) - // { - // print ''; - // print 'linkedin).'">'; - // } - // } // Visibility print ''; @@ -1155,7 +1122,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) foreach ($cats as $cat) { $arrayselected[] = $cat->id; } - print $form->multiselectarray('contcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); + print img_picto('', 'category').$form->multiselectarray('contcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); print ""; } diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index c942127aab3..e96adea7531 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2020 Frédéric France * * 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 @@ -950,15 +950,14 @@ class CMailFile * Read a file on disk and return encoded content for emails (mode = 'mail') * * @param string $sourcefile Path to file to encode - * @return int <0 if KO, encoded string if OK + * @return int|string <0 if KO, encoded string if OK */ private function _encode_file($sourcefile) { // phpcs:enable $newsourcefile = dol_osencode($sourcefile); - if (is_readable($newsourcefile)) - { + if (is_readable($newsourcefile)) { $contents = file_get_contents($newsourcefile); // Need PHP 4.3 $encoded = chunk_split(base64_encode($contents), 76, $this->eol); // 76 max is defined into http://tools.ietf.org/html/rfc2047 return $encoded; @@ -983,27 +982,24 @@ class CMailFile // phpcs:enable global $conf, $dolibarr_main_data_root; - if (@is_writeable($dolibarr_main_data_root)) // Avoid fatal error on fopen with open_basedir - { + if (@is_writeable($dolibarr_main_data_root)) { // Avoid fatal error on fopen with open_basedir $outputfile = $dolibarr_main_data_root."/dolibarr_mail.log"; $fp = fopen($outputfile, "w"); - if ($this->sendmode == 'mail') - { + if ($this->sendmode == 'mail') { fputs($fp, $this->headers); fputs($fp, $this->eol); // This eol is added by the mail function, so we add it in log fputs($fp, $this->message); - } elseif ($this->sendmode == 'smtps') - { + } elseif ($this->sendmode == 'smtps') { fputs($fp, $this->smtps->log); // this->smtps->log is filled only if MAIN_MAIL_DEBUG was set to on - } elseif ($this->sendmode == 'swiftmailer') - { + } elseif ($this->sendmode == 'swiftmailer') { fputs($fp, $this->logger->dump()); // this->logger is filled only if MAIN_MAIL_DEBUG was set to on } fclose($fp); - if (!empty($conf->global->MAIN_UMASK)) + if (!empty($conf->global->MAIN_UMASK)) { @chmod($outputfile, octdec($conf->global->MAIN_UMASK)); + } } } @@ -1016,8 +1012,7 @@ class CMailFile */ public function checkIfHTML($msg) { - if (!preg_match('/^[\s\t]*styleCSS)) $out .= $this->styleCSS; $out .= "css)) - { + if (!empty($this->css)) { // Style CSS $this->styleCSS = '