From 9ae40a2a02236e801e3bbe322068c6c736a98488 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Tue, 14 Jun 2022 12:52:14 +0200 Subject: [PATCH 001/218] NEW: helper functions for dates + small demo case --- htdocs/core/lib/functions.lib.php | 31 ++++++++++++++++++++++++++ htdocs/fourn/facture/list.php | 36 ++++++------------------------- 2 files changed, 37 insertions(+), 30 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 45bf99577d4..09a287200ba 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11110,3 +11110,34 @@ function dolForgeCriteriaCallback($matches) return $db->escape($operand).' '.$db->escape($operator)." ".$tmpescaped; } + +/** + * Helper function that combines values of a dolibarr DatePicker (such as Form::selectDate) for year, month, day (and + * optionally hour, minute, second) fields to return a timestamp. + * + * @param string $prefix Prefix used to build the date selector (for instance using Form::selectDate) + * @param bool $useHourTime If true, will also include hour, minute, second values from the HTTP request + * @param string $gm Passed to dol_mktime + * @return int|string Date as a timestamp, '' or false if error + */ +function GETPOSTDATE($prefix, $useHourTime = false, $gm = 'auto') { + return dol_mktime($useHourTime ? (GETPOSTINT($prefix . 'hour')) : 0, $useHourTime ? (GETPOSTINT($prefix . 'minute')) : 0, $useHourTime ? (GETPOSTINT($prefix . 'second')) : 0, GETPOSTINT($prefix . 'month'), GETPOSTINT($prefix . 'day'), GETPOSTINT($prefix . 'year'), $gm); +} + +/** + * Helper function that combines values of a dolibarr DatePicker (such as Form::selectDate) for year, month, day (and + * optionally hour, minute, second) fields to return a a portion of URL reproducing the values from the current HTTP + * request. + * + * @param string $prefix Prefix used to build the date selector (for instance using Form::selectDate) + * @param bool $useHourTime If true, will also include hour, minute, second values from the HTTP request + * @return string Portion of URL with query parameters for the specified date + */ +function buildParamDate($prefix, $useHourTime = false) { + $TParam = [$prefix . 'day' => GETPOST($prefix . 'day'), $prefix . 'month' => GETPOST($prefix . 'month'), $prefix . 'year' => GETPOST($prefix . 'year')]; + if ($useHourTime) { + $TParam += [$prefix . 'hour' => GETPOST($prefix . 'hour'), $prefix . 'minute' => GETPOST($prefix . 'minute'), $prefix . 'second' => GETPOST($prefix . 'second')]; + } + + return '&' . http_build_query($TParam); +} diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 70a7334196a..ec0d8ce7427 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -98,14 +98,8 @@ $search_country = GETPOST("search_country", 'int'); $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); -$search_date_startday = GETPOST('search_date_startday', 'int'); -$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); -$search_date_startyear = GETPOST('search_date_startyear', 'int'); -$search_date_endday = GETPOST('search_date_endday', 'int'); -$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); -$search_date_endyear = GETPOST('search_date_endyear', 'int'); -$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver -$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); +$search_date_start = GETPOSTDATE('search_date_start', false, 'tzserver'); +$search_date_end = GETPOSTDATE('search_date_end', false, 'tzserver'); $search_datelimit_startday = GETPOST('search_datelimit_startday', 'int'); $search_datelimit_startmonth = GETPOST('search_datelimit_startmonth', 'int'); $search_datelimit_startyear = GETPOST('search_datelimit_startyear', 'int'); @@ -274,12 +268,6 @@ if (empty($reshook)) { $search_type = ''; $search_country = ''; $search_type_thirdparty = ''; - $search_date_startday = ''; - $search_date_startmonth = ''; - $search_date_startyear = ''; - $search_date_endday = ''; - $search_date_endmonth = ''; - $search_date_endyear = ''; $search_date_start = ''; $search_date_end = ''; $search_datelimit_startday = ''; @@ -706,23 +694,11 @@ if ($resql) { if ($search_all) { $param .= '&search_all='.urlencode($search_all); } - if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + if ($search_date_start) { + $param .= buildParamDate('search_date_start', false); } - if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); - } - if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); - } - if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); - } - if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); - } - if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + if ($search_date_end) { + $param .= buildParamDate('search_date_end', false); } if ($search_datelimit_startday) { $param .= '&search_datelimit_startday='.urlencode($search_datelimit_startday); From e455997160c26ded69e30ab9eafbb148d2ae88e3 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Tue, 14 Jun 2022 14:21:46 +0200 Subject: [PATCH 002/218] [minor] [stickler-ci] Opening brace should be on a new line --- htdocs/core/lib/functions.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 09a287200ba..f783c764f78 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11120,7 +11120,8 @@ function dolForgeCriteriaCallback($matches) * @param string $gm Passed to dol_mktime * @return int|string Date as a timestamp, '' or false if error */ -function GETPOSTDATE($prefix, $useHourTime = false, $gm = 'auto') { +function GETPOSTDATE($prefix, $useHourTime = false, $gm = 'auto') +{ return dol_mktime($useHourTime ? (GETPOSTINT($prefix . 'hour')) : 0, $useHourTime ? (GETPOSTINT($prefix . 'minute')) : 0, $useHourTime ? (GETPOSTINT($prefix . 'second')) : 0, GETPOSTINT($prefix . 'month'), GETPOSTINT($prefix . 'day'), GETPOSTINT($prefix . 'year'), $gm); } @@ -11133,7 +11134,8 @@ function GETPOSTDATE($prefix, $useHourTime = false, $gm = 'auto') { * @param bool $useHourTime If true, will also include hour, minute, second values from the HTTP request * @return string Portion of URL with query parameters for the specified date */ -function buildParamDate($prefix, $useHourTime = false) { +function buildParamDate($prefix, $useHourTime = false) +{ $TParam = [$prefix . 'day' => GETPOST($prefix . 'day'), $prefix . 'month' => GETPOST($prefix . 'month'), $prefix . 'year' => GETPOST($prefix . 'year')]; if ($useHourTime) { $TParam += [$prefix . 'hour' => GETPOST($prefix . 'hour'), $prefix . 'minute' => GETPOST($prefix . 'minute'), $prefix . 'second' => GETPOST($prefix . 'second')]; From b4e068dcdcd4fa55b78d38859b492e327dfb28f5 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Tue, 14 Jun 2022 18:13:32 +0200 Subject: [PATCH 003/218] PR feedback: allow setting a specific hourtime --- htdocs/core/lib/functions.lib.php | 43 +++++++++++++++++++++++++------ htdocs/fourn/facture/list.php | 8 +++--- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f783c764f78..aa4d5947fbb 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11116,13 +11116,29 @@ function dolForgeCriteriaCallback($matches) * optionally hour, minute, second) fields to return a timestamp. * * @param string $prefix Prefix used to build the date selector (for instance using Form::selectDate) - * @param bool $useHourTime If true, will also include hour, minute, second values from the HTTP request + * @param string $hourTime 'getpost' to include hour, minute, second values from the HTTP request, 'XX:YY:ZZ' to set + * hour, minute, second respectively (for instance '23:59:59') * @param string $gm Passed to dol_mktime * @return int|string Date as a timestamp, '' or false if error */ -function GETPOSTDATE($prefix, $useHourTime = false, $gm = 'auto') +function GETPOSTDATE($prefix, $hourTime = '', $gm = 'auto') { - return dol_mktime($useHourTime ? (GETPOSTINT($prefix . 'hour')) : 0, $useHourTime ? (GETPOSTINT($prefix . 'minute')) : 0, $useHourTime ? (GETPOSTINT($prefix . 'second')) : 0, GETPOSTINT($prefix . 'month'), GETPOSTINT($prefix . 'day'), GETPOSTINT($prefix . 'year'), $gm); + if ($hourTime === 'getpost') { + $hour = GETPOSTINT($prefix . 'hour'); + $minute = GETPOSTINT($prefix . 'minute'); + $second = GETPOSTINT($prefix . 'second'); + } elseif (preg_match('/^(\d\d):(\d\d):(\d\d)$/', $hourTime, $m)) { + $hour = (int)$m[1]; + $minute = (int)$m[2]; + $second = (int)$m[3]; + } else { + $hour = $minute = $second = 0; + } + // normalize out of range values + $hour = min($hour, 23); + $minute = min($minute, 59); + $second = min($second, 59); + return dol_mktime($hour, $minute, $second, GETPOSTINT($prefix . 'month'), GETPOSTINT($prefix . 'day'), GETPOSTINT($prefix . 'year'), $gm); } /** @@ -11131,14 +11147,25 @@ function GETPOSTDATE($prefix, $useHourTime = false, $gm = 'auto') * request. * * @param string $prefix Prefix used to build the date selector (for instance using Form::selectDate) - * @param bool $useHourTime If true, will also include hour, minute, second values from the HTTP request + * @param int $timestamp If null, the timestamp will be created from request data + * @param bool $hourTime If timestamp is null, will be passed to GETPOSTDATE to construct the timestamp + * @param bool $gm If timestamp is null, will be passed to GETPOSTDATE to construct the timestamp * @return string Portion of URL with query parameters for the specified date */ -function buildParamDate($prefix, $useHourTime = false) +function buildParamDate($prefix, $timestamp = null, $hourTime = '', $gm = 'auto') { - $TParam = [$prefix . 'day' => GETPOST($prefix . 'day'), $prefix . 'month' => GETPOST($prefix . 'month'), $prefix . 'year' => GETPOST($prefix . 'year')]; - if ($useHourTime) { - $TParam += [$prefix . 'hour' => GETPOST($prefix . 'hour'), $prefix . 'minute' => GETPOST($prefix . 'minute'), $prefix . 'second' => GETPOST($prefix . 'second')]; + if ($timestamp === null) $timestamp = GETPOSTDATE($prefix, $hourTime, $gm); + $TParam = array( + $prefix . 'day' => intval(dol_print_date($timestamp, '%d')), + $prefix . 'month' => intval(dol_print_date($timestamp, '%m')), + $prefix . 'year' => intval(dol_print_date($timestamp, '%Y')), + ); + if ($hourTime === 'getpost' || ($timestamp !== null && dol_print_date($timestamp, '%H:%M:%S') !== '00:00:00')) { + $TParam = array_merge($TParam, array( + $prefix . 'hour' => intval(dol_print_date($timestamp, '%H')), + $prefix . 'minute' => intval(dol_print_date($timestamp, '%M')), + $prefix . 'second' => intval(dol_print_date($timestamp, '%S')) + )); } return '&' . http_build_query($TParam); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index ec0d8ce7427..e63c8794aad 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -98,8 +98,8 @@ $search_country = GETPOST("search_country", 'int'); $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); -$search_date_start = GETPOSTDATE('search_date_start', false, 'tzserver'); -$search_date_end = GETPOSTDATE('search_date_end', false, 'tzserver'); +$search_date_start = GETPOSTDATE('search_date_start', '', 'tzserver'); +$search_date_end = GETPOSTDATE('search_date_end', '23:59:59', 'tzserver'); $search_datelimit_startday = GETPOST('search_datelimit_startday', 'int'); $search_datelimit_startmonth = GETPOST('search_datelimit_startmonth', 'int'); $search_datelimit_startyear = GETPOST('search_datelimit_startyear', 'int'); @@ -695,10 +695,10 @@ if ($resql) { $param .= '&search_all='.urlencode($search_all); } if ($search_date_start) { - $param .= buildParamDate('search_date_start', false); + $param .= buildParamDate('search_date_start', null, '', 'tzserver'); } if ($search_date_end) { - $param .= buildParamDate('search_date_end', false); + $param .= buildParamDate('search_date_end', null, '', 'tzserver'); } if ($search_datelimit_startday) { $param .= '&search_datelimit_startday='.urlencode($search_datelimit_startday); From d4b19ed8a36b45c534ba8de3721281ad88363a4f Mon Sep 17 00:00:00 2001 From: atm-florian Date: Wed, 15 Jun 2022 08:46:54 +0200 Subject: [PATCH 004/218] [minor] formatting issues --- htdocs/core/lib/functions.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index aa4d5947fbb..ecb45a33280 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11117,7 +11117,7 @@ function dolForgeCriteriaCallback($matches) * * @param string $prefix Prefix used to build the date selector (for instance using Form::selectDate) * @param string $hourTime 'getpost' to include hour, minute, second values from the HTTP request, 'XX:YY:ZZ' to set - * hour, minute, second respectively (for instance '23:59:59') + * hour, minute, second respectively (for instance '23:59:59') * @param string $gm Passed to dol_mktime * @return int|string Date as a timestamp, '' or false if error */ @@ -11128,9 +11128,9 @@ function GETPOSTDATE($prefix, $hourTime = '', $gm = 'auto') $minute = GETPOSTINT($prefix . 'minute'); $second = GETPOSTINT($prefix . 'second'); } elseif (preg_match('/^(\d\d):(\d\d):(\d\d)$/', $hourTime, $m)) { - $hour = (int)$m[1]; - $minute = (int)$m[2]; - $second = (int)$m[3]; + $hour = intval($m[1]); + $minute = intval($m[2]); + $second = intval($m[3]); } else { $hour = $minute = $second = 0; } From 1414f72794c6850bb950f016b02f2559069d9e57 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 13 Jul 2022 16:37:50 +0200 Subject: [PATCH 005/218] NEW color in action list --- htdocs/admin/agenda_other.php | 88 +++++++++++++++++++++++++++++++++-- htdocs/comm/action/list.php | 32 ++++++++++++- 2 files changed, 116 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 1014d40de50..3f976efc784 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -53,6 +53,9 @@ $type = 'action'; * Actions */ +$error = 0; +$errors = array(); + include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; $reg = array(); @@ -109,7 +112,36 @@ if ($action == 'set') { } else { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); } -} elseif ($action == 'specimen') { // For orders + +} elseif ($action == 'setcolors') { + $event_color = preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('event_past_color', 'alphanohtml')); + $res = dolibarr_set_const($db, 'AGENDA_EVENT_PAST_COLOR', $event_color, 'chaine', 0, '', $conf->entity); + if (!$res > 0) { + $error++; + $errors[] = $db->lasterror(); + } + + $event_color = preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('event_progress_color', 'alphanohtml')); + $res = dolibarr_set_const($db, 'AGENDA_EVENT_PROGRESS_COLOR', $event_color, 'chaine', 0, '', $conf->entity); + if (!$res > 0) { + $error++; + $errors[] = $db->lasterror(); + } + + $event_color = preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('event_future_color', 'alphanohtml')); + $res = dolibarr_set_const($db, 'AGENDA_EVENT_FUTURE_COLOR', $event_color, 'chaine', 0, '', $conf->entity); + if (!$res > 0) { + $error++; + $errors[] = $db->lasterror(); + } + + if ($error) { + setEventMessages('', $errors, 'errors'); + } else { + setEventMessage($langs->trans('SetupSaved')); + } +} +elseif ($action == 'specimen') { // For orders $modele = GETPOST('module', 'alpha'); $commande = new CommandeFournisseur($db); @@ -192,9 +224,10 @@ print dol_get_fiche_head($head, 'other', $langs->trans("Agenda"), -1, 'action'); /* - * Documents models for supplier orders + * Miscellaneous */ +print load_fiche_titre($langs->trans('Miscellaneous'), '', ''); // Define array def of models $def = array(); @@ -394,7 +427,54 @@ print ''."\n"; print ''; -print dol_get_fiche_end(); +print $form->buttonsSaveCancel("Save", ''); + +print ''; + + +/* + * User interface (colors) + */ + +print load_fiche_titre($langs->trans('UserInterface'), '', ''); + +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +$formother = new FormOther($db); + +print '
'; +print ''; +print ''; + +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; + +// AGENDA_EVENT_PAST_COLOR +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +// AGENDA_EVENT_PROGRESS_COLOR +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +// AGENDA_EVENT_FUTURE_COLOR +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; + +print '
'.$langs->trans("Parameters").' '.$langs->trans("Value").'
'.$langs->trans('AGENDA_EVENT_PAST_COLOR').' '."\n"; +print $formother->selectColor($conf->global->AGENDA_EVENT_PAST_COLOR, 'event_past_color'); +print '
'.$langs->trans('AGENDA_EVENT_PROGRESS_COLOR').' '."\n"; +print $formother->selectColor($conf->global->AGENDA_EVENT_PROGRESS_COLOR, 'event_progress_color'); +print '
'.$langs->trans('AGENDA_EVENT_FUTURE_COLOR').' '."\n"; +print $formother->selectColor($conf->global->AGENDA_EVENT_FUTURE_COLOR, 'event_future_color'); +print '
'; print $form->buttonsSaveCancel("Save", ''); @@ -402,6 +482,8 @@ print '
'; print "
"; +print dol_get_fiche_end(); + // End of page llxFooter(); $db->close(); diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index dd877e903e4..0dadd28ff9e 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -889,6 +889,7 @@ $i = 0; //$savnbfield = $totalarray['nbfield']; //$totalarray['nbfield'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); +$today_start_date_time = dol_now(); while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { @@ -923,7 +924,36 @@ while ($i < $imaxinloop) { $actionstatic->fetchResources(); } - print ''; + // get event color + $event_color = ''; + $event_more_class = ''; + $event_start_date_time = $actionstatic->datep; + if ($obj->fulldayevent) { + $today_start_date_time = dol_mktime(0, 0, 0, date('m', $today_start_date_time), date('d', $today_start_date_time), date('Y', $today_start_date_time)); + } + if ($event_start_date_time > $today_start_date_time) { + // future event + $event_color = $conf->global->AGENDA_EVENT_FUTURE_COLOR; + $event_more_class = 'event-future'; + } else { + // check event end date + $event_end_date_time = $db->jdate($obj->dp2); + if ($event_end_date_time != null && $event_end_date_time < $today_start_date_time) { + // past event + $event_color = $conf->global->AGENDA_EVENT_PAST_COLOR; + $event_more_class = 'event-past'; + } elseif ($event_end_date_time == null && $event_start_date_time < $today_start_date_time) { + // past event + $event_color = $conf->global->AGENDA_EVENT_PAST_COLOR; + $event_more_class = 'event-past'; + } else { + // today event + $event_color = $conf->global->AGENDA_EVENT_PROGRESS_COLOR; + $event_more_class = 'event-progress'; + } + } + + print ''; // Ref if (!empty($arrayfields['a.id']['checked'])) { From cda6e9184df96afe1d4fb54beec9aae1ef12c5cc Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 13 Jul 2022 16:52:57 +0200 Subject: [PATCH 006/218] NEW color in action list and translated --- htdocs/admin/agenda_other.php | 10 +++++----- htdocs/comm/action/list.php | 6 +++--- htdocs/langs/en_US/admin.lang | 5 ++++- htdocs/langs/fr_FR/admin.lang | 5 ++++- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 3f976efc784..08858252032 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -121,8 +121,8 @@ if ($action == 'set') { $errors[] = $db->lasterror(); } - $event_color = preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('event_progress_color', 'alphanohtml')); - $res = dolibarr_set_const($db, 'AGENDA_EVENT_PROGRESS_COLOR', $event_color, 'chaine', 0, '', $conf->entity); + $event_color = preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('event_current_color', 'alphanohtml')); + $res = dolibarr_set_const($db, 'AGENDA_EVENT_CURRENT_COLOR', $event_color, 'chaine', 0, '', $conf->entity); if (!$res > 0) { $error++; $errors[] = $db->lasterror(); @@ -459,12 +459,12 @@ print ' '."\n"; print ''."\n"; print $formother->selectColor($conf->global->AGENDA_EVENT_PAST_COLOR, 'event_past_color'); print ''."\n"; -// AGENDA_EVENT_PROGRESS_COLOR +// AGENDA_EVENT_CURRENT_COLOR print ''."\n"; -print ''.$langs->trans('AGENDA_EVENT_PROGRESS_COLOR').''."\n"; +print ''.$langs->trans('AGENDA_EVENT_CURRENT_COLOR').''."\n"; print ' '."\n"; print ''."\n"; -print $formother->selectColor($conf->global->AGENDA_EVENT_PROGRESS_COLOR, 'event_progress_color'); +print $formother->selectColor($conf->global->AGENDA_EVENT_CURRENT_COLOR, 'event_current_color'); print ''."\n"; // AGENDA_EVENT_FUTURE_COLOR print ''."\n"; diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 0dadd28ff9e..ec42c0257af 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -947,9 +947,9 @@ while ($i < $imaxinloop) { $event_color = $conf->global->AGENDA_EVENT_PAST_COLOR; $event_more_class = 'event-past'; } else { - // today event - $event_color = $conf->global->AGENDA_EVENT_PROGRESS_COLOR; - $event_more_class = 'event-progress'; + // current event + $event_color = $conf->global->AGENDA_EVENT_CURRENT_COLOR; + $event_more_class = 'event-current'; } } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 813c7a4faa0..07cd5da86a9 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1806,6 +1806,9 @@ AGENDA_USE_EVENT_TYPE=Use events types (managed in menu Setup -> Dictionaries -> AGENDA_USE_EVENT_TYPE_DEFAULT=Automatically set this default value for type of event in event create form AGENDA_DEFAULT_FILTER_TYPE=Automatically set this type of event in search filter of agenda view AGENDA_DEFAULT_FILTER_STATUS=Automatically set this status for events in search filter of agenda view +AGENDA_EVENT_PAST_COLOR=Past event color +AGENDA_EVENT_CURRENT_COLOR=Current event color +AGENDA_EVENT_FUTURE_COLOR=Future event color AGENDA_DEFAULT_VIEW=Which view do you want to open by default when selecting menu Agenda AGENDA_REMINDER_BROWSER=Enable event reminder on user's browser (When remind date is reached, a popup is shown by the browser. Each user can disable such notifications from its browser notification setup). AGENDA_REMINDER_BROWSER_SOUND=Enable sound notification @@ -2284,4 +2287,4 @@ AlwaysEnabled=Always Enabled DoesNotWorkWithAllThemes=Will not work with all themes NoName=No name ShowAdvancedOptions= Show advanced options -HideAdvancedoptions= Hide advanced options \ No newline at end of file +HideAdvancedoptions= Hide advanced options diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 3c653717801..8c9424546e9 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1806,6 +1806,9 @@ AGENDA_USE_EVENT_TYPE=Utiliser les types d'événements (gérés dans le menu Co AGENDA_USE_EVENT_TYPE_DEFAULT=Configurez automatiquement cette valeur par défaut pour le type d'événement dans le formulaire de création d'événement. AGENDA_DEFAULT_FILTER_TYPE=Positionner automatiquement ce type d'événement dans le filtre de recherche de la vue agenda AGENDA_DEFAULT_FILTER_STATUS=Positionner automatiquement ce statut d'événement dans le filtre de recherche de la vue agenda +AGENDA_EVENT_PAST_COLOR=Couleur de l'événement passé +AGENDA_EVENT_CURRENT_COLOR=Couleur de l'événement en cours +AGENDA_EVENT_FUTURE_COLOR=Couleur de l'événement futur AGENDA_DEFAULT_VIEW=Quel onglet voulez-vous voir ouvrir par défaut quand on choisit le menu Agenda AGENDA_REMINDER_BROWSER=Activer le rappel d'événement sur le navigateur de l'utilisateur (lorsque la date de l'événement est atteinte, une popup est affichée sur la navigateur. Chaque utilisateur peut désactiver de telles notification depuis la configuration des notifications de son navigateur) AGENDA_REMINDER_BROWSER_SOUND=Activer les notifications sonores. @@ -2267,4 +2270,4 @@ DarkThemeMode=Mode thème sombre AlwaysDisabled=Toujours désactivé AccordingToBrowser=Selon le navigateur AlwaysEnabled=Toujours activé -DoesNotWorkWithAllThemes=Ne fonctionne pas avec tous les thèmes \ No newline at end of file +DoesNotWorkWithAllThemes=Ne fonctionne pas avec tous les thèmes From 0a82efce07b3d28a396995d25d5a2a32e3b8f0c3 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 13 Jul 2022 17:30:08 +0200 Subject: [PATCH 007/218] FIX reload stickler-ci From f69d5924498cc1e1eaed24f48eea42d39a1fb23f Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 13 Jul 2022 17:38:18 +0200 Subject: [PATCH 008/218] FIX stickler-ci --- htdocs/admin/agenda_other.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 08858252032..7c2c6640277 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -112,7 +112,6 @@ if ($action == 'set') { } else { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); } - } elseif ($action == 'setcolors') { $event_color = preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('event_past_color', 'alphanohtml')); $res = dolibarr_set_const($db, 'AGENDA_EVENT_PAST_COLOR', $event_color, 'chaine', 0, '', $conf->entity); @@ -140,8 +139,7 @@ if ($action == 'set') { } else { setEventMessage($langs->trans('SetupSaved')); } -} -elseif ($action == 'specimen') { // For orders +} elseif ($action == 'specimen') { // For orders $modele = GETPOST('module', 'alpha'); $commande = new CommandeFournisseur($db); From f40ab59b37df0a312a58608854fc654dc70ca042 Mon Sep 17 00:00:00 2001 From: GregM Date: Tue, 19 Jul 2022 16:08:38 +0200 Subject: [PATCH 009/218] FIX contacts disabled are not returned on create invoice --- htdocs/contact/class/contact.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index bb3f2ae035d..ce74f82b412 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1776,10 +1776,13 @@ class Contact extends CommonObject $sql = "SELECT sc.fk_socpeople as id, sc.fk_c_type_contact"; $sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact tc"; $sql .= ", ".MAIN_DB_PREFIX."societe_contacts sc"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."socpeople sp"; + $sql .= " ON sc.fk_socpeople = sp.rowid"; $sql .= " WHERE sc.fk_soc =".((int) $this->socid); $sql .= " AND sc.fk_c_type_contact=tc.rowid"; $sql .= " AND tc.element = '".$this->db->escape($element)."'"; $sql .= " AND tc.active = 1"; + $sql .= " AND sp.statut = 1"; dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); From 161958d34613d1bcc9ffb30f0f61b9ec440ac957 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Thu, 21 Jul 2022 10:56:03 +0200 Subject: [PATCH 010/218] NEW color for start date and owner --- htdocs/comm/action/list.php | 48 +++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index ec42c0257af..096771c9ea7 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -890,6 +890,7 @@ $i = 0; //$totalarray['nbfield'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); $today_start_date_time = dol_now(); +$cache_user_list = array(); while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { @@ -924,36 +925,54 @@ while ($i < $imaxinloop) { $actionstatic->fetchResources(); } - // get event color - $event_color = ''; + // cache of user list (owners) + if ($obj->fk_user_action > 0 && !isset($cache_user_list[$obj->fk_user_action])) { + $res = $userstatic->fetch($obj->fk_user_action); + if ($res > 0) { + $cache_user_list[$obj->fk_user_action] = $userstatic; + } + } + + // get event style for user owner + $event_owner_style = ''; + // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event) + if ($cache_user_list[$obj->fk_user_action]->color != '') { + $event_owner_style .= 'border-left: #' . $cache_user_list[$obj->fk_user_action]->color . ' 5px solid;'; + } + + // get event style for start date $event_more_class = ''; + $event_start_date_style = ''; $event_start_date_time = $actionstatic->datep; if ($obj->fulldayevent) { $today_start_date_time = dol_mktime(0, 0, 0, date('m', $today_start_date_time), date('d', $today_start_date_time), date('Y', $today_start_date_time)); } if ($event_start_date_time > $today_start_date_time) { // future event - $event_color = $conf->global->AGENDA_EVENT_FUTURE_COLOR; $event_more_class = 'event-future'; + $event_start_date_color = $conf->global->AGENDA_EVENT_FUTURE_COLOR; } else { // check event end date $event_end_date_time = $db->jdate($obj->dp2); if ($event_end_date_time != null && $event_end_date_time < $today_start_date_time) { // past event - $event_color = $conf->global->AGENDA_EVENT_PAST_COLOR; $event_more_class = 'event-past'; + $event_start_date_color = $conf->global->AGENDA_EVENT_PAST_COLOR; } elseif ($event_end_date_time == null && $event_start_date_time < $today_start_date_time) { // past event - $event_color = $conf->global->AGENDA_EVENT_PAST_COLOR; $event_more_class = 'event-past'; + $event_start_date_color = $conf->global->AGENDA_EVENT_PAST_COLOR; } else { // current event - $event_color = $conf->global->AGENDA_EVENT_CURRENT_COLOR; $event_more_class = 'event-current'; + $event_start_date_color = $conf->global->AGENDA_EVENT_CURRENT_COLOR; } } + if ($event_start_date_color != '') { + $event_start_date_style .= 'background: #' . $event_start_date_color . ';'; + } - print ''; + print ''; // Ref if (!empty($arrayfields['a.id']['checked'])) { @@ -964,10 +983,15 @@ while ($i < $imaxinloop) { // User owner if (!empty($arrayfields['owner']['checked'])) { - print ''; // With edge and chrome the td overflow is not supported correctly when content is not full text. - if ($obj->fk_user_action > 0) { - $userstatic->fetch($obj->fk_user_action); - print $userstatic->getNomUrl(-1); + print ''; // With edge and chrome the td overflow is not supported correctly when content is not full text. + if ($obj->fk_user_action > 0 && !isset($cache_user_list[$obj->fk_user_action])) { + $res = $userstatic->fetch($obj->fk_user_action); + if ($res > 0) { + $cache_user_list[$obj->fk_user_action] = $userstatic; + } + } + if (isset($cache_user_list[$obj->fk_user_action])) { + print $cache_user_list[$obj->fk_user_action]->getNomUrl(-1); } else { print ' '; } @@ -1015,7 +1039,7 @@ while ($i < $imaxinloop) { // Start date if (!empty($arrayfields['a.datep']['checked'])) { - print ''; + print ''; if (empty($obj->fulldayevent)) { print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuserrel'); } else { From 993812dc70d6e96118326e283054f8014fca76ec Mon Sep 17 00:00:00 2001 From: lvessiller Date: Thu, 21 Jul 2022 11:22:53 +0200 Subject: [PATCH 011/218] FIX stickler-ci --- htdocs/comm/action/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 096771c9ea7..627b1088afe 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -972,7 +972,7 @@ while ($i < $imaxinloop) { $event_start_date_style .= 'background: #' . $event_start_date_color . ';'; } - print ''; + print ''; // Ref if (!empty($arrayfields['a.id']['checked'])) { From 4d59fd2679a6854994a967924e17f9a7cadb5cae Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 26 Jul 2022 16:36:28 +0200 Subject: [PATCH 012/218] FIX reset today event time --- htdocs/comm/action/list.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 627b1088afe..dba1adecf08 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -889,7 +889,6 @@ $i = 0; //$savnbfield = $totalarray['nbfield']; //$totalarray['nbfield'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); -$today_start_date_time = dol_now(); $cache_user_list = array(); while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); @@ -945,7 +944,9 @@ while ($i < $imaxinloop) { $event_start_date_style = ''; $event_start_date_time = $actionstatic->datep; if ($obj->fulldayevent) { - $today_start_date_time = dol_mktime(0, 0, 0, date('m', $today_start_date_time), date('d', $today_start_date_time), date('Y', $today_start_date_time)); + $today_start_date_time = dol_mktime(0, 0, 0, date('m', $now), date('d', $now), date('Y', $now)); + } else { + $today_start_date_time = $now; } if ($event_start_date_time > $today_start_date_time) { // future event From 62b70b37d353f3a4dc28a5636ecada25716afaab Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 27 Jul 2022 08:32:46 +0200 Subject: [PATCH 013/218] NEW set today start time at begining --- htdocs/comm/action/list.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index dba1adecf08..674348d6158 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -877,6 +877,7 @@ print "\n"; $now = dol_now(); $delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60; +$today_start_time = dol_mktime(0, 0, 0, date('m', $now), date('d', $now), date('Y', $now)); require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; $caction = new CActionComm($db); @@ -943,8 +944,8 @@ while ($i < $imaxinloop) { $event_more_class = ''; $event_start_date_style = ''; $event_start_date_time = $actionstatic->datep; - if ($obj->fulldayevent) { - $today_start_date_time = dol_mktime(0, 0, 0, date('m', $now), date('d', $now), date('Y', $now)); + if ($obj->fulldayevent == 1) { + $today_start_date_time = $today_start_time; } else { $today_start_date_time = $now; } From 8cc9d72b37a534b5d90556ba9cb1a1f846c3b18c Mon Sep 17 00:00:00 2001 From: GregM Date: Tue, 30 Aug 2022 16:53:14 +0200 Subject: [PATCH 014/218] update sql --- htdocs/contact/class/contact.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index ce74f82b412..3ae7e7d8645 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1777,12 +1777,11 @@ class Contact extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact tc"; $sql .= ", ".MAIN_DB_PREFIX."societe_contacts sc"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."socpeople sp"; - $sql .= " ON sc.fk_socpeople = sp.rowid"; + $sql .= " ON sc.fk_socpeople = sp.rowid AND sp.statut = 1"; $sql .= " WHERE sc.fk_soc =".((int) $this->socid); $sql .= " AND sc.fk_c_type_contact=tc.rowid"; $sql .= " AND tc.element = '".$this->db->escape($element)."'"; $sql .= " AND tc.active = 1"; - $sql .= " AND sp.statut = 1"; dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); From c268cf379c100c382fe90710ae2ca950edcbacfa Mon Sep 17 00:00:00 2001 From: lvessiller Date: Fri, 30 Sep 2022 14:00:06 +0200 Subject: [PATCH 015/218] FIX full day event compare start date in future --- htdocs/comm/action/list.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 674348d6158..d5fb64ec471 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -944,16 +944,17 @@ while ($i < $imaxinloop) { $event_more_class = ''; $event_start_date_style = ''; $event_start_date_time = $actionstatic->datep; - if ($obj->fulldayevent == 1) { - $today_start_date_time = $today_start_time; - } else { - $today_start_date_time = $now; - } - if ($event_start_date_time > $today_start_date_time) { + if ($event_start_date_time > $now) { // future event $event_more_class = 'event-future'; $event_start_date_color = $conf->global->AGENDA_EVENT_FUTURE_COLOR; } else { + if ($obj->fulldayevent == 1) { + $today_start_date_time = $today_start_time; + } else { + $today_start_date_time = $now; + } + // check event end date $event_end_date_time = $db->jdate($obj->dp2); if ($event_end_date_time != null && $event_end_date_time < $today_start_date_time) { From 069371fc954597341c3f7e889f8919c507e73174 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Fri, 30 Sep 2022 14:12:03 +0200 Subject: [PATCH 016/218] FIX reload stickler-ci From f18c84621266c9ff6bee315050318070cafab054 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Mon, 3 Oct 2022 14:33:08 +0200 Subject: [PATCH 017/218] FIX user owner cache in event list --- htdocs/comm/action/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index d5fb64ec471..8a811a90f22 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -273,7 +273,6 @@ if (empty($reshook)) { */ $form = new Form($db); -$userstatic = new User($db); $formactions = new FormActions($db); $actionstatic = new ActionComm($db); @@ -927,6 +926,7 @@ while ($i < $imaxinloop) { // cache of user list (owners) if ($obj->fk_user_action > 0 && !isset($cache_user_list[$obj->fk_user_action])) { + $userstatic = new User($db); $res = $userstatic->fetch($obj->fk_user_action); if ($res > 0) { $cache_user_list[$obj->fk_user_action] = $userstatic; @@ -988,6 +988,7 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['owner']['checked'])) { print ''; // With edge and chrome the td overflow is not supported correctly when content is not full text. if ($obj->fk_user_action > 0 && !isset($cache_user_list[$obj->fk_user_action])) { + $userstatic = new User($db); $res = $userstatic->fetch($obj->fk_user_action); if ($res > 0) { $cache_user_list[$obj->fk_user_action] = $userstatic; From 3a861af01e12d1d2b7d899501b755079dd147087 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Fri, 25 Nov 2022 17:19:34 +0100 Subject: [PATCH 018/218] FIX reload travis From d5e6c08319ab297297ebae7bd74b516c1c29d260 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 1 Dec 2022 16:50:32 +0100 Subject: [PATCH 019/218] NEW operation type in email collector to load or create contact --- htdocs/admin/emailcollector_card.php | 1 + .../class/emailcollector.class.php | 114 ++++++++++++++++++ htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/fr_FR/admin.lang | 1 + 4 files changed, 117 insertions(+) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 8dfafb19b63..b3d6e045470 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -668,6 +668,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $arrayoftypes = array( 'loadthirdparty' => $langs->trans('LoadThirdPartyFromName', $langs->transnoentities("ThirdPartyName")), 'loadandcreatethirdparty' => $langs->trans('LoadThirdPartyFromNameOrCreate', $langs->transnoentities("ThirdPartyName")), + 'loadandcreatecontact' => $langs->trans('LoadContactFromEmailOrCreate', $langs->transnoentities("Email")), 'recordjoinpiece' => 'AttachJoinedDocumentsToObject', 'recordevent' => 'RecordEvent' ); diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 8d72666ad53..db932e0a4ca 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -2141,6 +2141,120 @@ class EmailCollector extends CommonObject } } } + } + // Search and create contact + elseif ($operation['type'] == 'loadandcreatecontact') { + if (empty($operation['actionparam'])) { + $errorforactions++; + $this->error = "Action loadandcreatecontact has empty parameter. Must be 'SET:xxx' or 'EXTRACT:(body|subject):regex' to define how to extract data"; + $this->errors[] = $this->error; + } else { + $contact_static = new Contact($this->db); + // Overwrite values with values extracted from source email + $errorforthisaction = $this->overwritePropertiesOfObject($contact_static, $operation['actionparam'], $messagetext, $subject, $header, $operationslog); + if ($errorforthisaction) { + $errorforactions++; + } else { + if (!empty($contact_static->email) && $contact_static->email != $from) $from = $contact_static->email; + + $result = $contactstatic->fetch(0, null, '', $from); + if ($result < 0) { + $errorforactions++; + $this->error = 'Error when getting contact with email ' . $from; + $this->errors[] = $this->error; + break; + } elseif ($result == 0) { + dol_syslog("Contact with email " . $from . " was not found. We try to create it."); + $contactstatic = new Contact($this->db); + + // Create contact + $contactstatic->email = $from; + $operationslog .= '
We set property email='.dol_escape_htmltag($from); + + // Overwrite values with values extracted from source email + $errorforthisaction = $this->overwritePropertiesOfObject($contactstatic, $operation['actionparam'], $messagetext, $subject, $header, $operationslog); + + if ($errorforthisaction) { + $errorforactions++; + } else { + // Search country by name or code + if (!empty($contactstatic->country)) { + require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; + $result = getCountry('', 3, $this->db, '', 1, $contactstatic->country); + if ($result == 'NotDefined') { + $errorforactions++; + $this->error = "Error country not found by this name '" . $contactstatic->country . "'"; + } elseif (!($result > 0)) { + $errorforactions++; + $this->error = "Error when search country by this name '" . $contactstatic->country . "'"; + $this->errors[] = $this->db->lasterror(); + } else { + $contactstatic->country_id = $result; + $operationslog .= '
We set property country_id='.dol_escape_htmltag($result); + } + } elseif (!empty($contactstatic->country_code)) { + require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; + $result = getCountry($contactstatic->country_code, 3, $this->db); + if ($result == 'NotDefined') { + $errorforactions++; + $this->error = "Error country not found by this code '" . $contactstatic->country_code . "'"; + } elseif (!($result > 0)) { + $errorforactions++; + $this->error = "Error when search country by this code '" . $contactstatic->country_code . "'"; + $this->errors[] = $this->db->lasterror(); + } else { + $contactstatic->country_id = $result; + $operationslog .= '
We set property country_id='.dol_escape_htmltag($result); + } + } + + if (!$errorforactions) { + // Search state by name or code (for country if defined) + if (!empty($contactstatic->state)) { + require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; + $result = dol_getIdFromCode($this->db, $contactstatic->state, 'c_departements', 'nom', 'rowid'); + if (empty($result)) { + $errorforactions++; + $this->error = "Error state not found by this name '" . $contactstatic->state . "'"; + } elseif (!($result > 0)) { + $errorforactions++; + $this->error = "Error when search state by this name '" . $contactstatic->state . "'"; + $this->errors[] = $this->db->lasterror(); + } else { + $contactstatic->state_id = $result; + $operationslog .= '
We set property state_id='.dol_escape_htmltag($result); + } + } elseif (!empty($contactstatic->state_code)) { + require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; + $result = dol_getIdFromCode($this->db, $contactstatic->state_code, 'c_departements', 'code_departement', 'rowid'); + if (empty($result)) { + $errorforactions++; + $this->error = "Error state not found by this code '" . $contactstatic->state_code . "'"; + } elseif (!($result > 0)) { + $errorforactions++; + $this->error = "Error when search state by this code '" . $contactstatic->state_code . "'"; + $this->errors[] = $this->db->lasterror(); + } else { + $contactstatic->state_id = $result; + $operationslog .= '
We set property state_id='.dol_escape_htmltag($result); + } + } + } + + if (!$errorforactions) { + $result = $contactstatic->create($user); + if ($result <= 0) { + $errorforactions++; + $this->error = $contactstatic->error; + $this->errors = $contactstatic->errors; + } else { + $operationslog .= '
Contact created -> id = '.dol_escape_htmltag($contactstatic->id); + } + } + } + } + } + } } elseif ($operation['type'] == 'recordevent') { // Create event $actioncomm = new ActionComm($this->db); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b6c780a6be0..9fa5f7f1c28 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2119,6 +2119,7 @@ CodeLastResult=Latest result code NbOfEmailsInInbox=Number of emails in source directory LoadThirdPartyFromName=Load third party searching on %s (load only) LoadThirdPartyFromNameOrCreate=Load third party searching on %s (create if not found) +LoadContactFromEmailOrCreate=Load contact searching on %s (create if not found) AttachJoinedDocumentsToObject=Save attached files into object documents if a ref of an object is found into email topic. WithDolTrackingID=Message from a conversation initiated by a first email sent from Dolibarr WithoutDolTrackingID=Message from a conversation initiated by a first email NOT sent from Dolibarr diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 79a266df816..6a59583e7c0 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -2115,6 +2115,7 @@ CodeLastResult=Dernier code de retour NbOfEmailsInInbox=Nombre de courriels dans le répertoire source LoadThirdPartyFromName=Charger le Tiers en cherchant sur %s (chargement uniquement) LoadThirdPartyFromNameOrCreate=Charger le Tiers en cherchant sur %s (créer si non trouvé) +LoadContactFromEmailOrCreate=Charger le Contact en cherchant sur %s (créer si non trouvé) AttachJoinedDocumentsToObject=Enregistrez les fichiers joints dans des documents d'objet si la référence d'un objet est trouvée dans le sujet de l'e-mail. WithDolTrackingID=Message d'une conversation initiée par un premier mail envoyé depuis Dolibarr WithoutDolTrackingID=Message d'une conversation initiée par un premier e-mail NON envoyé depuis Dolibarr From 3be0f0e1d0f2c206442cc83b7325d6f8ac6ac7d9 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 1 Dec 2022 17:21:41 +0100 Subject: [PATCH 020/218] FIX stickler-ci --- htdocs/emailcollector/class/emailcollector.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index db932e0a4ca..1393913bb35 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -2141,9 +2141,7 @@ class EmailCollector extends CommonObject } } } - } - // Search and create contact - elseif ($operation['type'] == 'loadandcreatecontact') { + } elseif ($operation['type'] == 'loadandcreatecontact') { // Search and create contact if (empty($operation['actionparam'])) { $errorforactions++; $this->error = "Action loadandcreatecontact has empty parameter. Must be 'SET:xxx' or 'EXTRACT:(body|subject):regex' to define how to extract data"; From 3f2367dc16406967486a3325c29cdda3c241ad9f Mon Sep 17 00:00:00 2001 From: Milen Karaganski Date: Wed, 7 Dec 2022 13:49:54 +0200 Subject: [PATCH 021/218] NEW|New [Bulk delete Project tasks] Massaction to delete multiple tasks from tab Taks of Project --- htdocs/core/lib/project.lib.php | 13 +++++++++++- htdocs/projet/tasks.php | 36 +++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index b944e8b47a5..7b0b30bcaef 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -569,9 +569,10 @@ function project_admin_prepare_head() * @param string $filterprogresscalc filter text * @param string $showbilltime Add the column 'TimeToBill' and 'TimeBilled' * @param array $arrayfields Array with displayed coloumn information + * @param array $arrayofselected Array with selected fields * @return int Nb of tasks shown */ -function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc = '', $showbilltime = 0, $arrayfields = array()) +function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc = '', $showbilltime = 0, $arrayfields = array(), $arrayofselected = array()) { global $user, $langs, $conf, $db, $hookmanager; global $projectstatic, $taskstatic, $extrafields; @@ -910,6 +911,16 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t // Tick to drag and drop print ''; + // Action column + print ''; + $selected = 0; + if (in_array($lines[$i]->id, $arrayofselected)) { + $selected = 1; + } + print ''; + + print ''; + print "\n"; if (!$showlineingray) { diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 951406b4275..c619b25a37b 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -183,6 +183,14 @@ $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; * Actions */ +if (GETPOST('cancel', 'alpha')) { + $action = 'list'; + $massaction = ''; +} +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { + $massaction = ''; +} + $parameters = array('id'=>$id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -413,6 +421,7 @@ $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; llxHeader("", $title, $help_url); +$arrayofselected = is_array($toselect) ? $toselect : array(); if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref); @@ -544,6 +553,17 @@ if ($id > 0 || !empty($ref)) { // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; + $arrayofmassactions = array( + 'clone'=>img_picto('', 'rightarrow', 'class="pictofixedwidth"').$langs->trans("Clone"), + ); + if ($permissiontodelete) { + $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); + } + if (in_array($massaction, array('presend', 'predelete'))) { + $arrayofmassactions = array(); + } + $massactionbutton = $form->selectMassAction('', $arrayofmassactions); + // Project card $linkback = ''.$langs->trans("BackToList").''; @@ -842,7 +862,11 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third $linktotasks .= dolGetButtonTitle($langs->trans('ViewGantt'), '', 'fa fa-stream imgforviewmode', DOL_URL_ROOT.'/projet/ganttview.php?id='.$object->id.'&withproject=1', '', 1, array('morecss'=>'reposition marginleftonly')); //print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $totalnboflines, 'generic', 0, '', '', 0, 1); - print load_fiche_titre($title, $linktotasks.'   '.$linktocreatetask, 'projecttask'); + print load_fiche_titre($title, $linktotasks.'   '.$linktocreatetask, 'projecttask', '', '', '', $massactionbutton); + + $objecttmp = new Task($db); + $trackid = 'task'.$taskstatic->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; // Get list of tasks in tasksarray and taskarrayfiltered // We need all tasks (even not limited to a user because a task to user can have a parent that is not affected to him). @@ -877,6 +901,11 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''; } + // Show the massaction checkboxes only when this page is not opend from the Extended POS + if ($massactionbutton && $contextpage != 'poslist') { + $selectedfields = $form->showCheckAddButtons('checkforselect', 1); + } + print '
'; print ''; @@ -987,6 +1016,8 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + print ''; + // Action column print ''; print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -1062,7 +1094,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third if (count($tasksarray) > 0) { // Show all lines in taskarray (recursive function to go down on tree) $j = 0; $level = 0; - $nboftaskshown = projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc, ($object->usage_bill_time ? 1 : 0), $arrayfields); + $nboftaskshown = projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc, ($object->usage_bill_time ? 1 : 0), $arrayfields, $arrayofselected); } else { $colspan = 10; if ($object->usage_bill_time) { From ccf40855d8f61981d2a083c98de38a6e07cc4464 Mon Sep 17 00:00:00 2001 From: Milen Karaganski Date: Wed, 7 Dec 2022 14:04:54 +0200 Subject: [PATCH 022/218] Removed "Clone" option from massactions list (work in progress) --- htdocs/projet/tasks.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index c619b25a37b..c891179617d 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -554,7 +554,7 @@ if ($id > 0 || !empty($ref)) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; $arrayofmassactions = array( - 'clone'=>img_picto('', 'rightarrow', 'class="pictofixedwidth"').$langs->trans("Clone"), + //'clone'=>img_picto('', 'rightarrow', 'class="pictofixedwidth"').$langs->trans("Clone"), ); if ($permissiontodelete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); From 6b6cfb13395bb6e5d706691c02f17e425b3073f7 Mon Sep 17 00:00:00 2001 From: Milen Karaganski Date: Wed, 7 Dec 2022 16:57:22 +0200 Subject: [PATCH 023/218] Add mass action to clone selected tasks to another project --- htdocs/core/actions_massactions.inc.php | 60 +++++++++++++++++++ htdocs/core/class/html.form.class.php | 2 +- htdocs/core/tpl/massactions_pre.tpl.php | 12 ++++ htdocs/langs/en_US/main.lang | 3 + htdocs/langs/en_US/projects.lang | 3 +- htdocs/projet/class/project.class.php | 80 +++++++++++++++++++++++++ htdocs/projet/tasks.php | 7 ++- 7 files changed, 162 insertions(+), 5 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index ec2ecabcf0d..40ecab72a60 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1707,6 +1707,66 @@ if (!$error && ($massaction == 'increaseholiday' || ($action == 'increaseholiday } } +//if (!$error && $massaction == 'clonetasks' && $user->rights->projet->creer) { +if (!$error && ($massaction == 'clonetasks' || ($action == 'clonetasks' && $confirm == 'yes'))) { + $num = 0; + + dol_include_once('/projet/class/task.class.php'); + + $origin_task = new Task($db); + $clone_task = new Task($db); + + foreach (GETPOST('selected') as $task) { + $origin_task->fetch($task, $ref = '', $loadparentdata = 0); + + $defaultref = ''; + $obj = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON; + if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . ".php")) { + require_once DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . '.php'; + $modTask = new $obj; + $defaultref = $modTask->getNextValue(0, $clone_task); + } + + if (!$error) { + $clone_task->fk_project = GETPOST('projectid', 'int'); + $clone_task->ref = $defaultref; + $clone_task->label = $origin_task->label; + $clone_task->description = $origin_task->description; + $clone_task->planned_workload = $origin_task->planned_workload; + $clone_task->fk_task_parent = $origin_task->fk_task_parent; + $clone_task->date_c = dol_now(); + $clone_task->date_start = $origin_task->date_start; + $clone_task->date_end = $origin_task->date_end; + $clone_task->progress = $origin_task->progress; + + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost(null, $clone_task); + + $taskid = $clone_task->create($user); + + if ($taskid > 0) { + $result = $clone_task->add_contact(GETPOST("userid", 'int'), 'TASKEXECUTIVE', 'internal'); + $num++; + } else { + if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { + $langs->load("projects"); + setEventMessages($langs->trans('NewTaskRefSuggested'), '', 'warnings'); + $duplicate_code_error = true; + } else { + setEventMessages($clone_task->error, $clone_task->errors, 'errors'); + } + $action = 'list'; + $error++; + } + } + } + + if (!$error) { + setEventMessage($langs->trans('NumberOfTasksCloned', $num)); + header("Refresh: 1;URL=".DOL_URL_ROOT.'/projet/tasks.php?id=' . GETPOST('projectid', 'int')); + } +} + $parameters['toselect'] = (empty($toselect) ? array() : $toselect); $parameters['uploaddir'] = $uploaddir; $parameters['massaction'] = $massaction; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9e26170f214..6df62ded8bd 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7286,7 +7286,7 @@ class Form $out .= $this->selectProjectsList($selected, $htmlname, $filtertype, $limit, $status, 0, $socid, $showempty, $forcecombo, $morecss); } - if (empty($nooutput)) print $out; + if (!empty($nooutput)) print $out; else return $out; } diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 5124a1dce35..e0293210cf6 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -40,6 +40,18 @@ if ($massaction == 'predelete') { print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeletion"), $langs->trans("ConfirmMassDeletionQuestion", count($toselect)), "delete", null, '', 0, 200, 500, 1); } +if ($massaction == 'preclonetasks') { + $selected = ''; + foreach (GETPOST('toselect') as $tmpselected) { + $selected .= '&selected[]=' . $tmpselected; + } + + $formquestion = array( + array('type' => 'other', 'name' => 'projectid', 'label' => $langs->trans('Project') .': ', 'value' => $form->selectProjects('', 'projectid', '', '', '', '', '', '', '', 1, 1)), + ); + print $form->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $object->id . $selected . '', $langs->trans('ConfirmMassClone'), '', 'clonetasks', $formquestion, '', 1, 300, 590); +} + if ($massaction == 'preaffecttag' && isModEnabled('category')) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $categ = new Categorie($db); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 87b4f8f3036..47a11b949aa 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -897,6 +897,9 @@ MassFilesArea=Area for files built by mass actions ShowTempMassFilesArea=Show area of files built by mass actions ConfirmMassDeletion=Bulk Delete confirmation ConfirmMassDeletionQuestion=Are you sure you want to delete the %s selected record(s)? +ConfirmMassClone=Bulk clone confirmation +ConfirmMassCloneQuestion=Select project to clone to +ConfirmMassCloneToOneProject=Clone to project %s RelatedObjects=Related Objects ClassifyBilled=Classify billed ClassifyUnbilled=Classify unbilled diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 2407d4b2d86..43eecc60b7b 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -258,6 +258,7 @@ RecordsClosed=%s project(s) closed SendProjectRef=Information project %s ModuleSalaryToDefineHourlyRateMustBeEnabled=Module 'Salaries' must be enabled to define employee hourly rate to have time spent valorized NewTaskRefSuggested=Task ref already used, a new task ref is required +NumberOfTasksCloned=%s task(s) cloned TimeSpentInvoiced=Time spent billed TimeSpentForIntervention=Time spent TimeSpentForInvoice=Time spent @@ -297,4 +298,4 @@ EnablePublicLeadForm=Enable the public form for contact NewLeadbyWeb=Your message or request has been recorded. We will answer or contact your soon. NewLeadForm=New contact form LeadFromPublicForm=Online lead from public form -ExportAccountingReportButtonLabel=Get report \ No newline at end of file +ExportAccountingReportButtonLabel=Get report diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 9c8b4ebee26..90057832c23 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -747,6 +747,86 @@ class Project extends CommonObject } } + /** + * Load list of objects in memory from the database. + * + * @param string $sortorder Sort Order + * @param string $sortfield Sort field + * @param int $limit limit + * @param int $offset Offset + * @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...) + * @param string $filtermode Filter mode (AND or OR) + * @return array|int int <0 if KO, array of pages if OK + */ + public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') + { + global $conf; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $records = array(); + + $sql = 'SELECT '; + $sql .= $this->getFieldList('t'); + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; + if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) { + $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')'; + } else { + $sql .= ' WHERE 1 = 1'; + } + // Manage filter + $sqlwhere = array(); + if (count($filter) > 0) { + foreach ($filter as $key => $value) { + if ($key == 't.rowid') { + $sqlwhere[] = $key.'='.$value; + } elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) { + $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; + } elseif ($key == 'customsql') { + $sqlwhere[] = $value; + } elseif (strpos($value, '%') === false) { + $sqlwhere[] = $key.' IN ('.$this->db->sanitize($this->db->escape($value)).')'; + } else { + $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; + } + } + } + if (count($sqlwhere) > 0) { + $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')'; + } + + if (!empty($sortfield)) { + $sql .= $this->db->order($sortfield, $sortorder); + } + if (!empty($limit)) { + $sql .= ' '.$this->db->plimit($limit, $offset); + } + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < ($limit ? min($limit, $num) : $num)) { + $obj = $this->db->fetch_object($resql); + + $record = new self($this->db); + $record->setVarsFromFetchObj($obj); + + $records[$record->id] = $record; + + $i++; + } + $this->db->free($resql); + + return $records; + } else { + $this->errors[] = 'Error '.$this->db->lasterror(); + dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); + + return -1; + } + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of elements for type, linked to a project diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index c891179617d..1fdf9939447 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -553,9 +553,10 @@ if ($id > 0 || !empty($ref)) { // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; - $arrayofmassactions = array( - //'clone'=>img_picto('', 'rightarrow', 'class="pictofixedwidth"').$langs->trans("Clone"), - ); + $arrayofmassactions = array(); + if ($user->rights->projet->creer) { + $arrayofmassactions['preclonetasks'] = img_picto('', 'rightarrow', 'class="pictofixedwidth"').$langs->trans("Clone"); + } if ($permissiontodelete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } From f0f66327b938927b0d255f4ed28a1f79fa83adc5 Mon Sep 17 00:00:00 2001 From: Milen Karaganski Date: Wed, 7 Dec 2022 17:47:01 +0200 Subject: [PATCH 024/218] Fix syntax error --- htdocs/projet/class/project.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 90057832c23..7f0da4a6c98 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -792,7 +792,7 @@ class Project extends CommonObject } } if (count($sqlwhere) > 0) { - $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')'; + $sql .= ' AND ('.implode("'.$filtermode.'", $sqlwhere).')'; } if (!empty($sortfield)) { From 5770d01c75af41c097e7fed679e844a44074b45b Mon Sep 17 00:00:00 2001 From: Milen Karaganski Date: Wed, 7 Dec 2022 17:57:43 +0200 Subject: [PATCH 025/218] Fix syntax error --- htdocs/projet/class/project.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 7f0da4a6c98..7ab69e070a3 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -792,7 +792,7 @@ class Project extends CommonObject } } if (count($sqlwhere) > 0) { - $sql .= ' AND ('.implode("'.$filtermode.'", $sqlwhere).')'; + $sql .= ' AND ('.implode('"'.$filtermode.'"', $sqlwhere).')'; } if (!empty($sortfield)) { From 52ec95d7bff99e25342d2d26a484a2b3fccad402 Mon Sep 17 00:00:00 2001 From: Milen Karaganski Date: Wed, 7 Dec 2022 18:08:10 +0200 Subject: [PATCH 026/218] Removed unnecessary fetchAll() method from project class --- htdocs/projet/class/project.class.php | 80 --------------------------- 1 file changed, 80 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 7ab69e070a3..9c8b4ebee26 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -747,86 +747,6 @@ class Project extends CommonObject } } - /** - * Load list of objects in memory from the database. - * - * @param string $sortorder Sort Order - * @param string $sortfield Sort field - * @param int $limit limit - * @param int $offset Offset - * @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...) - * @param string $filtermode Filter mode (AND or OR) - * @return array|int int <0 if KO, array of pages if OK - */ - public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') - { - global $conf; - - dol_syslog(__METHOD__, LOG_DEBUG); - - $records = array(); - - $sql = 'SELECT '; - $sql .= $this->getFieldList('t'); - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; - if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) { - $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')'; - } else { - $sql .= ' WHERE 1 = 1'; - } - // Manage filter - $sqlwhere = array(); - if (count($filter) > 0) { - foreach ($filter as $key => $value) { - if ($key == 't.rowid') { - $sqlwhere[] = $key.'='.$value; - } elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) { - $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; - } elseif ($key == 'customsql') { - $sqlwhere[] = $value; - } elseif (strpos($value, '%') === false) { - $sqlwhere[] = $key.' IN ('.$this->db->sanitize($this->db->escape($value)).')'; - } else { - $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; - } - } - } - if (count($sqlwhere) > 0) { - $sql .= ' AND ('.implode('"'.$filtermode.'"', $sqlwhere).')'; - } - - if (!empty($sortfield)) { - $sql .= $this->db->order($sortfield, $sortorder); - } - if (!empty($limit)) { - $sql .= ' '.$this->db->plimit($limit, $offset); - } - - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < ($limit ? min($limit, $num) : $num)) { - $obj = $this->db->fetch_object($resql); - - $record = new self($this->db); - $record->setVarsFromFetchObj($obj); - - $records[$record->id] = $record; - - $i++; - } - $this->db->free($resql); - - return $records; - } else { - $this->errors[] = 'Error '.$this->db->lasterror(); - dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); - - return -1; - } - } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of elements for type, linked to a project From ae3b9970dd60791dd86a53774aeafc5004145e5e Mon Sep 17 00:00:00 2001 From: Milen Karaganski Date: Sat, 17 Dec 2022 18:02:42 +0200 Subject: [PATCH 027/218] fix html.form.class.php --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6df62ded8bd..9e26170f214 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7286,7 +7286,7 @@ class Form $out .= $this->selectProjectsList($selected, $htmlname, $filtertype, $limit, $status, 0, $socid, $showempty, $forcecombo, $morecss); } - if (!empty($nooutput)) print $out; + if (empty($nooutput)) print $out; else return $out; } From f90b887ec257c2580c9a8db36c4f39254fd8be13 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Mon, 19 Dec 2022 13:48:08 +0100 Subject: [PATCH 028/218] NEW mode view for list adherent --- htdocs/adherents/class/adherent.class.php | 36 ++ htdocs/adherents/list.php | 541 +++++++++++----------- 2 files changed, 319 insertions(+), 258 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 4c68b3e91ec..ec2cd91813d 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -3167,4 +3167,40 @@ class Adherent extends CommonObject return $nbko; } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + + $return = '
'; + $return .= '
'; + $return .= ''; + + if (property_exists($this, 'photo') || !empty($this->photo)) { + $return.= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1); + } else { + $return .= img_picto('', 'user'); + } + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if (property_exists($this, 'type')) { + $return .= '
'.$this->type.''; + } + if (method_exists($this, 'getmorphylib')) { + $return .= '
'.$this->getmorphylib('', 2).''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index c2b81860210..6ef559deb75 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -47,6 +47,7 @@ $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search +$mode = GETPOST('mode', 'alpha'); // Search fields @@ -535,6 +536,9 @@ if ($search_type > 0) { } $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -636,6 +640,8 @@ if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'pr $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); if ($user->hasRight('adherent', 'creer')) { $newcardbutton .= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create'); } @@ -650,6 +656,8 @@ print ''; print ''; print ''; print ''; +print ''; + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -988,276 +996,293 @@ while ($i < min($num, $limit)) { } $memberstatic->company = $companyname; - print '
'; - - // Action column - if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; - } - - if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Ref - if (!empty($arrayfields['d.ref']['checked'])) { - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Civility - if (!empty($arrayfields['d.civility']['checked'])) { - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Firstname - if (!empty($arrayfields['d.firstname']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Lastname - if (!empty($arrayfields['d.lastname']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Gender - if (!empty($arrayfields['d.gender']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Company - if (!empty($arrayfields['d.company']['checked'])) { - print '\n"; - } - // Login - if (!empty($arrayfields['d.login']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Nature (Moral/Physical) - if (!empty($arrayfields['d.morphy']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Type label - if (!empty($arrayfields['t.libelle']['checked'])) { $membertypestatic->id = $obj->type_id; $membertypestatic->label = $obj->type; - print ''; - if (!$i) { - $totalarray['nbfield']++; + $memberstatic->type = $membertypestatic->label; + $memberstatic->photo = $obj->photo; + // Output Kanban + print $memberstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print ''; + print ''; } - } - // Address - if (!empty($arrayfields['d.address']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Zip - if (!empty($arrayfields['d.zip']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Town - if (!empty($arrayfields['d.town']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // State - if (!empty($arrayfields['state.nom']['checked'])) { - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Country - if (!empty($arrayfields['country.code_iso']['checked'])) { - $tmparray = getCountry($obj->country, 'all'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Phone pro - if (!empty($arrayfields['d.phone']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Phone perso - if (!empty($arrayfields['d.phone_perso']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Phone mobile - if (!empty($arrayfields['d.phone_mobile']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // EMail - if (!empty($arrayfields['d.email']['checked'])) { - print '\n"; - } - // End of subscription date - $datefin = $db->jdate($obj->datefin); - if (!empty($arrayfields['d.datefin']['checked'])) { - print ''; + + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } + + if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Ref + if (!empty($arrayfields['d.ref']['checked'])) { + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Civility + if (!empty($arrayfields['d.civility']['checked'])) { + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Firstname + if (!empty($arrayfields['d.firstname']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Lastname + if (!empty($arrayfields['d.lastname']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Gender + if (!empty($arrayfields['d.gender']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Company + if (!empty($arrayfields['d.company']['checked'])) { + print '\n"; + } + // Login + if (!empty($arrayfields['d.login']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Nature (Moral/Physical) + if (!empty($arrayfields['d.morphy']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Type label + if (!empty($arrayfields['t.libelle']['checked'])) { + $membertypestatic->id = $obj->type_id; + $membertypestatic->label = $obj->type; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Address + if (!empty($arrayfields['d.address']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Zip + if (!empty($arrayfields['d.zip']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Town + if (!empty($arrayfields['d.town']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // State + if (!empty($arrayfields['state.nom']['checked'])) { + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Country + if (!empty($arrayfields['country.code_iso']['checked'])) { + $tmparray = getCountry($obj->country, 'all'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Phone pro + if (!empty($arrayfields['d.phone']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Phone perso + if (!empty($arrayfields['d.phone_perso']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Phone mobile + if (!empty($arrayfields['d.phone_mobile']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // EMail + if (!empty($arrayfields['d.email']['checked'])) { + print '\n"; + } + // End of subscription date + $datefin = $db->jdate($obj->datefin); + if (!empty($arrayfields['d.datefin']['checked'])) { + print ''; + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (!empty($arrayfields['d.datec']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; } } - print ''; - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Date creation - if (!empty($arrayfields['d.datec']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Birth - if (!empty($arrayfields['d.birth']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['d.tms']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - if (!empty($arrayfields['d.statut']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['d.import_key']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Action column - if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } + // Date modification + if (!empty($arrayfields['d.tms']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['d.statut']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['d.import_key']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Action column + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } - print ''."\n"; + print ''."\n"; + } $i++; } From cc6f42f926c1af929f9670a699a448ba52fbdf39 Mon Sep 17 00:00:00 2001 From: Lenin Rivas <53640168+leninrivas@users.noreply.github.com> Date: Fri, 6 Jan 2023 12:34:45 -0500 Subject: [PATCH 029/218] Add new constant PROPALE_ADDON_NOTE_PUBLIC_DEFAULT Add constant default public note --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 5fb464a6e8e..7b58f93d7b8 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1928,7 +1928,7 @@ if ($action == 'create') { print ''; print ''; print ''; print ''; print ''; } // Lot @@ -1001,7 +1004,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Action delete line if ($permissiontodelete) { - $href = $_SERVER["PHP_SELF"].'?id='.((int) $object->id).'&action=deleteline&token='.newToken().'&lineid='.((int) $line->id).'&fk_movement='.((int) $line2['fk_stock_movement']); + $href = $_SERVER["PHP_SELF"].'?id='.((int) $object->id).'&action=deleteline&token='.newToken().'&lineid='.((int) $line2['rowid']).'&fk_movement='.((int) $line2['fk_stock_movement']); print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - foreach ($object->fields as $key => $val) { - $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } elseif ($key == 'status') { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } elseif ($key == 'fk_parent_line') { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; + //mode Kanban + if ($mode == 'kanban') { + if ($i == 0) { + print ''; } - - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { - $cssforfield .= ($cssforfield ? ' ' : '').'right'; - } - - if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; - if ($key == 'status') { - print $object->getLibStatut(5); - } elseif ($key == 'fk_parent_line') { - $moparent = $object->getMoParent(); - if (is_object($moparent)) print $moparent->getNomUrl(1); - } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); - } else { - print $object->showOutputField($val, $key, $object->$key, ''); + } else { + // Show here line of result + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; - if (!$i) { - $totalarray['nbfield']++; + } + foreach ($object->fields as $key => $val) { + $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } elseif ($key == 'status') { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } elseif ($key == 'fk_parent_line') { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; } - if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + + if (in_array($val['type'], array('timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } elseif ($key == 'ref') { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } + + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { + $cssforfield .= ($cssforfield ? ' ' : '').'right'; + } + + if (!empty($arrayfields['t.'.$key]['checked'])) { + print ''; + if ($key == 'status') { + print $object->getLibStatut(5); + } elseif ($key == 'fk_parent_line') { + $moparent = $object->getMoParent(); + if (is_object($moparent)) print $moparent->getNomUrl(1); + } elseif ($key == 'rowid') { + print $object->showOutputField($val, $key, $object->id, ''); + } else { + print $object->showOutputField($val, $key, $object->$key, ''); + } + print ''; if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + $totalarray['nbfield']++; } - if (!isset($totalarray['val'])) { - $totalarray['val'] = array(); + if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + } + if (!isset($totalarray['val'])) { + $totalarray['val'] = array(); + } + if (!isset($totalarray['val']['t.'.$key])) { + $totalarray['val']['t.'.$key] = 0; + } + $totalarray['val']['t.'.$key] += $object->$key; } - if (!isset($totalarray['val']['t.'.$key])) { - $totalarray['val']['t.'.$key] = 0; - } - $totalarray['val']['t.'.$key] += $object->$key; } } - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + } + if (!$i) { + $totalarray['nbfield']++; } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - - print ''."\n"; + print ''."\n"; + } $i++; } From ccf231bc44b010eab67a6d9c27bf232bd0dcec38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Jan 2023 16:01:20 +0100 Subject: [PATCH 046/218] Fix sql error --- htdocs/commande/class/commande.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 7fca848356e..bc867516d22 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -4597,6 +4597,9 @@ class OrderLine extends CommonOrderLine if (empty($this->remise_percent)) { $this->remise_percent = 0; } + if (empty($this->remise)) { + $this->remise = 0; + } if (empty($this->info_bits)) { $this->info_bits = 0; } From 1c997eaabda71a91bf349aee3a9ccb296671506c Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Mon, 9 Jan 2023 16:56:55 +0100 Subject: [PATCH 047/218] KanbanView for list of taskActivity --- htdocs/projet/class/task.class.php | 35 ++++++++++++++++++++++++++++++ htdocs/projet/tasks/list.php | 13 ++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 91333c153f8..0383fc7c27b 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -2327,4 +2327,39 @@ class Task extends CommonObjectLine return ($datetouse > 0 && ($datetouse < ($now - $conf->project->task->warning_delay))); } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs, $conf; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + //$return .= ''; // Can be image + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'fk_project') ) { + $return .= '
'.$this->fk_project.''; + } + if (property_exists($this, 'budget_amount')) { + $return .= '
'.$langs->trans("Budget").' : '.price($this->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).''; + } + if (property_exists($this, 'fk_statut')) { + $return .= '
'.$this->fk_statut.''; + } + if (property_exists($this, 'duration_effective')) { + $return .= '
'.getTaskProgressView($this, false, false).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 72c5eb25874..bc4c8770f0f 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -580,6 +580,9 @@ llxHeader('', $title, $help_url); $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -697,7 +700,11 @@ if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'pr } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); -$newcardbutton = dolGetButtonTitle($langs->trans('NewTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create', '', $user->rights->projet->creer); +$newcardbutton = ''; + +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('NewTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create', '', $user->rights->projet->creer); print '
'."\n"; if ($optioncss != '') { @@ -712,6 +719,8 @@ if (!empty($type)) { print ''; } print ''; +print ''; + // Show description of content $texthelp = ''; @@ -1121,6 +1130,8 @@ while ($i < $imaxinloop) { print '
'; } // Output Kanban + $object->fk_statut = $projectstatic->getLibStatut(1); + $object->fk_project = $projectstatic->getNomUrl(1, 'task'); print $object->getKanbanView(''); if ($i == ($imaxinloop - 1)) { print '
'; From a2848b48812d59596768fdc5ffad1b3122837252 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Mon, 9 Jan 2023 17:52:01 +0100 Subject: [PATCH 048/218] kanbanView for Intervention List --- htdocs/fichinter/class/fichinter.class.php | 32 ++ htdocs/fichinter/list.php | 375 +++++++++++---------- 2 files changed, 231 insertions(+), 176 deletions(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 25fc0996ca0..eaafe202407 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1453,6 +1453,38 @@ class Fichinter extends CommonObject return -1; } } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + //$return .= ''; // Can be image + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if (property_exists($this, 'socid')) { + $return .= '
'.$this->socid.''; + } + if (property_exists($this, 'duration')) { + $return .= '
'.$langs->trans("Duration").' : '.convertSecondToTime($this->duration, 'allhourmin').''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } /** diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index d43b4166f1d..1892cf8c79f 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -57,6 +57,7 @@ $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'interventionlist'; +$mode = GETPOST('mode', 'alpha'); $search_ref = GETPOST('search_ref') ?GETPOST('search_ref', 'alpha') : GETPOST('search_inter', 'alpha'); $search_ref_client = GETPOST('search_ref_client', 'alpha'); @@ -460,7 +461,10 @@ $url = DOL_URL_ROOT.'/fichinter/card.php?action=create'; if (!empty($socid)) { $url .= '&socid='.$socid; } -$newcardbutton = dolGetButtonTitle($langs->trans('NewIntervention'), '', 'fa fa-plus-circle', $url, '', $user->rights->ficheinter->creer); +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('NewIntervention'), '', 'fa fa-plus-circle', $url, '', $user->rights->ficheinter->creer); print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -695,200 +699,219 @@ while ($i < $imaxinloop) { $companystatic->email = $obj->email; $companystatic->status = $obj->thirdpartystatus; - print '
'; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - if (!empty($arrayfields['f.ref']['checked'])) { - print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } } - } - if (!empty($arrayfields['f.ref_client']['checked'])) { - // Customer ref - print ''; - if (!$i) { - $totalarray['nbfield']++; + if (!empty($arrayfields['f.ref_client']['checked'])) { + // Customer ref + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; + if (!empty($arrayfields['s.nom']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - if (!empty($arrayfields['pr.ref']['checked'])) { - print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - print ''; - if (!$i) { - $totalarray['nbfield']++; + if (!empty($arrayfields['c.ref']['checked'])) { + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } } - } - if (!empty($arrayfields['c.ref']['checked'])) { - print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (!empty($arrayfields['f.datec']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date modification + if (!empty($arrayfields['f.tms']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Note public + if (!empty($arrayfields['f.note_public']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Note private + if (!empty($arrayfields['f.note_private']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['f.fk_statut']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Fields of detail of line + if (!empty($arrayfields['fd.description']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['fd.date']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['fd.duree']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['type'][$totalarray['nbfield']] = 'duration'; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'fd.duree'; + } + $totalarray['val']['fd.duree'] += $obj->duree; + } + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; } if (!$i) { $totalarray['nbfield']++; } - } - if (!empty($arrayfields['f.description']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Date creation - if (!empty($arrayfields['f.datec']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['f.tms']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Note public - if (!empty($arrayfields['f.note_public']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Note private - if (!empty($arrayfields['f.note_private']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - if (!empty($arrayfields['f.fk_statut']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Fields of detail of line - if (!empty($arrayfields['fd.description']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['fd.date']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['fd.duree']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['type'][$totalarray['nbfield']] = 'duration'; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'fd.duree'; - } - $totalarray['val']['fd.duree'] += $obj->duree; - } - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } + print ''."\n"; - print ''."\n"; - - $total += $obj->duree; + $total += $obj->duree; + } $i++; } From ee331b709e619e5527db9b29ea11785d0509279e Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Mon, 9 Jan 2023 18:23:33 +0100 Subject: [PATCH 049/218] kanbanMode for list of contracts --- htdocs/contrat/class/contrat.class.php | 32 ++ htdocs/contrat/list.php | 421 +++++++++++++------------ 2 files changed, 254 insertions(+), 199 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 1846d911cef..eb86f6e071b 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2789,6 +2789,38 @@ class Contrat extends CommonObject return ($error ? 1: 0); } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + //$return .= ''; // Can be image + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if (property_exists($this, 'societe')) { + $return .= '
'.$this->societe.''; + } + if (property_exists($this, 'date_contrat')) { + $return .= '
'.$langs->trans("DateContract").' : '.dol_print_date($this->date_contrat).''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 4b49840f681..7ea26bf6f1b 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -51,6 +51,7 @@ $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'contractlist'; // To manage different context of search +$mode = GETPOST('mode', 'alpha'); $search_name = GETPOST('search_name', 'alpha'); $search_email = GETPOST('search_email', 'alpha'); @@ -510,6 +511,9 @@ if ($socid > 0) { } $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -606,7 +610,10 @@ $url = DOL_URL_ROOT.'/contrat/card.php?action=create'; if (!empty($socid)) { $url .= '&socid='.((int) $socid); } -$newcardbutton = dolGetButtonTitle($langs->trans('NewContractSubscription'), '', 'fa fa-plus-circle', $url, '', $user->rights->contrat->creer); +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('NewContractSubscription'), '', 'fa fa-plus-circle', $url, '', $user->rights->contrat->creer); print ''; if ($optioncss != '') { @@ -618,6 +625,7 @@ print ''; print ''; print ''; print ''; +print ''; print_barre_liste($langs->trans("Contracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -909,212 +917,227 @@ while ($i < min($num, $limit)) { $socstatic->country_code = $cacheCountryIDCode[$obj->country_id]['code']; $socstatic->country = $cacheCountryIDCode[$obj->country_id]['label']; } - - - print '
'; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - // Ref - if (!empty($arrayfields['c.ref']['checked'])) { - print ''; - - print ''; - } - - // Ref thirdparty - if (!empty($arrayfields['c.ref_customer']['checked'])) { - print ''; - } - if (!empty($arrayfields['c.ref_supplier']['checked'])) { - print ''; - } - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; } - print ''; - } - // Email - if (!empty($arrayfields['s.email']['checked'])) { - print ''; - } - // Town - if (!empty($arrayfields['s.town']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Zip - if (!empty($arrayfields['s.zip']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // State - if (!empty($arrayfields['state.nom']['checked'])) { - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Country - if (!empty($arrayfields['country.code_iso']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Type ent - if (!empty($arrayfields['typent.code']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['sale_representative']['checked'])) { - // Sales representatives - print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; } - print ''; - } - // Date - if (!empty($arrayfields['c.date_contrat']['checked'])) { - print ''; - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Date creation - if (!empty($arrayfields['c.datec']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['c.tms']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date lower end date - if (!empty($arrayfields['lower_planned_end_date']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - if (!empty($arrayfields['status']['checked'])) { - print ''; - print ''; - print ''; - print ''; - } - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - print "\n"; + $filename = dol_sanitizeFileName($obj->ref); + $filedir = $conf->contrat->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; + print $formfile->getDocumentsLink($contracttmp->element, $filename, $filedir); + print ''; + + print ''; + } + + // Ref thirdparty + if (!empty($arrayfields['c.ref_customer']['checked'])) { + print ''; + } + if (!empty($arrayfields['c.ref_supplier']['checked'])) { + print ''; + } + if (!empty($arrayfields['s.nom']['checked'])) { + print ''; + } + // Email + if (!empty($arrayfields['s.email']['checked'])) { + print ''; + } + // Town + if (!empty($arrayfields['s.town']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Zip + if (!empty($arrayfields['s.zip']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // State + if (!empty($arrayfields['state.nom']['checked'])) { + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Country + if (!empty($arrayfields['country.code_iso']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Type ent + if (!empty($arrayfields['typent.code']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['sale_representative']['checked'])) { + // Sales representatives + print ''; + } + // Date + if (!empty($arrayfields['c.date_contrat']['checked'])) { + print ''; + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (!empty($arrayfields['c.datec']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date modification + if (!empty($arrayfields['c.tms']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date lower end date + if (!empty($arrayfields['lower_planned_end_date']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['status']['checked'])) { + print ''; + print ''; + print ''; + print ''; + } + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + + print "\n"; + } $i++; } From e110e7ed743c5d1ef15935d255efb644dfe9b415 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Jan 2023 19:46:16 +0100 Subject: [PATCH 050/218] Fix vat rate for luxembourg --- htdocs/install/mysql/data/llx_c_tva.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index 6c96cb46605..72cff6afde7 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -194,7 +194,7 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (14 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1402, 140, '14','0','VAT rate - intermediary',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1403, 140, '8','0','VAT rate - reduced', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1404, 140, '3','0','VAT rate - super-reduced', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1405, 140, '17','0','VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1405, 140, '16','0','VAT rate - standard',1); -- MALI (id country=147) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1471, 147, '0','0','VAT rate 0', 1); From cce5741acac669c0462bc797c8b9231ecc99347f Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 10 Jan 2023 05:45:47 +0100 Subject: [PATCH 051/218] NEW Accountancy - Add sub-account balance - FPC22 --- htdocs/accountancy/bookkeeping/balance.php | 313 ++++++++++++------ .../accountancy/class/bookkeeping.class.php | 23 +- htdocs/langs/en_US/accountancy.lang | 1 + 3 files changed, 235 insertions(+), 102 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 01d89f1168d..0d26213e52f 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -1,7 +1,7 @@ * Copyright (C) 2016 Florian Henry - * Copyright (C) 2016-2022 Alexandre Spangaro + * Copyright (C) 2016-2023 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -42,22 +42,13 @@ $langs->loadLangs(array("accountancy", "compta")); $action = GETPOST('action', 'aZ09'); $optioncss = GETPOST('optioncss', 'alpha'); -$contextpage = GETPOST('contextpage', 'aZ09'); - -// Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { - $page = 0; -} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action -$offset = $limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; -//if (! $sortfield) $sortfield="p.date_fin"; -//if (! $sortorder) $sortorder="DESC"; - +$type = GETPOST('type', 'alpha'); +if ($type == 'sub') { + $context_default = 'balancesubaccountlist'; +} else { + $context_default = 'balancelist'; +} +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : $context_default; $show_subgroup = GETPOST('show_subgroup', 'alpha'); $search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); $search_date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); @@ -70,10 +61,29 @@ $search_accountancy_code_end = GETPOST('search_accountancy_code_end', 'alpha'); if ($search_accountancy_code_end == - 1) { $search_accountancy_code_end = ''; } +$search_not_reconciled = GETPOST('search_not_reconciled', 'alpha'); + +// Load variable for pagination +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$sortfield = GETPOST('sortfield', 'aZ09comma'); +$sortorder = GETPOST('sortorder', 'aZ09comma'); +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { + $page = 0; +} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if ($sortorder == "") { + $sortorder = "ASC"; +} +if ($sortfield == "") { + $sortfield = "t.numero_compte"; +} // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $object = new BookKeeping($db); -$hookmanager->initHooks(array('balancelist')); // Note that conf->hooks_modules contains array +$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array $formaccounting = new FormAccounting($db); $formother = new FormOther($db); @@ -84,6 +94,7 @@ if (empty($search_date_start) && !GETPOSTISSET('formfilteraction')) { $sql .= " WHERE date_start < '".$db->idate(dol_now())."' AND date_end > '".$db->idate(dol_now())."'"; $sql .= $db->plimit(1); $res = $db->query($sql); + if ($res->num_rows > 0) { $fiscalYear = $db->fetch_object($res); $search_date_start = strtotime($fiscalYear->date_start); @@ -104,45 +115,6 @@ if (empty($search_date_start) && !GETPOSTISSET('formfilteraction')) { $search_date_end = dol_get_last_day($year_end, $month_end); } } -if ($sortorder == "") { - $sortorder = "ASC"; -} -if ($sortfield == "") { - $sortfield = "t.numero_compte"; -} - - -$param = ''; -if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { - $param .= '&contextpage='.urlencode($contextpage); -} -if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); -} - -$filter = array(); -if (!empty($search_date_start)) { - $filter['t.doc_date>='] = $search_date_start; - $param .= '&date_startmonth='.GETPOST('date_startmonth', 'int').'&date_startday='.GETPOST('date_startday', 'int').'&date_startyear='.GETPOST('date_startyear', 'int'); -} -if (!empty($search_date_end)) { - $filter['t.doc_date<='] = $search_date_end; - $param .= '&date_endmonth='.GETPOST('date_endmonth', 'int').'&date_endday='.GETPOST('date_endday', 'int').'&date_endyear='.GETPOST('date_endyear', 'int'); -} -if (!empty($search_accountancy_code_start)) { - $filter['t.numero_compte>='] = $search_accountancy_code_start; - $param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start); -} -if (!empty($search_accountancy_code_end)) { - $filter['t.numero_compte<='] = $search_accountancy_code_end; - $param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end); -} -if (!empty($search_ledger_code)) { - $filter['t.code_journal'] = $search_ledger_code; - foreach ($search_ledger_code as $code) { - $param .= '&search_ledger_code[]='.urlencode($code); - } -} if (!isModEnabled('accounting')) { accessforbidden(); @@ -154,14 +126,13 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) { accessforbidden(); } - - /* * Action */ -$parameters = array(); -$arrayfields = array(); +$param = ''; + +$parameters = array('socid'=>$socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -172,16 +143,67 @@ if (empty($reshook)) { $show_subgroup = ''; $search_date_start = ''; $search_date_end = ''; + $search_date_startyear = ''; + $search_date_startmonth = ''; + $search_date_startday = ''; + $search_date_endyear = ''; + $search_date_endmonth = ''; + $search_date_endday = ''; $search_accountancy_code_start = ''; $search_accountancy_code_end = ''; + $search_not_reconciled = ''; $search_ledger_code = array(); $filter = array(); } -} -/* - * View - */ + // Must be after the remove filter action, before the export. + $filter = array(); + + if (!empty($search_date_start)) { + $filter['t.doc_date>='] = $search_date_start; + $param .= '&date_startmonth=' . GETPOST('date_startmonth', 'int') . '&date_startday=' . GETPOST('date_startday', 'int') . '&date_startyear=' . GETPOST('date_startyear', 'int'); + } + if (!empty($search_date_end)) { + $filter['t.doc_date<='] = $search_date_end; + $param .= '&date_endmonth=' . GETPOST('date_endmonth', 'int') . '&date_endday=' . GETPOST('date_endday', 'int') . '&date_endyear=' . GETPOST('date_endyear', 'int'); + } + if (!empty($search_doc_date)) { + $filter['t.doc_date'] = $search_doc_date; + $param .= '&doc_datemonth=' . GETPOST('doc_datemonth', 'int') . '&doc_dateday=' . GETPOST('doc_dateday', 'int') . '&doc_dateyear=' . GETPOST('doc_dateyear', 'int'); + } + if (!empty($search_accountancy_code_start)) { + if ($type == 'sub') { + $filter['t.subledger_account>='] = $search_accountancy_code_start; + } else { + $filter['t.numero_compte>='] = $search_accountancy_code_start; + } + $param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start); + } + if (!empty($search_accountancy_code_end)) { + if ($type == 'sub') { + $filter['t.subledger_account<='] = $search_accountancy_code_end; + } else { + $filter['t.numero_compte<='] = $search_accountancy_code_end; + } + $param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end); + } + if (!empty($search_ledger_code)) { + $filter['t.code_journal'] = $search_ledger_code; + foreach ($search_ledger_code as $code) { + $param .= '&search_ledger_code[]=' . urlencode($code); + } + } + if (!empty($search_not_reconciled)) { + $filter['t.reconciled_option'] = $search_not_reconciled; + $param .= '&search_not_reconciled='.urlencode($search_not_reconciled); + } + + // param with type of list + $url_param = substr($param, 1); // remove first "&" + if (!empty($type)) { + $param = '&type=' . $type . $param; + } +} if ($action == 'export_csv') { $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; @@ -190,14 +212,23 @@ if ($action == 'export_csv') { $type_export = 'balance'; include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php'; - $result = $object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter); + if ($type == 'sub') { + $result = $object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter, 'AND', 1); + } else { + $result = $object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter); + } if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } foreach ($object->lines as $line) { - print '"'.length_accountg($line->numero_compte).'"'.$sep; - print '"'.$object->get_compte_desc($line->numero_compte).'"'.$sep; + if ($type == 'sub') { + print '"' . length_accounta($line->subledger_account) . '"' . $sep; + print '"' . $line->subledger_label . '"' . $sep; + } else { + print '"' . length_accountg($line->numero_compte) . '"' . $sep; + print '"' . $object->get_compte_desc($line->numero_compte) . '"' . $sep; + } print '"'.price($line->debit).'"'.$sep; print '"'.price($line->credit).'"'.$sep; print '"'.price($line->debit - $line->credit).'"'.$sep; @@ -207,8 +238,15 @@ if ($action == 'export_csv') { exit; } +/* + * View + */ -$title_page = $langs->trans("AccountBalance"); +if ($type == 'sub') { + $title_page = $langs->trans("AccountBalanceSubAccount"); +} else { + $title_page = $langs->trans("AccountBalance"); +} llxHeader('', $title_page); @@ -217,39 +255,52 @@ if ($action != 'export_csv') { // List $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter); + if ($type == 'sub') { + $nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter, 'AND', 1); + } else { + $nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter); + } + if ($nbtotalofrecords < 0) { setEventMessages($object->error, $object->errors, 'errors'); } } - $result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter); + if ($type == 'sub') { + $result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 1); + } else { + $result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter); + } + if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } print ''; + print ''; + print ''; if ($optioncss != '') { print ''; } - print ''; print ''; - print ''; + print ''; print ''; print ''; + print ''; print ''; $parameters = array(); - $reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - $button = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint; + $newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint; if (empty($reshook)) { - $button .= 'global->ACCOUNTING_EXPORT_FORMAT.')" />'; + $newcardbutton = 'global->ACCOUNTING_EXPORT_FORMAT.')" />'; print ''; + + if ($type == 'sub') { + $newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly')); + $newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); + } else { + $newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); + $newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly')); + } + $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create'); + } + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { + $param .= '&contextpage='.urlencode($contextpage); + } + if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.urlencode($limit); } - print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); + print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1); $selectedfields = ''; @@ -275,18 +341,38 @@ if ($action != 'export_csv') { $moreforfilter .= $form->selectDate($search_date_start ? $search_date_start : -1, 'date_start', 0, 0, 1, '', 1, 0); $moreforfilter .= $langs->trans('DateEnd').': '; $moreforfilter .= $form->selectDate($search_date_end ? $search_date_end : -1, 'date_end', 0, 0, 1, '', 1, 0); - - $moreforfilter .= ' - '; - $moreforfilter .= ': '; - $moreforfilter .= ''; - $moreforfilter .= ''; $moreforfilter .= '
'; + $moreforfilter .= ': '; + $moreforfilter .= ''; + $moreforfilter .= '
'; - $moreforfilter .= $langs->trans("Journal"); + $moreforfilter .= '
'; + $moreforfilter .= $langs->trans("Journals").': '; $moreforfilter .= $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1); + $moreforfilter .= '
'; + $moreforfilter .= '
'; + $moreforfilter .= '
'; + // Accountancy account + $moreforfilter .= $langs->trans('AccountAccounting').': '; + if ($type == 'sub') { + $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), 'maxwidth200'); + } else { + $moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, 'maxwidth200', 'accounts'); + } + $moreforfilter .= ' '; + if ($type == 'sub') { + $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), 'maxwidth200'); + } else { + $moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, 'maxwidth200', 'accounts'); + } + $moreforfilter .= '
'; + + $moreforfilter .= '
'; + $moreforfilter .= ': '; + $moreforfilter .= ''; $moreforfilter .= '
'; if (!empty($moreforfilter)) { @@ -305,9 +391,6 @@ if ($action != 'export_csv') { print '
'; print ''; // Fields from hook @@ -324,6 +407,10 @@ if ($action != 'export_csv') { print ''; print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder); + // TODO : Retrieve the type of third party: Customer / Supplier / Employee + //if ($type == 'sub') { + // print_liste_field_titre("Type", $_SERVER['PHP_SELF'], "t.type", "", $param, "", $sortfield, $sortorder); + //} if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) { print_liste_field_titre("OpeningBalance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder); } @@ -359,7 +446,7 @@ if ($action != 'export_csv') { $sql .= " GROUP BY t.numero_compte"; $resql = $db->query($sql); - $nrows = $db->num_rows($resql); + $nrows = $resql->num_rows; $opening_balances = array(); for ($i = 0; $i < $nrows; $i++) { $arr = $resql->fetch_array(); @@ -372,11 +459,13 @@ if ($action != 'export_csv') { $accountingaccountstatic->id = 0; $accountingaccountstatic->account_number = ''; - $accountingaccountstatic->fetch(null, $line->numero_compte, true); - if (!empty($accountingaccountstatic->account_number)) { - $accounting_account = $accountingaccountstatic->getNomUrl(0, 1, 0, '', 0, -1, 0, 'accountcard'); - } else { - $accounting_account = length_accountg($line->numero_compte); + if ($type != 'sub') { + $accountingaccountstatic->fetch(null, $line->numero_compte, true); + if (!empty($accountingaccountstatic->account_number)) { + $accounting_account = $accountingaccountstatic->getNomUrl(0, 1, 0, '', 0, -1, 0, 'ledger'); + } else { + $accounting_account = length_accountg($line->numero_compte); + } } $link = ''; @@ -427,7 +516,7 @@ if ($action != 'export_csv') { // Show first line of a break print ''; - print ''; + print ''; print ''; $displayed_account = $root_account_number; @@ -438,19 +527,43 @@ if ($action != 'export_csv') { } print ''; - print ''; + // Accounting account + if ($type == 'sub') { + print ''; + } else { + print ''; + } + + // Type + // TODO Retrieve the type of third party: Customer / Supplier / Employee + //if ($type == 'sub') { + // print ''; + //} + if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) { print ''; } $urlzoom = ''; - if ($line->numero_compte) { - $urlzoom = DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start='.urlencode($line->numero_compte).'&search_accountancy_code_end='.urlencode($line->numero_compte); - if (GETPOSTISSET('date_startmonth')) { - $urlzoom .= '&search_date_startmonth='.GETPOST('date_startmonth', 'int').'&search_date_startday='.GETPOST('date_startday', 'int').'&search_date_startyear='.GETPOST('date_startyear', 'int'); + if ($type == 'sub') { + if ($line->subledger_account) { + $urlzoom = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?type=sub&search_accountancy_code_start=' . urlencode($line->subledger_account) . '&search_accountancy_code_end=' . urlencode($line->subledger_account); + if (GETPOSTISSET('date_startmonth')) { + $urlzoom .= '&search_date_startmonth=' . GETPOST('date_startmonth', 'int') . '&search_date_startday=' . GETPOST('date_startday', 'int') . '&search_date_startyear=' . GETPOST('date_startyear', 'int'); + } + if (GETPOSTISSET('date_endmonth')) { + $urlzoom .= '&search_date_endmonth=' . GETPOST('date_endmonth', 'int') . '&search_date_endday=' . GETPOST('date_endday', 'int') . '&search_date_endyear=' . GETPOST('date_endyear', 'int'); + } } - if (GETPOSTISSET('date_endmonth')) { - $urlzoom .= '&search_date_endmonth='.GETPOST('date_endmonth', 'int').'&search_date_endday='.GETPOST('date_endday', 'int').'&search_date_endyear='.GETPOST('date_endyear', 'int'); + } else { + if ($line->numero_compte) { + $urlzoom = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start=' . urlencode($line->numero_compte) . '&search_accountancy_code_end=' . urlencode($line->numero_compte); + if (GETPOSTISSET('date_startmonth')) { + $urlzoom .= '&search_date_startmonth=' . GETPOST('date_startmonth', 'int') . '&search_date_startday=' . GETPOST('date_startday', 'int') . '&search_date_startyear=' . GETPOST('date_startyear', 'int'); + } + if (GETPOSTISSET('date_endmonth')) { + $urlzoom .= '&search_date_endmonth=' . GETPOST('date_endmonth', 'int') . '&search_date_endday=' . GETPOST('date_endday', 'int') . '&search_date_endyear=' . GETPOST('date_endyear', 'int'); + } } } // Debit diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 95ba38d20bb..803e2feb619 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1139,9 +1139,10 @@ class BookKeeping extends CommonObject * @param int $offset offset limit * @param array $filter filter array * @param string $filtermode filter mode (AND or OR) + * @param int $option option (0: general account or 1: subaccount) * @return int <0 if KO, >0 if OK */ - public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') + public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $option = 0) { global $conf; @@ -1151,6 +1152,9 @@ class BookKeeping extends CommonObject $sql = 'SELECT'; $sql .= " t.numero_compte,"; + $sql .= " t.label_compte,"; + $sql .= " t.subledger_account,"; + $sql .= " t.subledger_label,"; $sql .= " SUM(t.debit) as debit,"; $sql .= " SUM(t.credit) as credit"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; @@ -1176,6 +1180,8 @@ class BookKeeping extends CommonObject } else { $sqlwhere[] = natural_search("t.code_journal", $value, 3, 1); } + } elseif ($key == 't.reconciled_option') { + $sqlwhere[] = 't.lettering_code IS NULL'; } else { $sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'"; } @@ -1186,7 +1192,17 @@ class BookKeeping extends CommonObject $sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere); } - $sql .= ' GROUP BY t.numero_compte'; + if (!empty($option)) { + $sql .= ' AND t.subledger_account IS NOT NULL'; + $sql .= ' AND t.subledger_account != ""'; + $sql .= ' GROUP BY t.subledger_account'; + $sortfield = 't.subledger_account'.($sortfield ? ','.$sortfield : ''); + $sortorder = 'ASC'.($sortfield ? ','.$sortfield : ''); + } else { + $sql .= ' GROUP BY t.numero_compte'; + $sortfield = 't.numero_compte'.($sortfield ? ','.$sortfield : ''); + $sortorder = 'ASC'.($sortorder ? ','.$sortorder : ''); + } if (!empty($sortfield)) { $sql .= $this->db->order($sortfield, $sortorder); @@ -1204,6 +1220,9 @@ class BookKeeping extends CommonObject $line = new BookKeepingLine(); $line->numero_compte = $obj->numero_compte; + $line->label_compte = $obj->label_compte; + $line->subledger_account = $obj->subledger_account; + $line->subledger_label = $obj->subledger_label; $line->debit = $obj->debit; $line->credit = $obj->credit; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index e988764d8ba..19abe47fd0b 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -126,6 +126,7 @@ WriteBookKeeping=Record transactions in accounting Bookkeeping=Ledger BookkeepingSubAccount=Subledger AccountBalance=Account balance +AccountBalanceSubAccount=Sub-accounts balance ObjectsRef=Source object ref CAHTF=Total purchase vendor before tax TotalExpenseReport=Total expense report From a85e1c46946325bfbd57a564cb75a463515fa081 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 10 Jan 2023 08:49:09 +0100 Subject: [PATCH 052/218] Remove link --- htdocs/accountancy/bookkeeping/balance.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 0d26213e52f..1b3973ae0cd 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -462,7 +462,7 @@ if ($action != 'export_csv') { if ($type != 'sub') { $accountingaccountstatic->fetch(null, $line->numero_compte, true); if (!empty($accountingaccountstatic->account_number)) { - $accounting_account = $accountingaccountstatic->getNomUrl(0, 1, 0, '', 0, -1, 0, 'ledger'); + $accounting_account = $accountingaccountstatic->getNomUrl(0, 1, 1); } else { $accounting_account = length_accountg($line->numero_compte); } From 1c3d4f9301b29a107fae617fd279a711fbb4cfad Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 10 Jan 2023 09:09:39 +0100 Subject: [PATCH 053/218] Add warning --- htdocs/accountancy/bookkeeping/balance.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 1b3973ae0cd..fd8cd8ad688 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -334,6 +334,11 @@ if ($action != 'export_csv') { $selectedfields = ''; + // Warning to explain why list of record is not consistent with the other list view (missing a lot of lines) + if ($type == 'sub') { + print info_admin($langs->trans("WarningRecordWithoutSubledgerAreExcluded")); + } + $moreforfilter = ''; $moreforfilter .= '
'; From 81d2c7fa0ee8d1775c2f84960b313b8f343d31fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 10:21:36 +0100 Subject: [PATCH 054/218] NEW Can bin accounting line for a given month --- htdocs/accountancy/customer/index.php | 15 ++++++++++++--- htdocs/accountancy/expensereport/index.php | 22 +++++++++++++++++++--- htdocs/accountancy/supplier/index.php | 22 +++++++++++++++++++--- htdocs/langs/en_US/accountancy.lang | 1 + 4 files changed, 51 insertions(+), 9 deletions(-) diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 393629ae505..46e6832dba2 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -300,7 +300,10 @@ if ($action == 'validatehistory') { $db->rollback(); } else { $db->commit(); - setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs'); + setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs')); + if ($notpossible) { + setEventMessages($langs->trans('DoManualBindingForFailedRecord', $notpossible), null, 'warnings'); + } } } @@ -324,7 +327,7 @@ print '
'; $y = $year_current; -$buttonbind = ''.$langs->trans("ValidateHistory").''; +$buttonbind = ''.img_picto($langs->trans("ValidateHistory"), 'link', 'class="pictofixedwidth fa-color-unset"').$langs->trans("ValidateHistory").''; print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1); //print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); @@ -420,6 +423,12 @@ if ($resql) { print '
'; } print ''; @@ -558,7 +567,7 @@ print "
 '; $searchpicto = $form->showFilterButtons(); @@ -1055,6 +1086,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; + print '
'; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; - } - print ''; + if ($mode == 'kanban') { + if ($i == 0) { + print '
'; + print '
'; } - print '
'.$obj->rowid.'"; - print $memberstatic->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1); - print ""; - print $obj->civility; - print "'; - print $memberstatic->getNomUrl(0, 0, 'card', 'firstname'); - //print $obj->firstname; - print "'; - print $memberstatic->getNomUrl(0, 0, 'card', 'lastname'); - //print $obj->lastname; - print "'; - if ($obj->gender) { - print $langs->trans("Gender".$obj->gender); - } - print ''; - print $companynametoshow; - print "'.$obj->login."'; - print $memberstatic->getmorphylib('', 2); - print "'; - print $membertypestatic->getNomUrl(1, 32); - print '
'; - print $obj->address; - print ''; - print $obj->zip; - print ''; - print $obj->town; - print '".$obj->state_name."'; - print dol_escape_htmltag($tmparray['label']); - print ''; - print $obj->phone; - print ''; - print $obj->phone_perso; - print ''; - print $obj->phone_mobile; - print ''; - print dol_print_email($obj->email, 0, 0, 1, 64, 1, 1); - print "'; - if ($datefin) { - print dol_print_date($datefin, 'day'); - if ($memberstatic->hasDelay()) { - $textlate = ' ('.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24) >= 0 ? '+' : '').ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24).' '.$langs->trans("days").')'; - print " ".img_warning($langs->trans("SubscriptionLate").$textlate); + } else { + print '
'; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; } - } else { - if (!empty($obj->subscription)) { - print ''.$langs->trans("SubscriptionNotReceived").''; - if ($obj->statut > 0) { - print " ".img_warning(); + print ''.$obj->rowid.'"; + print $memberstatic->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1); + print ""; + print $obj->civility; + print "'; + print $memberstatic->getNomUrl(0, 0, 'card', 'firstname'); + //print $obj->firstname; + print "'; + print $memberstatic->getNomUrl(0, 0, 'card', 'lastname'); + //print $obj->lastname; + print "'; + if ($obj->gender) { + print $langs->trans("Gender".$obj->gender); + } + print ''; + print $companynametoshow; + print "'.$obj->login."'; + print $memberstatic->getmorphylib('', 2); + print "'; + print $membertypestatic->getNomUrl(1, 32); + print ''; + print $obj->address; + print ''; + print $obj->zip; + print ''; + print $obj->town; + print '".$obj->state_name."'; + print dol_escape_htmltag($tmparray['label']); + print ''; + print $obj->phone; + print ''; + print $obj->phone_perso; + print ''; + print $obj->phone_mobile; + print ''; + print dol_print_email($obj->email, 0, 0, 1, 64, 1, 1); + print "'; + if ($datefin) { + print dol_print_date($datefin, 'day'); + if ($memberstatic->hasDelay()) { + $textlate = ' ('.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24) >= 0 ? '+' : '').ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24).' '.$langs->trans("days").')'; + print " ".img_warning($langs->trans("SubscriptionLate").$textlate); } } else { - print ' '; + if (!empty($obj->subscription)) { + print ''.$langs->trans("SubscriptionNotReceived").''; + if ($obj->statut > 0) { + print " ".img_warning(); + } + } else { + print ' '; + } + } + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - print dol_print_date($db->jdate($obj->birth), 'day', 'tzuser'); - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''; - print $memberstatic->LibStatut($obj->statut, $obj->subscription, $datefin, 5); - print ''; - print dol_escape_htmltag($obj->import_key); - print "'; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; + // Birth + if (!empty($arrayfields['d.birth']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->birth), 'day', 'tzuser'); + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + print $memberstatic->LibStatut($obj->statut, $obj->subscription, $datefin, 5); + print ''; + print dol_escape_htmltag($obj->import_key); + print "'; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print '
'.$langs->trans('NotePublic').''; - $note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc) ? $objectsrc->note_public : null)); + $note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc) ? $objectsrc->note_public : (!empty($conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT) ? $conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT : null))); $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); From 5be0bf17368233de9f858600ce174ef2751afcf1 Mon Sep 17 00:00:00 2001 From: Lenin Rivas <53640168+leninrivas@users.noreply.github.com> Date: Fri, 6 Jan 2023 13:17:19 -0500 Subject: [PATCH 030/218] FIX line brak public note default --- htdocs/comm/propal/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 7b58f93d7b8..39632e14e64 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -15,6 +15,7 @@ * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2020 Nicolas ZABOURI * Copyright (C) 2022 Gauthier VERDOL + * Copyright (C) 2023 Lenin Rivas * * 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 @@ -1928,7 +1929,7 @@ if ($action == 'create') { print '
'.$langs->trans('NotePublic').''; - $note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc) ? $objectsrc->note_public : (!empty($conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT) ? $conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT : null))); + $note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc) ? $objectsrc->note_public : (!empty($conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT) ? $conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT : null)), 'restricthtml'); $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); From 75d177f03a8161a70cb64a19682837078434c1b9 Mon Sep 17 00:00:00 2001 From: Lenin Rivas <53640168+leninrivas@users.noreply.github.com> Date: Fri, 6 Jan 2023 13:23:16 -0500 Subject: [PATCH 031/218] New param $type getDefaultCreateValueFor New param $type in fucntion getDefaultCreateValueFor --- htdocs/core/class/commonobject.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 48e5124f213..5b6dac99a4b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -16,6 +16,7 @@ * Copyright (C) 2018 Josep Lluís Amador * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2021 Grégory Blémand + * Copyright (C) 2023 Lenin Rivas * * 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 @@ -5738,15 +5739,16 @@ abstract class CommonObject * * @param string $fieldname Name of field * @param string $alternatevalue Alternate value to use + * @param string $type Type of data * @return string|string[] Default value (can be an array if the GETPOST return an array) **/ - public function getDefaultCreateValueFor($fieldname, $alternatevalue = null) + public function getDefaultCreateValueFor($fieldname, $alternatevalue = null, $type = 'alphanohtml') { global $conf, $_POST; // If param here has been posted, we use this value first. if (GETPOSTISSET($fieldname)) { - return GETPOST($fieldname, 'alphanohtml', 3); + return GETPOST($fieldname, $type, 3); } if (isset($alternatevalue)) { From 805bf6442858f563887444874432ab51d52c24c4 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 8 Jan 2023 15:00:58 +0100 Subject: [PATCH 032/218] Fix php 8 error --- htdocs/public/payment/newpayment.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 79104817e77..144506ab7b6 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1039,6 +1039,7 @@ if ($source == 'order') { $amount = price2num($amount); } + $tag = ''; if (GETPOST('fulltag', 'alpha')) { $fulltag = GETPOST('fulltag', 'alpha'); } else { From 590334300d37a2aa9e0076f6b0427473ff2d876e Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 8 Jan 2023 15:27:11 +0100 Subject: [PATCH 033/218] Fix php 8 error --- htdocs/societe/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index bb9d2376a47..8b5dcd251d2 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -95,6 +95,7 @@ $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); $backtopagejsfields = GETPOST('backtopagejsfields', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); +$dol_openinpopup = ''; if (!empty($backtopagejsfields)) { $tmpbacktopagejsfields = explode(':', $backtopagejsfields); $dol_openinpopup = $tmpbacktopagejsfields[0]; From 828da5f83cd297437a60b0d3f88d29c5c87d2214 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 8 Jan 2023 15:33:12 +0100 Subject: [PATCH 034/218] Fix php 8 errors --- htdocs/margin/agentMargins.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index f89cc60736d..e68576edd81 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -49,6 +49,11 @@ $pagenext = $page + 1; if (!$sortorder) { $sortorder = "ASC"; } +if ($user->rights->margins->read->all) { + $agentid = GETPOST('agentid', 'int'); +} else { + $agentid = $user->id; +} if (!$sortfield) { if ($agentid > 0) { $sortfield = "s.nom"; @@ -74,11 +79,6 @@ if (!empty($enddatemonth)) { } // Security check -if ($user->rights->margins->read->all) { - $agentid = GETPOST('agentid', 'int'); -} else { - $agentid = $user->id; -} $result = restrictedArea($user, 'margins'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -317,7 +317,8 @@ if ($result) { $sortfield = 'name'; } $group_list = dol_sort_array($group_list, $sortfield, $sortorder); - + $cumul_achat = 0; + $cumul_vente = 0; foreach ($group_list as $group_id => $group_array) { $pa = $group_array['buying_price']; $pv = $group_array['selling_price']; From f649fcf8cfdbd00097583b3679e2029922f41057 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 8 Jan 2023 15:48:23 +0100 Subject: [PATCH 035/218] Fix php 8 errors --- htdocs/core/tpl/card_presend.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 84b051d24f3..2393524e572 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -40,7 +40,7 @@ if ($action == 'presend') { $titreform = 'SendMail'; $object->fetch_projet(); - + if (!isset($file)) $file = null; $ref = dol_sanitizeFileName($object->ref); if (!in_array($object->element, array('user', 'member'))) { //$fileparams['fullname'] can be filled from the card @@ -57,7 +57,7 @@ if ($action == 'presend') { } } - $file = $fileparams['fullname']; + $file = isset($fileparams['fullname'])?$fileparams['fullname']:null; } // Define output language From f08407e59736a5a51a9a860cb057790c75681b4c Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 8 Jan 2023 17:07:59 +0100 Subject: [PATCH 036/218] Fix php 8 errors --- htdocs/don/card.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 459c892a1d9..ec22c82543f 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -52,7 +52,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); - +$socid = GETPOST('socid', 'int'); $amount = price2num(GETPOST('amount', 'alphanohtml'), 'MT'); $donation_date = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); @@ -63,6 +63,13 @@ if ($id > 0 || $ref) { $object->fetch($id, $ref); } +if (!empty($socid) && $socid > 0) { + $soc = new Societe($db); + if ($socid > 0) { + $soc->fetch($socid); + } +} + $extrafields = new ExtraFields($db); // fetch optionals attributes and labels From 6962d4aaa3cb515837693cb2a3c3255b2b3b56c8 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 8 Jan 2023 17:10:30 +0100 Subject: [PATCH 037/218] Update list.php --- htdocs/don/list.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/don/list.php b/htdocs/don/list.php index ac704571daa..c2f89ebc759 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -59,6 +59,7 @@ $search_status = (GETPOST("search_status", 'intcomma') != '') ? GETPOST("search_ $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_ref = GETPOST('search_ref', 'alpha'); $search_company = GETPOST('search_company', 'alpha'); +$search_thirdparty = GETPOST('search_thirdparty', 'alpha'); $search_name = GETPOST('search_name', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); @@ -71,6 +72,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_all = ""; $search_ref = ""; $search_company = ""; + $search_thirdparty = ""; $search_name = ""; $search_amount = ""; $search_status = ''; From 23013282ffddccea472bae55ba8741fcf328b1d3 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 8 Jan 2023 21:30:12 +0100 Subject: [PATCH 038/218] Fix php 8 error if empty value, there is an error when doc is generated --- htdocs/core/class/commondocgenerator.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 82012400f68..e1780985c7c 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1288,7 +1288,8 @@ abstract class CommonDocGenerator } $extrafields = $this->extrafieldsCache; - $extrafieldOutputContent = $extrafields->showOutputField($extrafieldKey, $object->array_options[$extrafieldOptionsKey], '', $object->table_element); + $extrafieldOutputContent = ''; + if (isset($object->array_options[$extrafieldOptionsKey])) $extrafieldOutputContent = $extrafields->showOutputField($extrafieldKey, $object->array_options[$extrafieldOptionsKey], '', $object->table_element); // TODO : allow showOutputField to be pdf public friendly, ex: in a link to object, clean getNomUrl to remove link and images... like a getName methode ... if ($extrafields->attributes[$object->table_element]['type'][$extrafieldKey] == 'link') { From f8aa861a7785e76bb43298358910a321815eb232 Mon Sep 17 00:00:00 2001 From: Christian Humpel Date: Sun, 8 Jan 2023 21:43:12 +0100 Subject: [PATCH 039/218] Fix: REST MO API - It's able to have a wrong value on the 'ref' Field --- htdocs/mrp/class/api_mos.class.php | 28 ++++++++++++++++++++++++++++ htdocs/mrp/class/mo.class.php | 1 + 2 files changed, 29 insertions(+) diff --git a/htdocs/mrp/class/api_mos.class.php b/htdocs/mrp/class/api_mos.class.php index 48396025957..794ab3d5378 100644 --- a/htdocs/mrp/class/api_mos.class.php +++ b/htdocs/mrp/class/api_mos.class.php @@ -203,6 +203,9 @@ class Mos extends DolibarrApi foreach ($request_data as $field => $value) { $this->mo->$field = $value; } + + $this->checkRefNumbering(); + if (!$this->mo->create(DolibarrApiAccess::$user)) { throw new RestException(500, "Error creating MO", array_merge(array($this->mo->error), $this->mo->errors)); } @@ -239,6 +242,8 @@ class Mos extends DolibarrApi $this->mo->$field = $value; } + $this->checkRefNumbering(); + if ($this->mo->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); } else { @@ -723,4 +728,27 @@ class Mos extends DolibarrApi } return $myobject; } + + /** + * Validate the ref field and get the next Number if it's necessary. + * + * @return void + */ + private function checkRefNumbering(): void + { + $ref = substr($this->mo->ref, 1, 4); + if ($this->mo->status > 0 && $ref == 'PROV') { + throw new RestException(400, "Wrong naming scheme '(PROV%)' is only allowed on 'DRAFT' status. For automatic increment use 'auto' on the 'ref' field."); + } + + if (strtolower($this->mo->ref) == 'auto') { + if (empty($this->mo->id) && $this->mo->status == 0) { + $this->mo->ref = ''; // 'ref' will auto incremented with '(PROV' + newID + ')' + } else { + $this->mo->fetch_product(); + $numref = $this->mo->getNextNumRef($this->mo->product); + $this->mo->ref = $numref; + } + } + } } diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index c977a14d9ca..223605bffe3 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -277,6 +277,7 @@ class Mo extends CommonObject if ($this->fk_bom > 0) { // If there is a nown BOM, we force the type of MO to the type of BOM + include_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; $tmpbom = new BOM($this->db); $tmpbom->fetch($this->fk_bom); From 5152a7720885f636060843bd915f50ba92e404b0 Mon Sep 17 00:00:00 2001 From: Christian Humpel Date: Mon, 9 Jan 2023 00:49:24 +0100 Subject: [PATCH 040/218] Fix #23108: - Set NULL on fk_warehouse if stockmovement is empty. - Fix deletion on lines without stockmovement -> set the correct rowid of the line. - Fix stock qty and warnings correct. --- htdocs/mrp/mo_production.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 1f61bf37935..c23f51c58cb 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2019-2020 Laurent Destailleur +/* Copyright (C) 2023 Christian Humpel * * 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 @@ -239,7 +240,7 @@ if (empty($reshook)) { $moline->batch = GETPOST('batch-'.$line->id.'-'.$i); $moline->role = 'consumed'; $moline->fk_mrp_production = $line->id; - $moline->fk_stock_movement = $idstockmove; + $moline->fk_stock_movement = $idstockmove == 0 ? null : $idstockmove; $moline->fk_user_creat = $user->id; $resultmoline = $moline->create($user); @@ -924,10 +925,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Stock if (isModEnabled('stock')) { print ''; - if ($tmpproduct->stock_reel < ($line->qty - $alreadyconsumed)) { - print img_warning($langs->trans('StockTooLow')).' '; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES) && $tmpproduct->type != PRODUCT::TYPE_SERVICE) { + if (!$line->disable_stock_change && $tmpproduct->stock_reel < ($line->qty - $alreadyconsumed)) { + print img_warning($langs->trans('StockTooLow')) . ' '; + } + print price2num($tmpproduct->stock_reel, 'MS'); // Available } - print price2num($tmpproduct->stock_reel, 'MS'); // Available print ''; print ''; print img_picto($langs->trans('TooltipDeleteAndRevertStockMovement'), 'delete'); From 32610ec3cacc0929c000667f88fb97653ada2f36 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 19 Dec 2022 14:27:22 +0100 Subject: [PATCH 041/218] NEW category of operation for crabe PDF model --- .../modules/facture/doc/pdf_crabe.modules.php | 57 +++++++++++++++++++ .../facture/doc/pdf_sponge.modules.php | 56 +++++++++++++++++- 2 files changed, 111 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index ee4cc9b5d0d..30a61fbb1d3 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -132,6 +132,11 @@ class pdf_crabe extends ModelePDFFactures */ public $posxprogress; + /** + * @var int Category of operation + */ + public $categoryOfOperation = -1; // unknown by default + /** * Constructor @@ -402,11 +407,37 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right // Set $this->atleastonediscount if you have at least one discount + // and determine category of operation + $categoryOfOperation = 0; + $nbProduct = 0; + $nbService = 0; for ($i = 0; $i < $nblines; $i++) { if ($object->lines[$i]->remise_percent) { $this->atleastonediscount++; } + + // determine category of operation + if ($categoryOfOperation < 2) { + $lineProductType = $object->lines[$i]->product_type; + if ($lineProductType == Product::TYPE_PRODUCT) { + $nbProduct++; + } elseif ($lineProductType == Product::TYPE_SERVICE) { + $nbService++; + } + if ($nbProduct > 0 && $nbService > 0) { + // mixed products and services + $categoryOfOperation = 2; + } + } } + // determine category of operation + if ($categoryOfOperation <= 0) { + // only services + if ($nbProduct == 0 && $nbService > 0) { + $categoryOfOperation = 1; + } + } + $this->categoryOfOperation = $categoryOfOperation; if (empty($this->atleastonediscount)) { // retrieve space not used by discount $delta = ($this->posxprogress - $this->posxdiscount); $this->posxpicture += $delta; @@ -1128,6 +1159,10 @@ class pdf_crabe extends ModelePDFFactures } $posxval = 52; + $posxend = 110; // End of x for text on left side + if ($this->page_largeur < 210) { // To work with US executive format + $posxend -= 10; + } // Show payments conditions if ($object->type != 2 && ($object->cond_reglement_code || $object->cond_reglement)) { @@ -1145,6 +1180,21 @@ class pdf_crabe extends ModelePDFFactures $posy = $pdf->GetY() + 3; // We need spaces for 2 lines payment conditions } + // Show category of operations + if (getDolGlobalInt('INVOICE_CATEGORY_OF_OPERATION') == 2 && $this->categoryOfOperation >= 0) { + $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetXY($this->marge_gauche, $posy); + $categoryOfOperationTitle = $outputlangs->transnoentities("MentionCategoryOfOperations").' : '; + $pdf->MultiCell($posxval - $this->marge_gauche, 4, $categoryOfOperationTitle, 0, 'L'); + + $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetXY($posxval, $posy); + $categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation); + $pdf->MultiCell($posxend - $posxval, 4, $categoryOfOperationLabel, 0, 'L'); + + $posy = $pdf->GetY() + 3; // for 2 lines + } + if ($object->type != 2) { // Check a payment mode is defined if (empty($object->mode_reglement_code) @@ -1659,6 +1709,13 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetFont('', '', $default_font_size - 2); if (empty($hidetop)) { + // Show category of operations + if (getDolGlobalInt('INVOICE_CATEGORY_OF_OPERATION') == 1 && $this->categoryOfOperation >= 0) { + $categoryOfOperations = $outputlangs->transnoentities("MentionCategoryOfOperations") . ' : ' . $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation); + $pdf->SetXY($this->marge_gauche, $tab_top - 4); + $pdf->MultiCell(($pdf->GetStringWidth($categoryOfOperations)) + 4, 2, $categoryOfOperations); + } + $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 1bea6b0db67..5edfc3f6157 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -159,6 +159,11 @@ class pdf_sponge extends ModelePDFFactures */ public $cols; + /** + * @var int Category of operation + */ + public $categoryOfOperation = -1; // unknown by default + /** * Constructor @@ -429,12 +434,37 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right // Set $this->atleastonediscount if you have at least one discount + // and determine category of operation + $categoryOfOperation = 0; + $nbProduct = 0; + $nbService = 0; for ($i = 0; $i < $nblines; $i++) { if ($object->lines[$i]->remise_percent) { $this->atleastonediscount++; } - } + // determine category of operation + if ($categoryOfOperation < 2) { + $lineProductType = $object->lines[$i]->product_type; + if ($lineProductType == Product::TYPE_PRODUCT) { + $nbProduct++; + } elseif ($lineProductType == Product::TYPE_SERVICE) { + $nbService++; + } + if ($nbProduct > 0 && $nbService > 0) { + // mixed products and services + $categoryOfOperation = 2; + } + } + } + // determine category of operation + if ($categoryOfOperation <= 0) { + // only services + if ($nbProduct == 0 && $nbService > 0) { + $categoryOfOperation = 1; + } + } + $this->categoryOfOperation = $categoryOfOperation; // Situation invoice handling if ($object->situation_cycle_ref) { @@ -1241,6 +1271,21 @@ class pdf_sponge extends ModelePDFFactures $posy = $pdf->GetY() + 3; // We need spaces for 2 lines payment conditions } + // Show category of operations + if (getDolGlobalInt('INVOICE_CATEGORY_OF_OPERATION') == 2 && $this->categoryOfOperation >= 0) { + $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetXY($this->marge_gauche, $posy); + $categoryOfOperationTitle = $outputlangs->transnoentities("MentionCategoryOfOperations").' : '; + $pdf->MultiCell($posxval - $this->marge_gauche, 4, $categoryOfOperationTitle, 0, 'L'); + + $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetXY($posxval, $posy); + $categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation); + $pdf->MultiCell($posxend - $posxval, 4, $categoryOfOperationLabel, 0, 'L'); + + $posy = $pdf->GetY() + 3; // for 2 lines + } + if ($object->type != 2) { // Check a payment mode is defined if (empty($object->mode_reglement_code) @@ -1967,6 +2012,13 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetFont('', '', $default_font_size - 2); if (empty($hidetop)) { + // Show category of operations + if (getDolGlobalInt('INVOICE_CATEGORY_OF_OPERATION') == 1 && $this->categoryOfOperation >= 0) { + $categoryOfOperations = $outputlangs->transnoentities("MentionCategoryOfOperations") . ' : ' . $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation); + $pdf->SetXY($this->marge_gauche, $tab_top - 4); + $pdf->MultiCell(($pdf->GetStringWidth($categoryOfOperations)) + 4, 2, $categoryOfOperations); + } + $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) { $titre .= ' - '.$outputlangsbis->transnoentities("AmountInCurrency", $outputlangsbis->transnoentitiesnoconv("Currency".$currency)); @@ -2337,7 +2389,7 @@ class pdf_sponge extends ModelePDFFactures $carac_client_shipping = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, $usecontact, 'target', $object); } else { $carac_client_name_shipping=pdfBuildThirdpartyName($object->thirdparty, $outputlangs); - $carac_client_shipping=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'target', $object);; + $carac_client_shipping=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'target', $object); } if (!empty($carac_client_shipping) && (isset($object->contact->socid) && $object->contact->socid != $object->socid)) { $posy += $hautcadre; From 21c665d53605653336b1b5a06fb1e92e191407b6 Mon Sep 17 00:00:00 2001 From: Adnan RIHAN Date: Mon, 9 Jan 2023 01:47:38 +0100 Subject: [PATCH 042/218] Fix EAN13 prefix available for internal use [GS1](https://www.gs1.org/prefixes) only allows prefixes 040-049 for internal use within a company, while the often mistakenly 020-029 prefixes are restricted. --- .../iso-normes/qr-bar-codes/barcode_EAN13.txt | 235 ++++++++++-------- htdocs/admin/barcode.php | 4 +- .../barcode/mod_barcode_product_standard.php | 2 +- .../mod_barcode_thirdparty_standard.php | 2 +- 4 files changed, 138 insertions(+), 105 deletions(-) diff --git a/dev/resources/iso-normes/qr-bar-codes/barcode_EAN13.txt b/dev/resources/iso-normes/qr-bar-codes/barcode_EAN13.txt index e8000035788..549c6e29a1d 100644 --- a/dev/resources/iso-normes/qr-bar-codes/barcode_EAN13.txt +++ b/dev/resources/iso-normes/qr-bar-codes/barcode_EAN13.txt @@ -10,8 +10,7 @@ Signification des chiffres. - 1 chiffre pour la somme de controle Cette regle subit de nombreuses entorses pour ameliorer l'usage des chiffres disponibles. -Voici la liste des codes pays ou systeme : - +Voici la liste des codes pays ou systeme, les préfixes qui ne sont pas explicitement mentionnés sont réservés par GS1 : EN @@ -25,105 +24,139 @@ Meaning of the numbers: This rule has been twisted many times to improve the use of the available numbers. -Here is the list of country codes or system: +Here is the list of country codes or system, prefixes not explicitly listed are reserved by GS1: -List -==== +List (https://www.gs1.org/prefixes) +=================================== -00 - 13 UCC (U.S.A / États-Unis & Canada) -20 - 29 Flag for internal numbering / Codification interne en magasin -30 - 37 GENCOD-EAN France -380 BCCI (Bulgaria) -383 SANA (Slovenia) -385 CRO-EAN (Croatia) -387 EAN-BIH (Bosnia-Herzegovina) -400-440 CCG (DE/Germany/Allemagne) -45 + 49 Distribution Code Center - DCC (Japan) -460-469 UNISCAN - EAN Russia (Federation de Russie) -471 CAN Taiwan -474 EAN Estonia -475 EAN Latvia -476 EAN Azerbaijan -477 EAN Lithuania -478 EAN Uzbekistan -479 EAN Sri Lanka -480 PANC Philippines -481 EAN Belarus -482 EAN Ukraine -484 EAN Moldova -485 EAN Armenia -486 EAN Georgia -487 EAN Kazakhstan -489 HKANA Hong Kong -50 E Centre UK - United Kingdom -520 HELLCAN-EAN HELLAS - Greece -528 EAN Lebanon -529 EAN Cyprus -531 EAN-MAC (FYR Macedonia) -535 EAN Malta -539 EAN Ireland -54 ICODIF/EAN Belgium & Luxembourg -560 CODIPOR (Portugal) -569 EAN Iceland/Islande -57 EAN Denmark -590 EAN Poland -594 EAN Romania -599 H.A.P.M.H. (Hungary) -600-601 EAN South Africa -609 EAN Mauritius Island -611 EAN Morocco -613 EAN Algeria -619 Tunicode (Tunisia) -621 EAN Syria -622 EAN Egypt -625 EAN Jordan/Jordanie -626 EAN Iran -628 EAN Saudi Arabia -64 EAN Finland -690-693 ANCC - Article Numbering Centre of China -70 EAN Norge (Norvege) -729 Israeli Bar Code Association - EAN Israel -73 EAN Suede -740 EAN Guatemala -741 EAN El Salvador -742 ICCC (Honduras) -743 EAN Nicaragua -744 EAN Costa Rica Panama -746 746 EAN Republique Dominicaine -750 AMECE (Mexique) -759 EAN Venezuela -76 EAN (Schweiz, Suisse, Svizzera) -770 IAC (Colombie) -773 EAN Uruguay -775 APC - EAN Peru (Perou) -777 EAN Bolivie -779 CODIGO - EAN Argentine -780 EAN Chili -784 EAN Paraguay -786 ECOP (Equateur) -789 EAN Bresil -80 - 83 INDICOD (Italy) -84 AECOC (Espagne) -850 Camera de Comercio de la Republica de Cuba (Cuba) -858 EAN Slovaquie -859 EAN Republique Tcheque -860 EAN YU (Yougoslavie) -867 EAN DPR Korea (Coree du Nord) -869 Union of Chambers of Commerce of Turkey (Turquie) -87 EAN Nederland (Hollande) -880 EAN Korea (Coree du Sud) -885 EAN Thailande -888 SANC (Singapour) -890 EAN Inde -893 EAN Vietnam -899 EAN Indonesie -90 - 91 EAN Autriche -93 EAN Australie -94 EAN Nouvelle Zelande -955 Malaysian Article Numbering Council (MANC) - Malaisie -977 Publications sirielles (ISSN) -978 - 979 Livres (ISBN) -980 Refus de remboursement -981 - 982 Coupons (monnaie courante) -99 Coupons +0000000 Flag for internal numbering / Codification interne en magasin +00001–01999 GS1 US (U.S.A / États-Unis & Canada) +020-029 Restricted / Restreint +030-039 GS1 US (U.S.A / États-Unis & Canada) +040-049 Flag for internal numbering / Codification interne en magasin +050-059 GS1 US (U.S.A / États-Unis & Canada) +060-139 GS1 US (U.S.A / États-Unis & Canada) +300-379 GS1 France +380 GS1 Bulgaria +383 GS1 Slovenija +385 GS1 Croatia +387 GS1 BIH (Bosnia-Herzegovina) +389 GS1 Montenegro +400-440 GS1 Germany +450-459 GS1 Japan +460-469 GS1 Russia +470 GS1 Kyrgyzstan +471 GS1 Chinese Taipei +474 GS1 Estonia +475 GS1 Latvia +476 GS1 Azerbaijan +477 GS1 Lithuania +478 GS1 Uzbekistan +479 GS1 Sri Lanka +480 GS1 Philippines +481 GS1 Belarus +482 GS1 Ukraine +483 GS1 Turkmenistan +484 GS1 Moldova +485 GS1 Armenia +486 GS1 Georgia +487 GS1 Kazakstan +488 GS1 Tajikistan +489 GS1 Hong Kong, China +490-499 GS1 Japan +500-509 GS1 UK +520-521 GS1 Association Greece +528 GS1 Lebanon +529 GS1 Cyprus +530 GS1 Albania +531 GS1 Macedonia +535 GS1 Malta +539 GS1 Ireland +540-549 GS1 Belgium & Luxembourg +560 GS1 Portugal +569 GS1 Iceland +570-579 GS1 Denmark +590 GS1 Poland +594 GS1 Romania +599 GS1 Hungary +600-601 GS1 South Africa +603 GS1 Ghana +604 GS1 Senegal +607 GS1 Oman +608 GS1 Bahrain +609 GS1 Mauritius +611 GS1 Morocco +613 GS1 Algeria +615 GS1 Nigeria +616 GS1 Kenya +617 GS1 Cameroon +618 GS1 Côte d'Ivoire +619 GS1 Tunisia +620 GS1 Tanzania +621 GS1 Syria +622 GS1 Egypt +624 GS1 Libya +625 GS1 Jordan +626 GS1 Iran +627 GS1 Kuwait +628 GS1 Saudi Arabia +629 GS1 Emirates +630 GS1 Qatar +631 GS1 Namibia +640-649 GS1 Finland +690-699 GS1 China +700-709 GS1 Norway +729 GS1 Israel +730-739 GS1 Sweden +740 GS1 Guatemala +741 GS1 El Salvador +742 GS1 Honduras +743 GS1 Nicaragua +744 GS1 Costa Rica +745 GS1 Panama +746 GS1 Republica Dominicana +750 GS1 Mexico +754-755 GS1 Canada +759 GS1 Venezuela +760-769 GS1 Schweiz, Suisse, Svizzera +770-771 GS1 Colombia +773 GS1 Uruguay +775 GS1 Peru +777 GS1 Bolivia +778-779 GS1 Argentina +780 GS1 Chile +784 GS1 Paraguay +786 GS1 Ecuador +789-790 GS1 Brasil +800-839 GS1 Italy +840-849 GS1 Spain +850 GS1 Cuba +858 GS1 Slovakia +859 GS1 Czech +860 GS1 Serbia +865 GS1 Mongolia +867 GS1 North Korea +868-869 GS1 Türkiye +870-879 GS1 Netherlands +880 GS1 South Korea +883 GS1 Myanmar +884 GS1 Cambodia +885 GS1 Thailand +888 GS1 Singapore +890 GS1 India +893 GS1 Vietnam +896 GS1 Pakistan +899 GS1 Indonesia +900-919 GS1 Austria +930-939 GS1 Australia +940-949 GS1 New Zealand +950 GS1 Global Office +955 GS1 Malaysia +958 GS1 Macao, China +960-969 Global Office - GTIN-8 +977 Serial publications / Publications en série (ISSN) +978-979 Bookland / Livres (ISBN) +980 Refund receipts / Remboursements +981-983 GS1 Coupons +99 GS1 Coupons diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 96dd7affdba..176816c0f88 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -52,7 +52,7 @@ if ($action == 'setbarcodeproducton') { $barcodenumberingmodule = GETPOST('value', 'alpha'); $res = dolibarr_set_const($db, "BARCODE_PRODUCT_ADDON_NUM", $barcodenumberingmodule, 'chaine', 0, '', $conf->entity); if ($barcodenumberingmodule == 'mod_barcode_product_standard' && empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK)) { - $res = dolibarr_set_const($db, "BARCODE_STANDARD_PRODUCT_MASK", '020{000000000}', 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "BARCODE_STANDARD_PRODUCT_MASK", '04{0000000000}', 'chaine', 0, '', $conf->entity); } } elseif ($action == 'setbarcodeproductoff') { $res = dolibarr_del_const($db, "BARCODE_PRODUCT_ADDON_NUM", $conf->entity); @@ -62,7 +62,7 @@ if ($action == 'setbarcodethirdpartyon') { $barcodenumberingmodule = GETPOST('value', 'alpha'); $res = dolibarr_set_const($db, "BARCODE_THIRDPARTY_ADDON_NUM", $barcodenumberingmodule, 'chaine', 0, '', $conf->entity); if ($barcodenumberingmodule == 'mod_barcode_thirdparty_standard' && empty($conf->global->BARCODE_STANDARD_THIRDPARTY_MASK)) { - $res = dolibarr_set_const($db, "BARCODE_STANDARD_THIRDPARTY_MASK", '020{000000000}', 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "BARCODE_STANDARD_THIRDPARTY_MASK", '04{0000000000}', 'chaine', 0, '', $conf->entity); } } elseif ($action == 'setbarcodethirdpartyoff') { $res = dolibarr_del_const($db, "BARCODE_THIRDPARTY_ADDON_NUM", $conf->entity); diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index f4bf05afb3b..b1775a1e95f 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -100,7 +100,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("BarCode"), $langs->transnoentities("BarCode")); $tooltip .= $langs->trans("GenericMaskCodes3EAN"); $tooltip .= ''.$langs->trans("Example").':
'; - $tooltip .= '020{000000000}? (for internal use)
'; + $tooltip .= '04{0000000000}? (for internal use)
'; $tooltip .= '9771234{00000}? (example of ISSN code with prefix 1234)
'; $tooltip .= '9791234{00000}? (example of ISMN code with prefix 1234)
'; //$tooltip.=$langs->trans("GenericMaskCodes5"); diff --git a/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php b/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php index e25cd1dd115..6eae8da2c1f 100644 --- a/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php @@ -101,7 +101,7 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("BarCode"), $langs->transnoentities("BarCode")); $tooltip .= $langs->trans("GenericMaskCodes3EAN"); $tooltip .= ''.$langs->trans("Example").':
'; - $tooltip .= '020{000000000}? (for internal use)
'; + $tooltip .= '04{0000000000}? (for internal use)
'; $tooltip .= '9771234{00000}? (example of ISSN code with prefix 1234)
'; $tooltip .= '9791234{00000}? (example of ISMN code with prefix 1234)
'; //$tooltip.=$langs->trans("GenericMaskCodes5"); From 4c9d6b5e51092aaed715c062e1b93f4987782d61 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 9 Jan 2023 13:57:20 +0100 Subject: [PATCH 043/218] FIX hide details option in supplier order PDF model --- htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 736e23519bc..892e93018bd 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -567,7 +567,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // Total HT line if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN)) { - $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs); + $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->postotalht, $curY); $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0); } From 4e0ea65c43d4b687f2b3ccee1b3b9beb35400a08 Mon Sep 17 00:00:00 2001 From: hystepik Date: Mon, 9 Jan 2023 15:37:10 +0100 Subject: [PATCH 044/218] Fix #23466 : fix public payement pages ko and ok --- htdocs/public/payment/paymentko.php | 2 +- htdocs/public/payment/paymentok.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index 606bed0c490..0359b116078 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -169,7 +169,7 @@ if (!empty($_SESSION['ipaddress'])) { // To avoid to make action twice $companylangs->setDefaultLang($mysoc->default_lang); $companylangs->loadLangs(array('main', 'members', 'bills', 'paypal', 'paybox')); - $from = $conf->global->MAILING_EMAIL_FROM; + $from = !empty($conf->global->MAILING_EMAIL_FROM) ? $conf->global->MAILING_EMAIL_FROM : getDolGlobalString("MAIN_MAIL_EMAIL_FROM"); $sendto = $sendemail; // Define link to login card diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 57e23350a2c..c2223ea7708 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -1287,7 +1287,7 @@ if ($ispaymentok) { $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); $sendto = $attendeetovalidate->email; - $from = $conf->global->MAILING_EMAIL_FROM; + $from = !empty($conf->global->MAILING_EMAIL_FROM) ? $conf->global->MAILING_EMAIL_FROM : getDolGlobalString("MAIN_MAIL_EMAIL_FROM"); $urlback = $_SERVER["REQUEST_URI"]; $ishtml = dol_textishtml($texttosend); // May contain urls @@ -1579,7 +1579,7 @@ if ($ispaymentok) { $companylangs->loadLangs(array('main', 'members', 'bills', 'paypal', 'paybox')); $sendto = $sendemail; - $from = $conf->global->MAILING_EMAIL_FROM; + $from = !empty($conf->global->MAILING_EMAIL_FROM) ? $conf->global->MAILING_EMAIL_FROM : getDolGlobalString("MAIN_MAIL_EMAIL_FROM"); // Define $urlwithroot $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file @@ -1720,7 +1720,7 @@ if ($ispaymentok) { $companylangs->loadLangs(array('main', 'members', 'bills', 'paypal', 'paybox')); $sendto = $sendemail; - $from = $conf->global->MAILING_EMAIL_FROM; + $from = !empty($conf->global->MAILING_EMAIL_FROM) ? $conf->global->MAILING_EMAIL_FROM : getDolGlobalString("MAIN_MAIL_EMAIL_FROM"); // Define $urlwithroot $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file From 2c971555f5d148bd63075355f8634d6f723d9179 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Mon, 9 Jan 2023 15:52:33 +0100 Subject: [PATCH 045/218] KanbanView for list of mrp --- htdocs/mrp/class/mo.class.php | 32 ++++++ htdocs/mrp/mo_list.php | 178 ++++++++++++++++++++-------------- 2 files changed, 135 insertions(+), 75 deletions(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 8624713c689..fd4ba8db4b9 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1553,6 +1553,38 @@ class Mo extends CommonObject return $MoParent; } } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + //$return .= ''; // Can be image + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if (property_exists($this, 'fk_bom')) { + $return .= '
'.$this->fk_bom.''; + } + if (property_exists($this, 'qty')) { + $return .= '
'.$langs->trans('Quantity').' : '.$this->qty.''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } /** diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 1a00a2dc052..99e91fec184 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -46,6 +46,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'molist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$mode = GETPOST('mode', 'alpha'); $id = GETPOST('id', 'int'); @@ -370,6 +371,9 @@ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', ''); $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -423,8 +427,12 @@ print ''; print ''; print ''; print ''; +print ''; -$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/mrp/mo_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/mrp/mo_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -583,6 +591,7 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar // Loop on record // -------------------------------------------------------------------- +$bom = new Bom($db); $i = 0; $totalarray = array(); $totalarray['nbfield'] = 0; @@ -595,94 +604,113 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); - // Show here line of result - print '
'; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($object->id, $arrayofselected)) { - $selected = 1; - } - print ''; - } - print '
'; + print '
'; } + $object->id = $obj->type_id; + $bom->id = $obj->fk_bom; + $objectBom = $bom->fetch($obj->fk_bom); + //var_dump($bom);exit; + $object->fk_bom = $bom->getNomUrl(); - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + // Output Kanban + print $object->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print '
'; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; } print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($object->id, $arrayofselected)) { - $selected = 1; + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; } - print ''; + print '
'; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; - } - print ''; + //mode kanban + if ($mode == 'kanban') { + if ($i == 0) { + print '
'; + print '
'; } - print '
"; - print ''; - // Picto + Ref - print ''; - // Warning - $warnornote = ''; - //if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->fichinter->warning_delay)) $warnornote.=img_warning($langs->trans("Late")); - if (!empty($obj->note_private)) { - $warnornote .= ($warnornote ? ' ' : ''); - $warnornote .= ''; - $warnornote .= ''.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').''; - $warnornote .= ''; + // Output Kanban + $objectstatic->duration = $obj->duree; + $objectstatic->socid = $companystatic->getNomUrl(1, '', 44); + + + print $objectstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print ''; + print ''; } - if ($warnornote) { - print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; } + if (!empty($arrayfields['f.ref']['checked'])) { + print "
'; - print $objectstatic->getNomUrl(1); - print '
'; - print $warnornote; + } else { + print '
'; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } print '"; - // Other picto tool - print ''; - $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->ficheinter->dir_output.'/'.dol_sanitizeFileName($obj->ref); - $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; - print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); - print '
'; + print ''; + // Picto + Ref + print ''; + // Warning + $warnornote = ''; + //if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->fichinter->warning_delay)) $warnornote.=img_warning($langs->trans("Late")); + if (!empty($obj->note_private)) { + $warnornote .= ($warnornote ? ' ' : ''); + $warnornote .= ''; + $warnornote .= ''.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').''; + $warnornote .= ''; + } + if ($warnornote) { + print ''; + } - print "\n"; - if (!$i) { - $totalarray['nbfield']++; + // Other picto tool + print '
'; + print $objectstatic->getNomUrl(1); + print ''; + print $warnornote; + print ''; + $filename = dol_sanitizeFileName($obj->ref); + $filedir = $conf->ficheinter->dir_output.'/'.dol_sanitizeFileName($obj->ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; + print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + print '
'; + + print "
'; - print dol_escape_htmltag($obj->ref_client); - print ''; + print dol_escape_htmltag($obj->ref_client); + print ''; - print $companystatic->getNomUrl(1, '', 44); - print ''; + print $companystatic->getNomUrl(1, '', 44); + print ''; - $projetstatic->id = $obj->projet_id; - $projetstatic->ref = $obj->projet_ref; - $projetstatic->title = $obj->projet_title; - if ($projetstatic->id > 0) { - print $projetstatic->getNomUrl(1, ''); + if (!empty($arrayfields['pr.ref']['checked'])) { + print ''; + $projetstatic->id = $obj->projet_id; + $projetstatic->ref = $obj->projet_ref; + $projetstatic->title = $obj->projet_title; + if ($projetstatic->id > 0) { + print $projetstatic->getNomUrl(1, ''); + } + print ''; + $contratstatic->id = $obj->contrat_id; + $contratstatic->ref = $obj->contrat_ref; + $contratstatic->ref_customer = $obj->contrat_ref_customer; + $contratstatic->ref_supplier = $obj->contrat_ref_supplier; + if ($contratstatic->id > 0) { + print $contratstatic->getNomUrl(1, ''); + print ''; - $contratstatic->id = $obj->contrat_id; - $contratstatic->ref = $obj->contrat_ref; - $contratstatic->ref_customer = $obj->contrat_ref_customer; - $contratstatic->ref_supplier = $obj->contrat_ref_supplier; - if ($contratstatic->id > 0) { - print $contratstatic->getNomUrl(1, ''); + if (!empty($arrayfields['f.description']['checked'])) { + print ''.dol_trunc(dolGetFirstLineOfText(dol_string_nohtmltag($obj->description, 1)), 48).''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + print dol_string_nohtmltag($obj->note_public); + print ''; + print dol_string_nohtmltag($obj->note_private); + print ''.$objectstatic->getLibStatut(5).''.dol_trunc(dolGetFirstLineOfText(dol_string_nohtmltag($obj->descriptiondetail, 1)), 48).''.dol_print_date($db->jdate($obj->dp), 'dayhour')."'.convertSecondToTime($obj->duree, 'allhourmin').''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } print ''.dol_trunc(dolGetFirstLineOfText(dol_string_nohtmltag($obj->description, 1)), 48).''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''; - print dol_string_nohtmltag($obj->note_public); - print ''; - print dol_string_nohtmltag($obj->note_private); - print ''.$objectstatic->getLibStatut(5).''.dol_trunc(dolGetFirstLineOfText(dol_string_nohtmltag($obj->descriptiondetail, 1)), 48).''.dol_print_date($db->jdate($obj->dp), 'dayhour')."'.convertSecondToTime($obj->duree, 'allhourmin').''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; - } - print ''; - } - print '
'; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; - } - print ''; - } - print ''; - print $contracttmp->getNomUrl(1); - if ($obj->nb_late) { - print img_warning($langs->trans("Late")); - } - if (!empty($obj->note_private) || !empty($obj->note_public)) { - print ' '; - print ''.img_picto($langs->trans("ViewPrivateNote"), 'note').''; - print ''; + //mode kanban + if ($mode == 'kanban') { + if ($i == 0) { + print '
'; + print '
'; } - $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->contrat->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref); - $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; - print $formfile->getDocumentsLink($contracttmp->element, $filename, $filedir); - print '
'.$contracttmp->getFormatedCustomerRef($obj->ref_customer).''.dol_escape_htmltag($obj->ref_supplier).''; - if ($obj->socid > 0) { - // TODO Use a cache for this string - print $socstatic->getNomUrl(1, ''); + // Output Kanban + $contracttmp->societe = $socstatic->getNomUrl(); + $contracttmp->date_contrat = $obj->date_contrat; + print $contracttmp->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print ''; + print '
'.dol_print_email($obj->email, 0, $obj->socid, 0, 0, 1, 1).''; - print $obj->town; - print ''; - print $obj->zip; - print '".$obj->state_name."'; - print dol_escape_htmltag($socstatic->country); - print ''; - if (count($typenArray) == 0) { - $typenArray = $formcompany->typent_array(1); - } - print $typenArray[$obj->typent_code]; - print ''; - if ($obj->socid > 0) { - $listsalesrepresentatives = $socstatic->getSalesRepresentatives($user); - if ($listsalesrepresentatives < 0) { - dol_print_error($db); - } - $nbofsalesrepresentative = count($listsalesrepresentatives); - if ($nbofsalesrepresentative > 6) { - // We print only number - print $nbofsalesrepresentative; - } elseif ($nbofsalesrepresentative > 0) { - $userstatic = new User($db); - $j = 0; - foreach ($listsalesrepresentatives as $val) { - $userstatic->id = $val['id']; - $userstatic->lastname = $val['lastname']; - $userstatic->firstname = $val['firstname']; - $userstatic->email = $val['email']; - $userstatic->statut = $val['statut']; - $userstatic->entity = $val['entity']; - $userstatic->photo = $val['photo']; - $userstatic->login = $val['login']; - $userstatic->phone = $val['phone']; - $userstatic->job = $val['job']; - $userstatic->gender = $val['gender']; - - //print '
': - print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); - $j++; - if ($j < $nbofsalesrepresentative) { - print ' '; - } - //print '
'; + } else { + print '
'; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; } + print ''; } - //else print $langs->trans("NoSalesRepresentativeAffected"); - } else { - print ' '; + print ''.dol_print_date($db->jdate($obj->date_contrat), 'day', 'tzserver').''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''; - print dol_print_date($db->jdate($obj->lower_planned_end_date), 'day', 'tzuser'); - print ''.($obj->nb_initial > 0 ? $obj->nb_initial : '').''.($obj->nb_running > 0 ? $obj->nb_running : '').''.($obj->nb_expired > 0 ? $obj->nb_expired : '').''.($obj->nb_closed > 0 ? $obj->nb_closed : '').''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; + // Ref + if (!empty($arrayfields['c.ref']['checked'])) { + print ''; + print $contracttmp->getNomUrl(1); + if ($obj->nb_late) { + print img_warning($langs->trans("Late")); + } + if (!empty($obj->note_private) || !empty($obj->note_public)) { + print ' '; + print ''.img_picto($langs->trans("ViewPrivateNote"), 'note').''; + print ''; } - print ''; - } - print '
'.$contracttmp->getFormatedCustomerRef($obj->ref_customer).''.dol_escape_htmltag($obj->ref_supplier).''; + if ($obj->socid > 0) { + // TODO Use a cache for this string + print $socstatic->getNomUrl(1, ''); + } + print ''.dol_print_email($obj->email, 0, $obj->socid, 0, 0, 1, 1).''; + print $obj->town; + print ''; + print $obj->zip; + print '".$obj->state_name."'; + print dol_escape_htmltag($socstatic->country); + print ''; + if (count($typenArray) == 0) { + $typenArray = $formcompany->typent_array(1); + } + print $typenArray[$obj->typent_code]; + print ''; + if ($obj->socid > 0) { + $listsalesrepresentatives = $socstatic->getSalesRepresentatives($user); + if ($listsalesrepresentatives < 0) { + dol_print_error($db); + } + $nbofsalesrepresentative = count($listsalesrepresentatives); + if ($nbofsalesrepresentative > 6) { + // We print only number + print $nbofsalesrepresentative; + } elseif ($nbofsalesrepresentative > 0) { + $userstatic = new User($db); + $j = 0; + foreach ($listsalesrepresentatives as $val) { + $userstatic->id = $val['id']; + $userstatic->lastname = $val['lastname']; + $userstatic->firstname = $val['firstname']; + $userstatic->email = $val['email']; + $userstatic->statut = $val['statut']; + $userstatic->entity = $val['entity']; + $userstatic->photo = $val['photo']; + $userstatic->login = $val['login']; + $userstatic->phone = $val['phone']; + $userstatic->job = $val['job']; + $userstatic->gender = $val['gender']; + + //print '
': + print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); + $j++; + if ($j < $nbofsalesrepresentative) { + print ' '; + } + //print '
'; + } + } + //else print $langs->trans("NoSalesRepresentativeAffected"); + } else { + print ' '; + } + print '
'.dol_print_date($db->jdate($obj->date_contrat), 'day', 'tzserver').''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + print dol_print_date($db->jdate($obj->lower_planned_end_date), 'day', 'tzuser'); + print ''.($obj->nb_initial > 0 ? $obj->nb_initial : '').''.($obj->nb_running > 0 ? $obj->nb_running : '').''.($obj->nb_expired > 0 ? $obj->nb_expired : '').''.($obj->nb_closed > 0 ? $obj->nb_closed : '').''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print '
'; - print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, '', 'accounts'); - print ' '; - print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, '', 'accounts'); print '
'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').''.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'
'.$accounting_account.''.$line->subledger_account.' ('.$line->subledger_label.')'.$accounting_account.''.price(price2num($opening_balance, 'MT')).''; print price($row[$i]); + // Add link to make binding + if (!empty(price2num($row[$i]))) { + print ''; + print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"'); + print ''; + } print ''.price($row[14]).'
\n"; print '
'; -if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange. Why showing a report that should rely on result of this step ? +if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This part of code looks strange. Why showing a report that should rely on result of this step ? print '
'; print '
'; diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 5064003c7ff..df226ce115d 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -162,7 +162,10 @@ if ($action == 'validatehistory') { $db->rollback(); } else { $db->commit(); - setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs'); + setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs')); + if ($notpossible) { + setEventMessages($langs->trans('DoManualBindingForFailedRecord', $notpossible), null, 'warnings'); + } } } @@ -185,7 +188,7 @@ print '
'; $y = $year_current; -$buttonbind = ''.$langs->trans("ValidateHistory").''; +$buttonbind = ''.img_picto('', 'link', 'class="paddingright fa-color-unset"').$langs->trans("ValidateHistory").''; print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1); @@ -269,8 +272,21 @@ if ($resql) { } print ''; for ($i = 2; $i <= 13; $i++) { + $cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2); + if ($cursormonth > 12) { + $cursormonth -= 12; + } + $cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + $tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt'); + print ''; print price($row[$i]); + // Add link to make binding + if (!empty(price2num($row[$i]))) { + print ''; + print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"'); + print ''; + } print ''; } print ''.price($row[14]).''; @@ -367,7 +383,7 @@ print ''; -if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange. Why showing a report where results depends on next step (so not yet available) ? +if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This part of code looks strange. Why showing a report that should rely on result of this step ? print '
'; print '
'; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index b214b89734c..b66b791f7b1 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -298,7 +298,10 @@ if ($action == 'validatehistory') { $db->rollback(); } else { $db->commit(); - setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs'); + setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs')); + if ($notpossible) { + setEventMessages($langs->trans('DoManualBindingForFailedRecord', $notpossible), null, 'warnings'); + } } } @@ -320,7 +323,7 @@ print '
'; $y = $year_current; -$buttonbind = ''.$langs->trans("ValidateHistory").''; +$buttonbind = ''.img_picto('', 'link', 'class="paddingright fa-color-unset"').$langs->trans("ValidateHistory").''; print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1); @@ -408,8 +411,21 @@ if ($resql) { } print ''; for ($i = 2; $i <= 13; $i++) { + $cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2); + if ($cursormonth > 12) { + $cursormonth -= 12; + } + $cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + $tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt'); + print ''; print price($row[$i]); + // Add link to make binding + if (!empty(price2num($row[$i]))) { + print ''; + print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"'); + print ''; + } print ''; } print ''.price($row[14]).''; @@ -541,7 +557,7 @@ print "\n"; print ''; -if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange. Why showing a report that should rely on result of this step ? +if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This part of code looks strange. Why showing a report that should rely on result of this step ? print '
'; print '
'; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 419b69a3f90..554087ad5c4 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -297,6 +297,7 @@ DescValidateMovements=Any modification or deletion of writing, lettering and del ValidateHistory=Bind Automatically AutomaticBindingDone=Automatic bindings done (%s) - Automatic binding not possible for some record (%s) +DoManualBindingForFailedRecord=You have to do a manual link for the rows not linked %s automatically. ErrorAccountancyCodeIsAlreadyUse=Error, you cannot remove or disable this account of chart of account because it is used MvtNotCorrectlyBalanced=Movement not correctly balanced. Debit = %s & Credit = %s From 765a542e1265493a21996da33021354e665ecbf3 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 10 Jan 2023 10:32:35 +0100 Subject: [PATCH 055/218] kanban mode for list of fournisseur commande --- .../class/fournisseur.commande.class.php | 32 + htdocs/fourn/commande/list.php | 672 +++++++++--------- 2 files changed, 384 insertions(+), 320 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 00ed65e7616..9482ff7f500 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3544,6 +3544,38 @@ class CommandeFournisseur extends CommonOrder return -1; } } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + //$return .= ''; // Can be image + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if (property_exists($this, 'socid') || property_exists($this, 'total_tva')) { + $return .='
'.$this->socid.''; + } + if (property_exists($this, 'billed')) { + $return .= '
'.$langs->trans("Billed").' : '.yn($this->billed).''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 3d458247bcf..96c2f7d6cbf 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -56,6 +56,7 @@ $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'supplierorderlist'; +$mode = GETPOST('mode', 'alpha'); // Search Criteria $search_date_order_startday = GETPOST('search_date_order_startday', 'int'); @@ -576,6 +577,9 @@ if (empty($reshook)) { // Make a redirect to avoid to bill twice if we make a refresh or back $param = ''; + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -998,6 +1002,9 @@ if ($resql) { llxHeader('', $title, $help_url); $param = ''; + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -1184,7 +1191,10 @@ if ($resql) { $url .= '&socid='.((int) $socid); $url .= '&backtopage='.urlencode(DOL_URL_ROOT.'/fourn/commande/list.php?socid='.((int) $socid)); } - $newcardbutton = dolGetButtonTitle($langs->trans('NewSupplierOrderShort'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd); + $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('NewSupplierOrderShort'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd); // Lines of title fields print ''; @@ -1198,6 +1208,7 @@ if ($resql) { print ''; print ''; print ''; + print ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'supplier_order', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -1660,344 +1671,365 @@ if ($resql) { $objectstatic->note_private = $obj->note_private; $objectstatic->statut = $obj->fk_statut; - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; - } - print ''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } - print ''; - } - // Ref - if (!empty($arrayfields['cf.ref']['checked'])) { - print ''; - // Picto + Ref - print $objectstatic->getNomUrl(1, '', 0, -1, 1); - // Other picto tool - $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->fournisseur->commande->dir_output.'/'.dol_sanitizeFileName($obj->ref); - print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); - - print ''."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Ref Supplier - if (!empty($arrayfields['cf.ref_supplier']['checked'])) { - print ''.dol_escape_htmltag($obj->ref_supplier).''."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Project - if (!empty($arrayfields['cf.fk_projet']['checked'])) { - $projectstatic->id = $obj->project_id; - $projectstatic->ref = $obj->project_ref; - $projectstatic->title = $obj->project_title; - print ''; - if ($obj->project_id > 0) { - print $projectstatic->getNomUrl(1); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Author - $userstatic->id = $obj->fk_user_author; - $userstatic->lastname = $obj->lastname; - $userstatic->firstname = $obj->firstname; - $userstatic->login = $obj->login; - $userstatic->photo = $obj->photo; - $userstatic->email = $obj->user_email; - $userstatic->statut = $obj->user_status; - if (!empty($arrayfields['u.login']['checked'])) { - print ''; - if ($userstatic->id) { - print $userstatic->getNomUrl(1); - } - print ""; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Thirdparty - if (!empty($arrayfields['cf.fk_soc']['checked'])) { - print ''; $thirdpartytmp->id = $obj->socid; $thirdpartytmp->name = $obj->name; $thirdpartytmp->email = $obj->email; $thirdpartytmp->name_alias = $obj->alias; $thirdpartytmp->client = $obj->client; $thirdpartytmp->fournisseur = $obj->fournisseur; - print $thirdpartytmp->getNomUrl(1, 'supplier', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); - print ''."\n"; - if (!$i) { - $totalarray['nbfield']++; + $objectstatic->socid = $thirdpartytmp->getNomUrl('supplier', 0, 0, -1); + // Output Kanban + print $objectstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; } - } - //alias - if (!empty($arrayfields['s.name_alias']['checked'])) { - print ''; - print $obj->alias; - print ''."\n"; - if (!$i) { - $totalarray['nbfield']++; + } else { + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; } - } - // Town - if (!empty($arrayfields['s.town']['checked'])) { - print ''; - print $obj->town; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Zip - if (!empty($arrayfields['s.zip']['checked'])) { - print ''; - print $obj->zip; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // State - if (!empty($arrayfields['state.nom']['checked'])) { - print "".$obj->state_name."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Country - if (!empty($arrayfields['country.code_iso']['checked'])) { - print ''; - $tmparray = getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Type ent - if (!empty($arrayfields['typent.code']['checked'])) { - print ''; - if (empty($typenArray)) { - $typenArray = $formcompany->typent_array(1); - } - print $typenArray[$obj->typent_code]; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } + // Ref + if (!empty($arrayfields['cf.ref']['checked'])) { + print ''; - // Order date - if (!empty($arrayfields['cf.date_commande']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_commande), 'day'); - if ($objectstatic->statut != $objectstatic::STATUS_ORDERSENT && $objectstatic->statut != $objectstatic::STATUS_RECEIVED_PARTIALLY) { - if ($objectstatic->hasDelay()) { - print ' '.img_picto($langs->trans("Late").' : '.$objectstatic->showDelay(), "warning"); + // Picto + Ref + print $objectstatic->getNomUrl(1, '', 0, -1, 1); + // Other picto tool + $filename = dol_sanitizeFileName($obj->ref); + $filedir = $conf->fournisseur->commande->dir_output.'/'.dol_sanitizeFileName($obj->ref); + print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + + print ''."\n"; + if (!$i) { + $totalarray['nbfield']++; } } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Plannned date of delivery - if (!empty($arrayfields['cf.date_livraison']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_livraison), 'day'); - if ($objectstatic->statut == $objectstatic::STATUS_ORDERSENT || $objectstatic->statut == $objectstatic::STATUS_RECEIVED_PARTIALLY) { - if ($objectstatic->hasDelay()) { - print ' '.img_picto($langs->trans("Late").' : '.$objectstatic->showDelay(), "warning"); + // Ref Supplier + if (!empty($arrayfields['cf.ref_supplier']['checked'])) { + print ''.dol_escape_htmltag($obj->ref_supplier).''."\n"; + if (!$i) { + $totalarray['nbfield']++; } } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount HT - if (!empty($arrayfields['cf.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'cf.total_ht'; - } - $totalarray['val']['cf.total_ht'] += $obj->total_ht; - } - // Amount VAT - if (!empty($arrayfields['cf.total_tva']['checked'])) { - print ''.price($obj->total_tva)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'cf.total_tva'; - } - $totalarray['val']['cf.total_tva'] += $obj->total_tva; - } - // Amount TTC - if (!empty($arrayfields['cf.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'cf.total_ttc'; - } - $totalarray['val']['cf.total_ttc'] += $obj->total_ttc; - } - - // Currency - if (!empty($arrayfields['cf.multicurrency_code']['checked'])) { - print ''.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Currency rate - if (!empty($arrayfields['cf.multicurrency_tx']['checked'])) { - print ''; - $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount HT - if (!empty($arrayfields['cf.multicurrency_total_ht']['checked'])) { - print ''.price($obj->multicurrency_total_ht)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount VAT - if (!empty($arrayfields['cf.multicurrency_total_tva']['checked'])) { - print ''.price($obj->multicurrency_total_tva)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount TTC - if (!empty($arrayfields['cf.multicurrency_total_ttc']['checked'])) { - print ''.price($obj->multicurrency_total_ttc)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Date creation - if (!empty($arrayfields['cf.date_creation']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['cf.tms']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - if (!empty($arrayfields['cf.fk_statut']['checked'])) { - print ''.$objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Billed - if (!empty($arrayfields['cf.billed']['checked'])) { - print ''.yn($obj->billed).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // valid date - if (!empty($arrayfields['cf.date_valid']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_valid), 'day'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // approve date - if (!empty($arrayfields['cf.date_approve']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_approve), 'day'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Note public - if (!empty($arrayfields['cf.note_public']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_public); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Note private - if (!empty($arrayfields['cf.note_private']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_private); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; + // Project + if (!empty($arrayfields['cf.fk_projet']['checked'])) { + $projectstatic->id = $obj->project_id; + $projectstatic->ref = $obj->project_ref; + $projectstatic->title = $obj->project_title; + print ''; + if ($obj->project_id > 0) { + print $projectstatic->getNomUrl(1); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Author + $userstatic->id = $obj->fk_user_author; + $userstatic->lastname = $obj->lastname; + $userstatic->firstname = $obj->firstname; + $userstatic->login = $obj->login; + $userstatic->photo = $obj->photo; + $userstatic->email = $obj->user_email; + $userstatic->statut = $obj->user_status; + if (!empty($arrayfields['u.login']['checked'])) { + print ''; + if ($userstatic->id) { + print $userstatic->getNomUrl(1); + } + print ""; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Thirdparty + if (!empty($arrayfields['cf.fk_soc']['checked'])) { + print ''; + $thirdpartytmp->id = $obj->socid; + $thirdpartytmp->name = $obj->name; + $thirdpartytmp->email = $obj->email; + $thirdpartytmp->name_alias = $obj->alias; + $thirdpartytmp->client = $obj->client; + $thirdpartytmp->fournisseur = $obj->fournisseur; + print $thirdpartytmp->getNomUrl(1, 'supplier', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); + print ''."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + //alias + if (!empty($arrayfields['s.name_alias']['checked'])) { + print ''; + print $obj->alias; + print ''."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Town + if (!empty($arrayfields['s.town']['checked'])) { + print ''; + print $obj->town; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Zip + if (!empty($arrayfields['s.zip']['checked'])) { + print ''; + print $obj->zip; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // State + if (!empty($arrayfields['state.nom']['checked'])) { + print "".$obj->state_name."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Country + if (!empty($arrayfields['country.code_iso']['checked'])) { + print ''; + $tmparray = getCountry($obj->fk_pays, 'all'); + print $tmparray['label']; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Type ent + if (!empty($arrayfields['typent.code']['checked'])) { + print ''; + if (empty($typenArray)) { + $typenArray = $formcompany->typent_array(1); + } + print $typenArray[$obj->typent_code]; + print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - print "\n"; + // Order date + if (!empty($arrayfields['cf.date_commande']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_commande), 'day'); + if ($objectstatic->statut != $objectstatic::STATUS_ORDERSENT && $objectstatic->statut != $objectstatic::STATUS_RECEIVED_PARTIALLY) { + if ($objectstatic->hasDelay()) { + print ' '.img_picto($langs->trans("Late").' : '.$objectstatic->showDelay(), "warning"); + } + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Plannned date of delivery + if (!empty($arrayfields['cf.date_livraison']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_livraison), 'day'); + if ($objectstatic->statut == $objectstatic::STATUS_ORDERSENT || $objectstatic->statut == $objectstatic::STATUS_RECEIVED_PARTIALLY) { + if ($objectstatic->hasDelay()) { + print ' '.img_picto($langs->trans("Late").' : '.$objectstatic->showDelay(), "warning"); + } + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount HT + if (!empty($arrayfields['cf.total_ht']['checked'])) { + print ''.price($obj->total_ht)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'cf.total_ht'; + } + $totalarray['val']['cf.total_ht'] += $obj->total_ht; + } + // Amount VAT + if (!empty($arrayfields['cf.total_tva']['checked'])) { + print ''.price($obj->total_tva)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'cf.total_tva'; + } + $totalarray['val']['cf.total_tva'] += $obj->total_tva; + } + // Amount TTC + if (!empty($arrayfields['cf.total_ttc']['checked'])) { + print ''.price($obj->total_ttc)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'cf.total_ttc'; + } + $totalarray['val']['cf.total_ttc'] += $obj->total_ttc; + } - $total += $obj->total_ht; - $subtotal += $obj->total_ht; + // Currency + if (!empty($arrayfields['cf.multicurrency_code']['checked'])) { + print ''.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Currency rate + if (!empty($arrayfields['cf.multicurrency_tx']['checked'])) { + print ''; + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount HT + if (!empty($arrayfields['cf.multicurrency_total_ht']['checked'])) { + print ''.price($obj->multicurrency_total_ht)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount VAT + if (!empty($arrayfields['cf.multicurrency_total_tva']['checked'])) { + print ''.price($obj->multicurrency_total_tva)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount TTC + if (!empty($arrayfields['cf.multicurrency_total_ttc']['checked'])) { + print ''.price($obj->multicurrency_total_ttc)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (!empty($arrayfields['cf.date_creation']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date modification + if (!empty($arrayfields['cf.tms']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['cf.fk_statut']['checked'])) { + print ''.$objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Billed + if (!empty($arrayfields['cf.billed']['checked'])) { + print ''.yn($obj->billed).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // valid date + if (!empty($arrayfields['cf.date_valid']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_valid), 'day'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // approve date + if (!empty($arrayfields['cf.date_approve']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_approve), 'day'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Note public + if (!empty($arrayfields['cf.note_public']['checked'])) { + print ''; + print dol_string_nohtmltag($obj->note_public); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Note private + if (!empty($arrayfields['cf.note_private']['checked'])) { + print ''; + print dol_string_nohtmltag($obj->note_private); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + + print "\n"; + + $total += $obj->total_ht; + $subtotal += $obj->total_ht; + } $i++; } From 04a216bf62a7d4acb3bf1f408c4feb3a6af32071 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 10:26:36 +0100 Subject: [PATCH 056/218] Debug and clean link page --- htdocs/accountancy/customer/index.php | 27 +++++++++------------- htdocs/accountancy/expensereport/index.php | 24 ++++++++++++++++++- htdocs/accountancy/supplier/index.php | 27 +++++++++------------- htdocs/langs/en_US/accountancy.lang | 2 +- 4 files changed, 46 insertions(+), 34 deletions(-) diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 46e6832dba2..1029934b8c6 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -126,21 +126,6 @@ if ($action == 'validatehistory') { $db->begin(); // Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind - /*if ($db->type == 'pgsql') { - $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet"; - $sql1 .= " SET fk_code_ventilation = accnt.rowid"; - $sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; - $sql1 .= " WHERE " . MAIN_DB_PREFIX . "facturedet.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity); - $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number"; - $sql1 .= " AND " . MAIN_DB_PREFIX . "facturedet.fk_code_ventilation = 0"; - } else { - $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; - $sql1 .= " SET fk_code_ventilation = accnt.rowid"; - $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity); - $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number"; - $sql1 .= " AND fd.fk_code_ventilation = 0"; - }*/ - // Customer Invoice lines (must be same request than into page list.php for manual binding) $sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype, f.fk_facture_source,"; $sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; @@ -408,7 +393,17 @@ if ($resql) { print ''; print ''; if ($row[0] == 'tobind') { - print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind")); + $startmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1); + if ($startmonth > 12) { + $startmonth -= 12; + } + $startyear = ($startmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + $endmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + 11; + if ($endmonth > 12) { + $endmonth -= 12; + } + $endyear = ($endmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_date_startday=1&search_date_startmonth='.((int) $startmonth).'&search_date_startyear='.((int) $startyear).'&search_date_endday=&search_date_endmonth='.((int) $endmonth).'&search_date_endyear='.((int) $endyear), $langs->transnoentitiesnoconv("ToBind")); } else { print $row[1]; } diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index df226ce115d..aefa03651cb 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -266,7 +266,17 @@ if ($resql) { print ''; print ''; if ($row[0] == 'tobind') { - print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind")); + $startmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1); + if ($startmonth > 12) { + $startmonth -= 12; + } + $startyear = ($startmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + $endmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + 11; + if ($endmonth > 12) { + $endmonth -= 12; + } + $endyear = ($endmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_date_startday=1&search_date_startmonth='.((int) $startmonth).'&search_date_startyear='.((int) $startyear).'&search_date_endday=&search_date_endmonth='.((int) $endmonth).'&search_date_endyear='.((int) $endyear), $langs->transnoentitiesnoconv("ToBind")); } else { print $row[1]; } @@ -293,6 +303,12 @@ if ($resql) { print ''; } $db->free($resql); + + if ($num == 0) { + print ''; + print ''.$langs->trans("NoRecordFound").''; + print ''; + } } else { print $db->lasterror(); // Show last sql error } @@ -375,6 +391,12 @@ if ($resql) { print ''; } $db->free($resql); + + if ($num == 0) { + print ''; + print ''.$langs->trans("NoRecordFound").''; + print ''; + } } else { print $db->lasterror(); // Show last sql error } diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index b66b791f7b1..1ffe913f9aa 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -124,21 +124,6 @@ if ($action == 'validatehistory') { $db->begin(); // Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind - /*if ($db->type == 'pgsql') { - $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; - $sql1 .= " SET fk_code_ventilation = accnt.rowid"; - $sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; - $sql1 .= " WHERE " . MAIN_DB_PREFIX . "facture_fourn_det.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.$conf->entity; - $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number"; - $sql1 .= " AND " . MAIN_DB_PREFIX . "facture_fourn_det.fk_code_ventilation = 0"; - } else { - $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; - $sql1 .= " SET fk_code_ventilation = accnt.rowid"; - $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.$conf->entity; - $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number"; - $sql1 .= " AND fd.fk_code_ventilation = 0"; - }*/ - // Supplier Invoice Lines (must be same request than into page list.php for manual binding) $sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype, f.fk_facture_source,"; $sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; @@ -405,7 +390,17 @@ if ($resql) { print ''; print ''; if ($row[0] == 'tobind') { - print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind")); + $startmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1); + if ($startmonth > 12) { + $startmonth -= 12; + } + $startyear = ($startmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + $endmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + 11; + if ($endmonth > 12) { + $endmonth -= 12; + } + $endyear = ($endmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_date_startday=1&search_date_startmonth='.((int) $startmonth).'&search_date_startyear='.((int) $startyear).'&search_date_endday=&search_date_endmonth='.((int) $endmonth).'&search_date_endyear='.((int) $endyear), $langs->transnoentitiesnoconv("ToBind")); } else { print $row[1]; } diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 554087ad5c4..5fb63c1c2ae 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -297,7 +297,7 @@ DescValidateMovements=Any modification or deletion of writing, lettering and del ValidateHistory=Bind Automatically AutomaticBindingDone=Automatic bindings done (%s) - Automatic binding not possible for some record (%s) -DoManualBindingForFailedRecord=You have to do a manual link for the rows not linked %s automatically. +DoManualBindingForFailedRecord=You have to do a manual link for the %s row(s) not linked automatically. ErrorAccountancyCodeIsAlreadyUse=Error, you cannot remove or disable this account of chart of account because it is used MvtNotCorrectlyBalanced=Movement not correctly balanced. Debit = %s & Credit = %s From 919849ab088a9c09a198a09c82bc2f8f637075cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 10:48:26 +0100 Subject: [PATCH 057/218] Fix link --- htdocs/accountancy/customer/index.php | 2 +- htdocs/accountancy/expensereport/index.php | 2 +- htdocs/accountancy/supplier/index.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 1029934b8c6..69702d8b10e 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -420,7 +420,7 @@ if ($resql) { print price($row[$i]); // Add link to make binding if (!empty(price2num($row[$i]))) { - print ''; + print ''; print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"'); print ''; } diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index aefa03651cb..6bc3ff6a0e8 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -293,7 +293,7 @@ if ($resql) { print price($row[$i]); // Add link to make binding if (!empty(price2num($row[$i]))) { - print ''; + print ''; print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"'); print ''; } diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 1ffe913f9aa..e67a75103ac 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -417,7 +417,7 @@ if ($resql) { print price($row[$i]); // Add link to make binding if (!empty(price2num($row[$i]))) { - print ''; + print ''; print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"'); print ''; } From 92a815644189c57f4c98ad39ad737461b1cb9d00 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 11:03:41 +0100 Subject: [PATCH 058/218] Fix link --- htdocs/accountancy/expensereport/index.php | 2 +- htdocs/accountancy/supplier/index.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 6bc3ff6a0e8..d256d13252a 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -276,7 +276,7 @@ if ($resql) { $endmonth -= 12; } $endyear = ($endmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; - print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_date_startday=1&search_date_startmonth='.((int) $startmonth).'&search_date_startyear='.((int) $startyear).'&search_date_endday=&search_date_endmonth='.((int) $endmonth).'&search_date_endyear='.((int) $endyear), $langs->transnoentitiesnoconv("ToBind")); + print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_date_startday=1&search_date_startmonth='.((int) $startmonth).'&search_date_startyear='.((int) $startyear).'&search_date_endday=&search_date_endmonth='.((int) $endmonth).'&search_date_endyear='.((int) $endyear), $langs->transnoentitiesnoconv("ToBind")); } else { print $row[1]; } diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index e67a75103ac..3e0f4fbd784 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -400,7 +400,7 @@ if ($resql) { $endmonth -= 12; } $endyear = ($endmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; - print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_date_startday=1&search_date_startmonth='.((int) $startmonth).'&search_date_startyear='.((int) $startyear).'&search_date_endday=&search_date_endmonth='.((int) $endmonth).'&search_date_endyear='.((int) $endyear), $langs->transnoentitiesnoconv("ToBind")); + print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_date_startday=1&search_date_startmonth='.((int) $startmonth).'&search_date_startyear='.((int) $startyear).'&search_date_endday=&search_date_endmonth='.((int) $endmonth).'&search_date_endyear='.((int) $endyear), $langs->transnoentitiesnoconv("ToBind")); } else { print $row[1]; } From 86ad9118f3dcc036e22a35ca96aedeb14ed42762 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 10 Jan 2023 11:14:14 +0100 Subject: [PATCH 059/218] kanban mode for list of proposal commande --- htdocs/comm/propal/class/propal.class.php | 35 + htdocs/comm/propal/list.php | 1128 +++++++++++---------- 2 files changed, 611 insertions(+), 552 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index a5fd221de87..a363ff03bad 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3890,6 +3890,41 @@ class Propal extends CommonObject return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + //$return .= ''; // Can be image + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if (property_exists($this, 'fk_project')) { + $return .= ' | '.$this->fk_project.''; + } + if (property_exists($this, 'author')) { + $return .= '
'.$this->author.''; + } + if (property_exists($this, 'total_ht')) { + $return .='
'.$langs->trans("AmountHT").' : '.price($this->total_ht).''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } /** diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 2426abad9f4..3de7b0bf781 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -70,6 +70,7 @@ $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'proposallist'; +$mode = GETPOST('mode', 'alpha'); $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); @@ -864,6 +865,9 @@ if ($resql) { } $param = '&search_status='.urlencode($search_status); + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -1072,6 +1076,9 @@ if ($resql) { if (!empty($socid)) { $url .= '&socid='.$socid; } + $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); $newcardbutton = dolGetButtonTitle($langs->trans('NewPropal'), '', 'fa fa-plus-circle', $url, '', $user->rights->propal->creer); // Fields title search @@ -1085,6 +1092,7 @@ if ($resql) { print ''; print ''; print ''; + print ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'propal', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -1702,574 +1710,590 @@ if ($resql) { $total_margin += $marginInfo['total_margin']; } - print ''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban + $userstatic->fetch($obj->fk_user_author); + $objectstatic->author = $userstatic->getNomUrl(1); + $objectstatic->fk_project = $projectstatic->getNomUrl(1); + print $objectstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + print ''; - // Action column - if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; } - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['p.ref']['checked'])) { - print ''; - - print ''; - // Picto + Ref - print ''; - // Warning - $warnornote = ''; - if ($obj->status == Propal::STATUS_VALIDATED && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) { - $warnornote .= img_warning($langs->trans("Late")); - } - if ($warnornote) { - print ''; - } - // Other picto tool - print '
'; - print $objectstatic->getNomUrl(1, '', '', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1)); - print ''; - print $warnornote; print ''; - $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->propal->multidir_output[$obj->propal_entity].'/'.dol_sanitizeFileName($obj->ref); - $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; - print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); - print '
'; - - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['p.ref_client']['checked'])) { - // Customer ref - print ''; - print dol_escape_htmltag($obj->ref_client); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['pr.ref']['checked'])) { - // Project ref - print ''; - if ($obj->project_id > 0) { - print $projectstatic->getNomUrl(1); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['pr.title']['checked'])) { - // Project label - print ''; - if ($obj->project_id > 0) { - print dol_escape_htmltag($projectstatic->title); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Thirdparty - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; - print $companystatic->getNomUrl(1, 'customer', 0, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Alias - if (!empty($arrayfields['s.name_alias']['checked'])) { - print ''; - print $obj->alias; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Town - if (!empty($arrayfields['s.town']['checked'])) { - print ''; - print $obj->town; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Zip - if (!empty($arrayfields['s.zip']['checked'])) { - print ''; - print $obj->zip; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // State - if (!empty($arrayfields['state.nom']['checked'])) { - print "".$obj->state_name."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Country - if (!empty($arrayfields['country.code_iso']['checked'])) { - print ''; - $tmparray = getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Type ent - if (!empty($arrayfields['typent.code']['checked'])) { - if (!is_array($typenArray) || empty($typenArray)) { - $typenArray = $formcompany->typent_array(1); - } - - print ''; - print $typenArray[$obj->typent_code]; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date proposal - if (!empty($arrayfields['p.date']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->dp), 'day'); - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date end validity - if (!empty($arrayfields['p.fin_validite']['checked'])) { - if ($obj->dfv) { - print ''.dol_print_date($db->jdate($obj->dfv), 'day'); - print ''; - } else { - print ' '; - } - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date delivery - if (!empty($arrayfields['p.date_livraison']['checked'])) { - if ($obj->ddelivery) { - print ''.dol_print_date($db->jdate($obj->ddelivery), 'day'); - print ''; - } else { - print ' '; - } - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date Signature - if (!empty($arrayfields['p.date_signature']['checked'])) { - if ($obj->dsignature) { - print ''.dol_print_date($db->jdate($obj->dsignature), 'day'); - print ''; - } else { - print ' '; - } - if (!$i) { - $totalarray['nbfield']++; - } - } - // Availability - if (!empty($arrayfields['ava.rowid']['checked'])) { - print ''; - $form->form_availability('', $obj->availability, 'none', 1); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Shipping Method - if (!empty($arrayfields['p.fk_shipping_method']['checked'])) { - print ''; - $form->formSelectShippingMethod('', $obj->fk_shipping_method, 'none', 1); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Source - input reason - if (!empty($arrayfields['p.fk_input_reason']['checked'])) { - print ''; - if ($obj->fk_input_reason > 0) { - print $form->cache_demand_reason[$obj->fk_input_reason]['label']; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Payment terms - if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) { - print ''; - $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 0, '', 1, $obj->deposit_percent); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Payment mode - if (!empty($arrayfields['p.fk_mode_reglement']['checked'])) { - print ''; - $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount HT - if (!empty($arrayfields['p.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht'; - } - if (empty($totalarray['val']['p.total_ht'])) { - $totalarray['val']['p.total_ht'] = $obj->total_ht; - } else { - $totalarray['val']['p.total_ht'] += $obj->total_ht; - } - } - // Amount VAT - if (!empty($arrayfields['p.total_tva']['checked'])) { - print ''.price($obj->total_tva)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'p.total_tva'; - } - if (empty($totalarray['val']['p.total_tva'])) { - $totalarray['val']['p.total_tva'] = $obj->total_tva; - } else { - $totalarray['val']['p.total_tva'] += $obj->total_tva; - } - } - // Amount TTC - if (!empty($arrayfields['p.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ttc'; - } - if (empty($totalarray['val']['p.total_ttc'])) { - $totalarray['val']['p.total_ttc'] = $obj->total_ttc; - } else { - $totalarray['val']['p.total_ttc'] += $obj->total_ttc; - } - } - // Amount invoiced HT - if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) { - print ''.price($totalInvoicedHT)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht_invoiced'; - } - if (empty($totalarray['val']['p.total_ht_invoiced'])) { - $totalarray['val']['p.total_ht_invoiced'] = $totalInvoicedHT; - } else { - $totalarray['val']['p.total_ht_invoiced'] += $totalInvoicedHT; - } - } - // Amount invoiced TTC - if (!empty($arrayfields['p.total_invoiced']['checked'])) { - print ''.price($totalInvoicedTTC)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'p.total_invoiced'; - } - if (empty($totalarray['val']['p.total_invoiced'])) { - $totalarray['val']['p.total_invoiced'] = $totalInvoicedTTC; - } else { - $totalarray['val']['p.total_invoiced'] += $totalInvoicedTTC; - } - } - // Currency - if (!empty($arrayfields['p.multicurrency_code']['checked'])) { - print ''.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Currency rate - if (!empty($arrayfields['p.multicurrency_tx']['checked'])) { - print ''; - $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount HT - if (!empty($arrayfields['p.multicurrency_total_ht']['checked'])) { - print ''.price($obj->multicurrency_total_ht)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount VAT - if (!empty($arrayfields['p.multicurrency_total_tva']['checked'])) { - print ''.price($obj->multicurrency_total_tva)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount TTC - if (!empty($arrayfields['p.multicurrency_total_ttc']['checked'])) { - print ''.price($obj->multicurrency_total_ttc)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount invoiced - if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked'])) { - print ''.price($multicurrency_totalInvoicedHT)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount invoiced - if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked'])) { - print ''.price($multicurrency_totalInvoicedTTC)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - $userstatic->id = $obj->fk_user_author; - $userstatic->login = $obj->login; - $userstatic->lastname = $obj->lastname; - $userstatic->firstname = $obj->firstname; - $userstatic->email = $obj->user_email; - $userstatic->statut = $obj->user_statut; - $userstatic->entity = $obj->user_entity; - $userstatic->photo = $obj->photo; - $userstatic->office_phone = $obj->office_phone; - $userstatic->office_fax = $obj->office_fax; - $userstatic->user_mobile = $obj->user_mobile; - $userstatic->job = $obj->job; - $userstatic->gender = $obj->gender; - - // Author - if (!empty($arrayfields['u.login']['checked'])) { - print ''; - if ($userstatic->id) { - print $userstatic->getNomUrl(-1); - } - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['sale_representative']['checked'])) { - // Sales representatives - print ''; - if ($obj->socid > 0) { - $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user); - if ($listsalesrepresentatives < 0) { - dol_print_error($db); + if (!$i) { + $totalarray['nbfield']++; } - $nbofsalesrepresentative = count($listsalesrepresentatives); - if ($nbofsalesrepresentative > 6) { - // We print only number - print $nbofsalesrepresentative; - } elseif ($nbofsalesrepresentative > 0) { - $userstatic = new User($db); - $j = 0; - foreach ($listsalesrepresentatives as $val) { - $userstatic->id = $val['id']; - $userstatic->lastname = $val['lastname']; - $userstatic->firstname = $val['firstname']; - $userstatic->email = $val['email']; - $userstatic->statut = $val['statut']; - $userstatic->entity = $val['entity']; - $userstatic->photo = $val['photo']; - $userstatic->login = $val['login']; - $userstatic->office_phone = $val['office_phone']; - $userstatic->office_fax = $val['office_fax']; - $userstatic->user_mobile = $val['user_mobile']; - $userstatic->job = $val['job']; - $userstatic->gender = $val['gender']; - //print '
': - print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); - $j++; - if ($j < $nbofsalesrepresentative) { - print ' '; + } + + if (!empty($arrayfields['p.ref']['checked'])) { + print ''; + + print ''; + // Picto + Ref + print ''; + // Warning + $warnornote = ''; + if ($obj->status == Propal::STATUS_VALIDATED && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) { + $warnornote .= img_warning($langs->trans("Late")); + } + if ($warnornote) { + print ''; + } + // Other picto tool + print '
'; + print $objectstatic->getNomUrl(1, '', '', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1)); + print ''; + print $warnornote; + print ''; + $filename = dol_sanitizeFileName($obj->ref); + $filedir = $conf->propal->multidir_output[$obj->propal_entity].'/'.dol_sanitizeFileName($obj->ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; + print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + print '
'; + + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + if (!empty($arrayfields['p.ref_client']['checked'])) { + // Customer ref + print ''; + print dol_escape_htmltag($obj->ref_client); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + if (!empty($arrayfields['pr.ref']['checked'])) { + // Project ref + print ''; + if ($obj->project_id > 0) { + print $projectstatic->getNomUrl(1); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + if (!empty($arrayfields['pr.title']['checked'])) { + // Project label + print ''; + if ($obj->project_id > 0) { + print dol_escape_htmltag($projectstatic->title); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Thirdparty + if (!empty($arrayfields['s.nom']['checked'])) { + print ''; + print $companystatic->getNomUrl(1, 'customer', 0, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Alias + if (!empty($arrayfields['s.name_alias']['checked'])) { + print ''; + print $obj->alias; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Town + if (!empty($arrayfields['s.town']['checked'])) { + print ''; + print $obj->town; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Zip + if (!empty($arrayfields['s.zip']['checked'])) { + print ''; + print $obj->zip; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // State + if (!empty($arrayfields['state.nom']['checked'])) { + print "".$obj->state_name."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Country + if (!empty($arrayfields['country.code_iso']['checked'])) { + print ''; + $tmparray = getCountry($obj->fk_pays, 'all'); + print $tmparray['label']; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Type ent + if (!empty($arrayfields['typent.code']['checked'])) { + if (!is_array($typenArray) || empty($typenArray)) { + $typenArray = $formcompany->typent_array(1); + } + + print ''; + print $typenArray[$obj->typent_code]; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date proposal + if (!empty($arrayfields['p.date']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->dp), 'day'); + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date end validity + if (!empty($arrayfields['p.fin_validite']['checked'])) { + if ($obj->dfv) { + print ''.dol_print_date($db->jdate($obj->dfv), 'day'); + print ''; + } else { + print ' '; + } + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date delivery + if (!empty($arrayfields['p.date_livraison']['checked'])) { + if ($obj->ddelivery) { + print ''.dol_print_date($db->jdate($obj->ddelivery), 'day'); + print ''; + } else { + print ' '; + } + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date Signature + if (!empty($arrayfields['p.date_signature']['checked'])) { + if ($obj->dsignature) { + print ''.dol_print_date($db->jdate($obj->dsignature), 'day'); + print ''; + } else { + print ' '; + } + if (!$i) { + $totalarray['nbfield']++; + } + } + // Availability + if (!empty($arrayfields['ava.rowid']['checked'])) { + print ''; + $form->form_availability('', $obj->availability, 'none', 1); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Shipping Method + if (!empty($arrayfields['p.fk_shipping_method']['checked'])) { + print ''; + $form->formSelectShippingMethod('', $obj->fk_shipping_method, 'none', 1); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Source - input reason + if (!empty($arrayfields['p.fk_input_reason']['checked'])) { + print ''; + if ($obj->fk_input_reason > 0) { + print $form->cache_demand_reason[$obj->fk_input_reason]['label']; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Payment terms + if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) { + print ''; + $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 0, '', 1, $obj->deposit_percent); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Payment mode + if (!empty($arrayfields['p.fk_mode_reglement']['checked'])) { + print ''; + $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount HT + if (!empty($arrayfields['p.total_ht']['checked'])) { + print ''.price($obj->total_ht)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht'; + } + if (empty($totalarray['val']['p.total_ht'])) { + $totalarray['val']['p.total_ht'] = $obj->total_ht; + } else { + $totalarray['val']['p.total_ht'] += $obj->total_ht; + } + } + // Amount VAT + if (!empty($arrayfields['p.total_tva']['checked'])) { + print ''.price($obj->total_tva)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'p.total_tva'; + } + if (empty($totalarray['val']['p.total_tva'])) { + $totalarray['val']['p.total_tva'] = $obj->total_tva; + } else { + $totalarray['val']['p.total_tva'] += $obj->total_tva; + } + } + // Amount TTC + if (!empty($arrayfields['p.total_ttc']['checked'])) { + print ''.price($obj->total_ttc)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ttc'; + } + if (empty($totalarray['val']['p.total_ttc'])) { + $totalarray['val']['p.total_ttc'] = $obj->total_ttc; + } else { + $totalarray['val']['p.total_ttc'] += $obj->total_ttc; + } + } + // Amount invoiced HT + if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) { + print ''.price($totalInvoicedHT)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht_invoiced'; + } + if (empty($totalarray['val']['p.total_ht_invoiced'])) { + $totalarray['val']['p.total_ht_invoiced'] = $totalInvoicedHT; + } else { + $totalarray['val']['p.total_ht_invoiced'] += $totalInvoicedHT; + } + } + // Amount invoiced TTC + if (!empty($arrayfields['p.total_invoiced']['checked'])) { + print ''.price($totalInvoicedTTC)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'p.total_invoiced'; + } + if (empty($totalarray['val']['p.total_invoiced'])) { + $totalarray['val']['p.total_invoiced'] = $totalInvoicedTTC; + } else { + $totalarray['val']['p.total_invoiced'] += $totalInvoicedTTC; + } + } + // Currency + if (!empty($arrayfields['p.multicurrency_code']['checked'])) { + print ''.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Currency rate + if (!empty($arrayfields['p.multicurrency_tx']['checked'])) { + print ''; + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount HT + if (!empty($arrayfields['p.multicurrency_total_ht']['checked'])) { + print ''.price($obj->multicurrency_total_ht)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount VAT + if (!empty($arrayfields['p.multicurrency_total_tva']['checked'])) { + print ''.price($obj->multicurrency_total_tva)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount TTC + if (!empty($arrayfields['p.multicurrency_total_ttc']['checked'])) { + print ''.price($obj->multicurrency_total_ttc)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount invoiced + if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked'])) { + print ''.price($multicurrency_totalInvoicedHT)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount invoiced + if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked'])) { + print ''.price($multicurrency_totalInvoicedTTC)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + $userstatic->id = $obj->fk_user_author; + $userstatic->login = $obj->login; + $userstatic->lastname = $obj->lastname; + $userstatic->firstname = $obj->firstname; + $userstatic->email = $obj->user_email; + $userstatic->statut = $obj->user_statut; + $userstatic->entity = $obj->user_entity; + $userstatic->photo = $obj->photo; + $userstatic->office_phone = $obj->office_phone; + $userstatic->office_fax = $obj->office_fax; + $userstatic->user_mobile = $obj->user_mobile; + $userstatic->job = $obj->job; + $userstatic->gender = $obj->gender; + + // Author + if (!empty($arrayfields['u.login']['checked'])) { + print ''; + if ($userstatic->id) { + print $userstatic->getNomUrl(-1); + } + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + if (!empty($arrayfields['sale_representative']['checked'])) { + // Sales representatives + print ''; + if ($obj->socid > 0) { + $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user); + if ($listsalesrepresentatives < 0) { + dol_print_error($db); + } + $nbofsalesrepresentative = count($listsalesrepresentatives); + if ($nbofsalesrepresentative > 6) { + // We print only number + print $nbofsalesrepresentative; + } elseif ($nbofsalesrepresentative > 0) { + $userstatic = new User($db); + $j = 0; + foreach ($listsalesrepresentatives as $val) { + $userstatic->id = $val['id']; + $userstatic->lastname = $val['lastname']; + $userstatic->firstname = $val['firstname']; + $userstatic->email = $val['email']; + $userstatic->statut = $val['statut']; + $userstatic->entity = $val['entity']; + $userstatic->photo = $val['photo']; + $userstatic->login = $val['login']; + $userstatic->office_phone = $val['office_phone']; + $userstatic->office_fax = $val['office_fax']; + $userstatic->user_mobile = $val['user_mobile']; + $userstatic->job = $val['job']; + $userstatic->gender = $val['gender']; + //print '
': + print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); + $j++; + if ($j < $nbofsalesrepresentative) { + print ' '; + } + //print '
'; } - //print '
'; + } + //else print $langs->trans("NoSalesRepresentativeAffected"); + } else { + print ' '; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Total buying or cost price + if (!empty($arrayfields['total_pa']['checked'])) { + print ''.price($marginInfo['pa_total']).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Total margin + if (!empty($arrayfields['total_margin']['checked'])) { + print ''.price($marginInfo['total_margin']).''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_margin'; + } + $totalarray['val']['total_margin'] = $total_margin; + } + // Total margin rate + if (!empty($arrayfields['total_margin_rate']['checked'])) { + print ''.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Total mark rate + if (!empty($arrayfields['total_mark_rate']['checked'])) { + print ''.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate'; + } + if ($i >= $imaxinloop - 1) { + if (!empty($total_ht)) { + $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT'); + } else { + $totalarray['val']['total_mark_rate'] = ''; } } - //else print $langs->trans("NoSalesRepresentativeAffected"); - } else { - print ' '; } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Total buying or cost price - if (!empty($arrayfields['total_pa']['checked'])) { - print ''.price($marginInfo['pa_total']).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Total margin - if (!empty($arrayfields['total_margin']['checked'])) { - print ''.price($marginInfo['total_margin']).''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'total_margin'; - } - $totalarray['val']['total_margin'] = $total_margin; - } - // Total margin rate - if (!empty($arrayfields['total_margin_rate']['checked'])) { - print ''.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Total mark rate - if (!empty($arrayfields['total_mark_rate']['checked'])) { - print ''.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate'; - } - if ($i >= $imaxinloop - 1) { - if (!empty($total_ht)) { - $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT'); - } else { - $totalarray['val']['total_mark_rate'] = ''; + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (!empty($arrayfields['p.datec']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; } } - } - - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Date creation - if (!empty($arrayfields['p.datec']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['p.tms']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date cloture - if (!empty($arrayfields['p.date_cloture']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_cloture), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Note public - if (!empty($arrayfields['p.note_public']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_public); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Note private - if (!empty($arrayfields['p.note_private']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_private); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - if (!empty($arrayfields['p.fk_statut']['checked'])) { - print ''.$objectstatic->getLibStatut(5).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Action column - if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; + // Date modification + if (!empty($arrayfields['p.tms']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; } - print ''; - if (!$i) { - $totalarray['nbfield']++; + // Date cloture + if (!empty($arrayfields['p.date_cloture']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_cloture), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } + // Note public + if (!empty($arrayfields['p.note_public']['checked'])) { + print ''; + print dol_string_nohtmltag($obj->note_public); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Note private + if (!empty($arrayfields['p.note_private']['checked'])) { + print ''; + print dol_string_nohtmltag($obj->note_private); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['p.fk_statut']['checked'])) { + print ''.$objectstatic->getLibStatut(5).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Action column + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + + print ''."\n"; } - - print ''."\n"; - $i++; } From ce556d56c02ebe7e2ea001cd3540e1965d222405 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 11:32:21 +0100 Subject: [PATCH 060/218] Fix rounding --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 391657135b8..475690e9dba 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7723,7 +7723,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__AMOUNT_TEXT__'] = is_object($object) ? dol_convertToWord($object->total_ttc, $outputlangs, '', true) : ''; $substitutionarray['__AMOUNT_TEXTCURRENCY__'] = is_object($object) ? dol_convertToWord($object->total_ttc, $outputlangs, $conf->currency, true) : ''; - $substitutionarray['__AMOUNT_REMAIN__'] = is_object($object) ? $object->total_ttc - $already_payed_all : ''; + $substitutionarray['__AMOUNT_REMAIN__'] = is_object($object) ? price2num($object->total_ttc - $already_payed_all) : ''; $substitutionarray['__AMOUNT_VAT__'] = is_object($object) ? (isset($object->total_vat) ? $object->total_vat : $object->total_tva) : ''; $substitutionarray['__AMOUNT_VAT_TEXT__'] = is_object($object) ? (isset($object->total_vat) ? dol_convertToWord($object->total_vat, $outputlangs, '', true) : dol_convertToWord($object->total_tva, $outputlangs, '', true)) : ''; From 2da8c1d9bc2fc9d0e7205d87688eb6957fc56c6f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 11:32:21 +0100 Subject: [PATCH 061/218] Fix rounding --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 391657135b8..f9adc7bcf40 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7723,7 +7723,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__AMOUNT_TEXT__'] = is_object($object) ? dol_convertToWord($object->total_ttc, $outputlangs, '', true) : ''; $substitutionarray['__AMOUNT_TEXTCURRENCY__'] = is_object($object) ? dol_convertToWord($object->total_ttc, $outputlangs, $conf->currency, true) : ''; - $substitutionarray['__AMOUNT_REMAIN__'] = is_object($object) ? $object->total_ttc - $already_payed_all : ''; + $substitutionarray['__AMOUNT_REMAIN__'] = is_object($object) ? price2num($object->total_ttc - $already_payed_all, 'MT') : ''; $substitutionarray['__AMOUNT_VAT__'] = is_object($object) ? (isset($object->total_vat) ? $object->total_vat : $object->total_tva) : ''; $substitutionarray['__AMOUNT_VAT_TEXT__'] = is_object($object) ? (isset($object->total_vat) ? dol_convertToWord($object->total_vat, $outputlangs, '', true) : dol_convertToWord($object->total_tva, $outputlangs, '', true)) : ''; From 9a249bcbb8b58f6576193604540ec2962543f895 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 10 Jan 2023 12:10:43 +0100 Subject: [PATCH 062/218] kanban mode for list of proposal supplier --- .../class/supplier_proposal.class.php | 36 ++ htdocs/supplier_proposal/list.php | 576 +++++++++--------- 2 files changed, 336 insertions(+), 276 deletions(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index f283295aeb5..53e78b06f84 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2723,6 +2723,42 @@ class SupplierProposal extends CommonObject return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); } + + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + //$return .= ''; // Can be image + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if (property_exists($this, 'socid')) { + $return .= ' | '.$this->socid.''; + } + if (property_exists($this, 'delivery_date')) { + $return .= '
'.$langs->trans("DateEnd").' : '.dol_print_date($this->delivery_date).''; + } + if (property_exists($this, 'total_ttc')) { + $return .='
'.$langs->trans("AmountHT").' : '.price($this->total_ttc).''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index add084e91ab..b4426ec84d8 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -57,6 +57,7 @@ $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'supplierproposallist'; +$mode = GETPOST('mode', 'alpha'); $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); @@ -510,6 +511,9 @@ if ($resql) { } $param = ''; + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -630,7 +634,10 @@ if ($resql) { if (!empty($socid)) { $url .= '&socid='.$socid; } - $newcardbutton = dolGetButtonTitle($langs->trans('NewAskPrice'), '', 'fa fa-plus-circle', $url, '', $user->rights->supplier_proposal->creer); + $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('NewAskPrice'), '', 'fa fa-plus-circle', $url, '', $user->rights->supplier_proposal->creer); // Fields title search print ''; @@ -642,6 +649,7 @@ if ($resql) { print ''; print ''; print ''; + print ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'supplier_proposal', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -973,288 +981,304 @@ if ($resql) { $companystatic->client = $obj->client; $companystatic->code_client = $obj->code_client; - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; - } - print ''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } - print ''; - } - if (!empty($arrayfields['sp.ref']['checked'])) { - print ''; - - print ''; - // Picto + Ref - print ''; - // Warning - $warnornote = ''; - //if ($obj->fk_statut == 1 && $db->jdate($obj->date_valid) < ($now - $conf->supplier_proposal->warning_delay)) $warnornote .= img_warning($langs->trans("Late")); - if ($warnornote) { - print ''; + } + } else { + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; } - // Other picto tool - print '
'; - print $objectstatic->getNomUrl(1, '', '', 0, -1, 1); - print ''; - print $warnornote; + // Output Kanban + $userstatic->fetch($obj->fk_user_author); + $objectstatic->socid = $companystatic->getNomUrl(1); + $objectstatic->user_author_id = $userstatic->getNomUrl(1); + $objectstatic->delivery_date = $obj->dp; + print $objectstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print ''; + print '
'; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } print ''; - $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->supplier_proposal->dir_output.'/'.dol_sanitizeFileName($obj->ref); - $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; - print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); - print '
'; + if (!empty($arrayfields['sp.ref']['checked'])) { + print ''; - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Thirdparty - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; - print $companystatic->getNomUrl(1, 'supplier', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Alias - if (!empty($arrayfields['s.name_alias']['checked'])) { - print ''; - print $companystatic->name_alias; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Town - if (!empty($arrayfields['s.town']['checked'])) { - print ''; - print $obj->town; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Zip - if (!empty($arrayfields['s.zip']['checked'])) { - print ''; - print $obj->zip; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // State - if (!empty($arrayfields['state.nom']['checked'])) { - print "".$obj->state_name."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Country - if (!empty($arrayfields['country.code_iso']['checked'])) { - print ''; - $tmparray = getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Type ent - if (!empty($arrayfields['typent.code']['checked'])) { - print ''; - if (empty($typenArray) || !is_array($typenArray) || count($typenArray) == 0) { - $typenArray = $formcompany->typent_array(1); - } - print $typenArray[$obj->typent_code]; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date proposal - if (!empty($arrayfields['sp.date_valid']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_valid), 'day'); - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date delivery - if (!empty($arrayfields['sp.date_livraison']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->dp), 'day'); - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Amount HT - if (!empty($arrayfields['sp.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_ht'; - } - $totalarray['val']['sp.total_ht'] += $obj->total_ht; - } - // Amount VAT - if (!empty($arrayfields['sp.total_tva']['checked'])) { - print ''.price($obj->total_tva)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_tva'; - } - $totalarray['val']['sp.total_tva'] += $obj->total_tva; - } - // Amount TTC - if (!empty($arrayfields['sp.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_ttc'; - } - $totalarray['val']['sp.total_ttc'] += $obj->total_ttc; - } - - // Currency - if (!empty($arrayfields['sp.multicurrency_code']['checked'])) { - print ''.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Currency rate - if (!empty($arrayfields['sp.multicurrency_tx']['checked'])) { - print ''; - $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount HT - if (!empty($arrayfields['sp.multicurrency_total_ht']['checked'])) { - print ''.price($obj->multicurrency_total_ht)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount VAT - if (!empty($arrayfields['sp.multicurrency_total_vat']['checked'])) { - print ''.price($obj->multicurrency_total_vat)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount TTC - if (!empty($arrayfields['sp.multicurrency_total_ttc']['checked'])) { - print ''.price($obj->multicurrency_total_ttc)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - $userstatic->id = $obj->fk_user_author; - $userstatic->login = $obj->login; - $userstatic->status = $obj->ustatus; - $userstatic->lastname = $obj->name; - $userstatic->firstname = $obj->firstname; - $userstatic->photo = $obj->photo; - $userstatic->admin = $obj->admin; - $userstatic->ref = $obj->fk_user_author; - $userstatic->employee = $obj->employee; - $userstatic->email = $obj->uemail; - - // Author - if (!empty($arrayfields['u.login']['checked'])) { - print ''; - if ($userstatic->id > 0) { - print $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1); - } else { - print ' '; - } - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Date creation - if (!empty($arrayfields['sp.datec']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['sp.tms']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - if (!empty($arrayfields['sp.fk_statut']['checked'])) { - print ''.$objectstatic->getLibStatut(5)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; + print ''; + // Picto + Ref + print ''; + // Warning + $warnornote = ''; + //if ($obj->fk_statut == 1 && $db->jdate($obj->date_valid) < ($now - $conf->supplier_proposal->warning_delay)) $warnornote .= img_warning($langs->trans("Late")); + if ($warnornote) { + print ''; + } + // Other picto tool + print '
'; + print $objectstatic->getNomUrl(1, '', '', 0, -1, 1); + print ''; + print $warnornote; + print ''; + $filename = dol_sanitizeFileName($obj->ref); + $filedir = $conf->supplier_proposal->dir_output.'/'.dol_sanitizeFileName($obj->ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; + print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + print '
'; + + print "\n"; + if (!$i) { + $totalarray['nbfield']++; } - print ''; } - print ''; + + // Thirdparty + if (!empty($arrayfields['s.nom']['checked'])) { + print ''; + print $companystatic->getNomUrl(1, 'supplier', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Alias + if (!empty($arrayfields['s.name_alias']['checked'])) { + print ''; + print $companystatic->name_alias; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Town + if (!empty($arrayfields['s.town']['checked'])) { + print ''; + print $obj->town; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Zip + if (!empty($arrayfields['s.zip']['checked'])) { + print ''; + print $obj->zip; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // State + if (!empty($arrayfields['state.nom']['checked'])) { + print "".$obj->state_name."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Country + if (!empty($arrayfields['country.code_iso']['checked'])) { + print ''; + $tmparray = getCountry($obj->fk_pays, 'all'); + print $tmparray['label']; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Type ent + if (!empty($arrayfields['typent.code']['checked'])) { + print ''; + if (empty($typenArray) || !is_array($typenArray) || count($typenArray) == 0) { + $typenArray = $formcompany->typent_array(1); + } + print $typenArray[$obj->typent_code]; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date proposal + if (!empty($arrayfields['sp.date_valid']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_valid), 'day'); + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date delivery + if (!empty($arrayfields['sp.date_livraison']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->dp), 'day'); + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Amount HT + if (!empty($arrayfields['sp.total_ht']['checked'])) { + print ''.price($obj->total_ht)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_ht'; + } + $totalarray['val']['sp.total_ht'] += $obj->total_ht; + } + // Amount VAT + if (!empty($arrayfields['sp.total_tva']['checked'])) { + print ''.price($obj->total_tva)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_tva'; + } + $totalarray['val']['sp.total_tva'] += $obj->total_tva; + } + // Amount TTC + if (!empty($arrayfields['sp.total_ttc']['checked'])) { + print ''.price($obj->total_ttc)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_ttc'; + } + $totalarray['val']['sp.total_ttc'] += $obj->total_ttc; + } + + // Currency + if (!empty($arrayfields['sp.multicurrency_code']['checked'])) { + print ''.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Currency rate + if (!empty($arrayfields['sp.multicurrency_tx']['checked'])) { + print ''; + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount HT + if (!empty($arrayfields['sp.multicurrency_total_ht']['checked'])) { + print ''.price($obj->multicurrency_total_ht)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount VAT + if (!empty($arrayfields['sp.multicurrency_total_vat']['checked'])) { + print ''.price($obj->multicurrency_total_vat)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount TTC + if (!empty($arrayfields['sp.multicurrency_total_ttc']['checked'])) { + print ''.price($obj->multicurrency_total_ttc)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + $userstatic->id = $obj->fk_user_author; + $userstatic->login = $obj->login; + $userstatic->status = $obj->ustatus; + $userstatic->lastname = $obj->name; + $userstatic->firstname = $obj->firstname; + $userstatic->photo = $obj->photo; + $userstatic->admin = $obj->admin; + $userstatic->ref = $obj->fk_user_author; + $userstatic->employee = $obj->employee; + $userstatic->email = $obj->uemail; + + // Author + if (!empty($arrayfields['u.login']['checked'])) { + print ''; + if ($userstatic->id > 0) { + print $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1); + } else { + print ' '; + } + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (!empty($arrayfields['sp.datec']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date modification + if (!empty($arrayfields['sp.tms']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['sp.fk_statut']['checked'])) { + print ''.$objectstatic->getLibStatut(5)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + + print "\n"; + + $total += $obj->total_ht; + $subtotal += $obj->total_ht; } - if (!$i) { - $totalarray['nbfield']++; - } - - print "\n"; - - $total += $obj->total_ht; - $subtotal += $obj->total_ht; - $i++; } From c52247e6ac0212b906a3184372e4a05dfd7c57f3 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 10 Jan 2023 12:43:55 +0100 Subject: [PATCH 063/218] kanban mode for list of client invoice --- htdocs/compta/facture/class/facture.class.php | 31 + htdocs/compta/facture/list.php | 1225 +++++++++-------- 2 files changed, 655 insertions(+), 601 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 87914eac38e..4905ec3d99a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5732,6 +5732,37 @@ class Facture extends CommonInvoice dol_print_error($this->db); } } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + //$return .= ''; // Can be image + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'socid')) { + $return .= '
'.$this->socid.''; + } + if (property_exists($this, 'fk_user_author')) { + $return .= '
'.$this->fk_user_author.''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } /** diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index afc31d7efe3..a23b736b562 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -75,6 +75,7 @@ $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $optioncss = GETPOST('optioncss', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'invoicelist'; +$mode = GETPOST('mode', 'alpha'); if ($contextpage == 'poslist') { $optioncss = 'print'; @@ -974,6 +975,9 @@ if ($resql) { } $param = '&socid='.urlencode($socid); + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -1185,6 +1189,9 @@ if ($resql) { if (!empty($socid)) { $url .= '&socid='.$socid; } + $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); $newcardbutton = dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', $user->hasRight("facture", "creer")); } @@ -1204,6 +1211,7 @@ if ($resql) { print ''; print ''; print ''; + print ''; print_barre_liste($langs->trans('BillsCustomers').' '.($socid > 0 ? ' '.$soc->name : ''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -1894,645 +1902,660 @@ if ($resql) { $total_margin += $marginInfo['total_margin']; } - print 'ref)); - print 'parent.place=\''.$place.'\''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } - print '});"'; - } - print '>'; - - - // Action column - if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; - if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->id, $arrayofselected)) { - $selected = 1; + // Output Kanban + $facturestatic->socid = $companystatic->getNomUrl(1, 'company', 15); + $userstatic->fetch($obj->fk_user_author); + $facturestatic->fk_user_author = $userstatic->getNomUrl(1); + print $facturestatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + print 'ref)); + print 'parent.place=\''.$place.'\''; } - print ''; + print '});"'; } - print ''; - } + print '>'; - // No - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { - print ''.(($offset * $limit) + $i).''; - } - // Ref - if (!empty($arrayfields['f.ref']['checked'])) { - print ''; - - print ''; - - print ''; - print ''; - print '
'; - if ($contextpage == 'poslist') { - print dol_escape_htmltag($obj->ref); - } else { - print $facturestatic->getNomUrl(1, '', 200, 0, '', 0, 1); - } - - $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($obj->ref); - $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->id; - print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); - print '
'; - - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Customer ref - if (!empty($arrayfields['f.ref_client']['checked'])) { - print ''; - print dol_escape_htmltag($obj->ref_client); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Type - if (!empty($arrayfields['f.type']['checked'])) { - print ''; - print $facturestatic->getLibType(2); - print ""; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date - if (!empty($arrayfields['f.datef']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->datef), 'day'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date - if (!empty($arrayfields['f.date_valid']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_valid), 'day'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date limit - if (!empty($arrayfields['f.date_lim_reglement']['checked'])) { - print ''.dol_print_date($datelimit, 'day'); - if ($facturestatic->hasDelay()) { - print img_warning($langs->trans('Alert').' - '.$langs->trans('Late')); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Project ref - if (!empty($arrayfields['p.ref']['checked'])) { - print ''; - if ($obj->project_id > 0) { - print $projectstatic->getNomUrl(1); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Project title - if (!empty($arrayfields['p.title']['checked'])) { - print ''; - if ($obj->project_id > 0) { - print dol_escape_htmltag($projectstatic->title); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Third party - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; - if ($contextpage == 'poslist') { - print dol_escape_htmltag($companystatic->name); - } else { - print $companystatic->getNomUrl(1, 'customer', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Alias - if (!empty($arrayfields['s.name_alias']['checked'])) { - print ''; - print dol_escape_htmltag($companystatic->name_alias); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Parent company - if (!empty($arrayfields['s2.nom']['checked'])) { - print ''; - if ($obj->fk_parent > 0) { - if (!isset($company_url_list[$obj->fk_parent])) { - $companyparent = new Societe($db); - $res = $companyparent->fetch($obj->fk_parent); - if ($res > 0) { - $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1); + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->id, $arrayofselected)) { + $selected = 1; } + print ''; } - if (isset($company_url_list[$obj->fk_parent])) { - print $company_url_list[$obj->fk_parent]; + print ''; + } + + // No + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { + print ''.(($offset * $limit) + $i).''; + } + + // Ref + if (!empty($arrayfields['f.ref']['checked'])) { + print ''; + + print ''; + + print ''; + print ''; + print '
'; + if ($contextpage == 'poslist') { + print dol_escape_htmltag($obj->ref); + } else { + print $facturestatic->getNomUrl(1, '', 200, 0, '', 0, 1); + } + + $filename = dol_sanitizeFileName($obj->ref); + $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($obj->ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->id; + print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); + print '
'; + + print "\n"; + if (!$i) { + $totalarray['nbfield']++; } } - print ""; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Town - if (!empty($arrayfields['s.town']['checked'])) { - print ''; - print dol_escape_htmltag($obj->town); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Zip - if (!empty($arrayfields['s.zip']['checked'])) { - print ''; - print dol_escape_htmltag($obj->zip); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // State - if (!empty($arrayfields['state.nom']['checked'])) { - print "".dol_escape_htmltag($obj->state_name)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Country - if (!empty($arrayfields['country.code_iso']['checked'])) { - print ''; - $tmparray = getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Type ent - if (!empty($arrayfields['typent.code']['checked'])) { - print ''; - if (!is_array($typenArray) || count($typenArray) == 0) { - $typenArray = $formcompany->typent_array(1); - } - print $typenArray[$obj->typent_code]; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Staff - if (!empty($arrayfields['staff.code']['checked'])) { - print ''; - if (!is_array($conf->cache['staff']) || count($conf->cache['staff']) == 0) { - $conf->cache['staff'] = $formcompany->effectif_array(1); - } - print $conf->cache['staff'][$obj->staff_code]; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Payment mode - if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) { - $s = $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1, 0, '', 1); - print ''; - print $s; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Payment terms - if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { - $s = $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 0, '', -1, -1, 1); - print ''; - print $s; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Module Source - if (!empty($arrayfields['f.module_source']['checked'])) { - print ''; - print dol_escape_htmltag($obj->module_source); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // POS Terminal - if (!empty($arrayfields['f.pos_source']['checked'])) { - print ''; - print dol_escape_htmltag($obj->pos_source); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Amount HT - if (!empty($arrayfields['f.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht'; - } - $totalarray['val']['f.total_ht'] += $obj->total_ht; - } - // Amount VAT - if (!empty($arrayfields['f.total_tva']['checked'])) { - print ''.price($obj->total_tva)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_tva'; - } - $totalarray['val']['f.total_tva'] += $obj->total_tva; - } - // Amount LocalTax1 - if (!empty($arrayfields['f.total_localtax1']['checked'])) { - print ''.price($obj->total_localtax1)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax1'; - } - $totalarray['val']['f.total_localtax1'] += $obj->total_localtax1; - } - // Amount LocalTax2 - if (!empty($arrayfields['f.total_localtax2']['checked'])) { - print ''.price($obj->total_localtax2)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax2'; - } - $totalarray['val']['f.total_localtax2'] += $obj->total_localtax2; - } - // Amount TTC - if (!empty($arrayfields['f.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc'; - } - $totalarray['val']['f.total_ttc'] += $obj->total_ttc; - } - - $userstatic->id = $obj->fk_user_author; - $userstatic->login = $obj->login; - $userstatic->lastname = $obj->lastname; - $userstatic->firstname = $obj->firstname; - $userstatic->email = $obj->user_email; - $userstatic->statut = $obj->user_statut; - $userstatic->entity = $obj->entity; - $userstatic->photo = $obj->photo; - $userstatic->office_phone = $obj->office_phone; - $userstatic->office_fax = $obj->office_fax; - $userstatic->user_mobile = $obj->user_mobile; - $userstatic->job = $obj->job; - $userstatic->gender = $obj->gender; - - // Author - if (!empty($arrayfields['u.login']['checked'])) { - print ''; - if ($userstatic->id) { - print $userstatic->getNomUrl(-1); - } else { - print ' '; - } - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['sale_representative']['checked'])) { - // Sales representatives - print ''; - if ($obj->socid > 0) { - $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user); - if ($listsalesrepresentatives < 0) { - dol_print_error($db); + // Customer ref + if (!empty($arrayfields['f.ref_client']['checked'])) { + print ''; + print dol_escape_htmltag($obj->ref_client); + print ''; + if (!$i) { + $totalarray['nbfield']++; } - $nbofsalesrepresentative = count($listsalesrepresentatives); - if ($nbofsalesrepresentative > 6) { - // We print only number - print $nbofsalesrepresentative; - } elseif ($nbofsalesrepresentative > 0) { - $j = 0; - foreach ($listsalesrepresentatives as $val) { - $userstatic->id = $val['id']; - $userstatic->lastname = $val['lastname']; - $userstatic->firstname = $val['firstname']; - $userstatic->email = $val['email']; - $userstatic->statut = $val['statut']; - $userstatic->entity = $val['entity']; - $userstatic->photo = $val['photo']; - $userstatic->login = $val['login']; - $userstatic->office_phone = $val['office_phone']; - $userstatic->office_fax = $val['office_fax']; - $userstatic->user_mobile = $val['user_mobile']; - $userstatic->job = $val['job']; - $userstatic->gender = $val['gender']; - //print '
': - print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); - $j++; - if ($j < $nbofsalesrepresentative) { - print ' '; + } + + // Type + if (!empty($arrayfields['f.type']['checked'])) { + print ''; + print $facturestatic->getLibType(2); + print ""; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date + if (!empty($arrayfields['f.datef']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->datef), 'day'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date + if (!empty($arrayfields['f.date_valid']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_valid), 'day'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date limit + if (!empty($arrayfields['f.date_lim_reglement']['checked'])) { + print ''.dol_print_date($datelimit, 'day'); + if ($facturestatic->hasDelay()) { + print img_warning($langs->trans('Alert').' - '.$langs->trans('Late')); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Project ref + if (!empty($arrayfields['p.ref']['checked'])) { + print ''; + if ($obj->project_id > 0) { + print $projectstatic->getNomUrl(1); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Project title + if (!empty($arrayfields['p.title']['checked'])) { + print ''; + if ($obj->project_id > 0) { + print dol_escape_htmltag($projectstatic->title); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Third party + if (!empty($arrayfields['s.nom']['checked'])) { + print ''; + if ($contextpage == 'poslist') { + print dol_escape_htmltag($companystatic->name); + } else { + print $companystatic->getNomUrl(1, 'customer', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Alias + if (!empty($arrayfields['s.name_alias']['checked'])) { + print ''; + print dol_escape_htmltag($companystatic->name_alias); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Parent company + if (!empty($arrayfields['s2.nom']['checked'])) { + print ''; + if ($obj->fk_parent > 0) { + if (!isset($company_url_list[$obj->fk_parent])) { + $companyparent = new Societe($db); + $res = $companyparent->fetch($obj->fk_parent); + if ($res > 0) { + $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1); } - //print '
'; + } + if (isset($company_url_list[$obj->fk_parent])) { + print $company_url_list[$obj->fk_parent]; } } - //else print $langs->trans("NoSalesRepresentativeAffected"); - } else { - print ' '; + print ""; + if (!$i) { + $totalarray['nbfield']++; + } } - print ''; - if (!$i) { - $totalarray['nbfield']++; + // Town + if (!empty($arrayfields['s.town']['checked'])) { + print ''; + print dol_escape_htmltag($obj->town); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Zip + if (!empty($arrayfields['s.zip']['checked'])) { + print ''; + print dol_escape_htmltag($obj->zip); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // State + if (!empty($arrayfields['state.nom']['checked'])) { + print "".dol_escape_htmltag($obj->state_name)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Country + if (!empty($arrayfields['country.code_iso']['checked'])) { + print ''; + $tmparray = getCountry($obj->fk_pays, 'all'); + print $tmparray['label']; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Type ent + if (!empty($arrayfields['typent.code']['checked'])) { + print ''; + if (!is_array($typenArray) || count($typenArray) == 0) { + $typenArray = $formcompany->typent_array(1); + } + print $typenArray[$obj->typent_code]; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Staff + if (!empty($arrayfields['staff.code']['checked'])) { + print ''; + if (!is_array($conf->cache['staff']) || count($conf->cache['staff']) == 0) { + $conf->cache['staff'] = $formcompany->effectif_array(1); + } + print $conf->cache['staff'][$obj->staff_code]; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - if (!empty($arrayfields['f.retained_warranty']['checked'])) { - print ''.(!empty($obj->retained_warranty) ? price($obj->retained_warranty).'%' : ' ').''; - } + // Payment mode + if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) { + $s = $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1, 0, '', 1); + print ''; + print $s; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } - if (!empty($arrayfields['dynamount_payed']['checked'])) { - print ''.(!empty($totalpay) ? price($totalpay, 0, $langs) : ' ').''; // TODO Use a denormalized field - if (!$i) { - $totalarray['nbfield']++; + // Payment terms + if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { + $s = $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 0, '', -1, -1, 1); + print ''; + print $s; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'totalam'; - } - $totalarray['val']['totalam'] += $totalpay; - } - // Pending amount - if (!empty($arrayfields['rtp']['checked'])) { - print ''; - print (!empty($remaintopay) ? price($remaintopay, 0, $langs) : ' '); - print ''; // TODO Use a denormalized field - if (!$i) { - $totalarray['nbfield']++; + // Module Source + if (!empty($arrayfields['f.module_source']['checked'])) { + print ''; + print dol_escape_htmltag($obj->module_source); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'rtp'; - } - $totalarray['val']['rtp'] += $remaintopay; - } + // POS Terminal + if (!empty($arrayfields['f.pos_source']['checked'])) { + print ''; + print dol_escape_htmltag($obj->pos_source); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } - // Currency - if (!empty($arrayfields['f.multicurrency_code']['checked'])) { - print ''; - if (empty($conf->global->MAIN_SHOW_ONLY_CODE_MULTICURRENCY)) { - print $langs->transnoentitiesnoconv('Currency'.$obj->multicurrency_code); - } else { - print dol_escape_htmltag($obj->multicurrency_code); + // Amount HT + if (!empty($arrayfields['f.total_ht']['checked'])) { + print ''.price($obj->total_ht)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht'; + } + $totalarray['val']['f.total_ht'] += $obj->total_ht; } - print "\n"; - if (!$i) { - $totalarray['nbfield']++; + // Amount VAT + if (!empty($arrayfields['f.total_tva']['checked'])) { + print ''.price($obj->total_tva)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_tva'; + } + $totalarray['val']['f.total_tva'] += $obj->total_tva; + } + // Amount LocalTax1 + if (!empty($arrayfields['f.total_localtax1']['checked'])) { + print ''.price($obj->total_localtax1)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax1'; + } + $totalarray['val']['f.total_localtax1'] += $obj->total_localtax1; + } + // Amount LocalTax2 + if (!empty($arrayfields['f.total_localtax2']['checked'])) { + print ''.price($obj->total_localtax2)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax2'; + } + $totalarray['val']['f.total_localtax2'] += $obj->total_localtax2; + } + // Amount TTC + if (!empty($arrayfields['f.total_ttc']['checked'])) { + print ''.price($obj->total_ttc)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc'; + } + $totalarray['val']['f.total_ttc'] += $obj->total_ttc; } - } - // Currency rate - if (!empty($arrayfields['f.multicurrency_tx']['checked'])) { - print ''; - $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount HT - if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) { - print ''.price($obj->multicurrency_total_ht)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount VAT - if (!empty($arrayfields['f.multicurrency_total_vat']['checked'])) { - print ''.price($obj->multicurrency_total_vat)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount TTC - if (!empty($arrayfields['f.multicurrency_total_ttc']['checked'])) { - print ''.price($obj->multicurrency_total_ttc)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['multicurrency_dynamount_payed']['checked'])) { - print ''.(!empty($multicurrency_totalpay) ?price($multicurrency_totalpay, 0, $langs) : ' ').''; // TODO Use a denormalized field - if (!$i) { - $totalarray['nbfield']++; - } - } + $userstatic->id = $obj->fk_user_author; + $userstatic->login = $obj->login; + $userstatic->lastname = $obj->lastname; + $userstatic->firstname = $obj->firstname; + $userstatic->email = $obj->user_email; + $userstatic->statut = $obj->user_statut; + $userstatic->entity = $obj->entity; + $userstatic->photo = $obj->photo; + $userstatic->office_phone = $obj->office_phone; + $userstatic->office_fax = $obj->office_fax; + $userstatic->user_mobile = $obj->user_mobile; + $userstatic->job = $obj->job; + $userstatic->gender = $obj->gender; - // Pending amount - if (!empty($arrayfields['multicurrency_rtp']['checked'])) { - print ''; - print (!empty($multicurrency_remaintopay) ? price($multicurrency_remaintopay, 0, $langs) : ' '); - print ''; // TODO Use a denormalized field - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Total buying or cost price - if (!empty($arrayfields['total_pa']['checked'])) { - print ''.price($marginInfo['pa_total']).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Total margin - if (!empty($arrayfields['total_margin']['checked'])) { - print ''.price($marginInfo['total_margin']).''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'total_margin'; - } - $totalarray['val']['total_margin'] += $marginInfo['total_margin']; - } - // Total margin rate - if (!empty($arrayfields['total_margin_rate']['checked'])) { - print ''.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Total mark rate - if (!empty($arrayfields['total_mark_rate']['checked'])) { - print ''.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate'; - } - if ($i >= $imaxinloop - 1) { - if (!empty($total_ht)) { - $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT'); + // Author + if (!empty($arrayfields['u.login']['checked'])) { + print ''; + if ($userstatic->id) { + print $userstatic->getNomUrl(-1); } else { - $totalarray['val']['total_mark_rate'] = ''; + print ' '; + } + print "\n"; + if (!$i) { + $totalarray['nbfield']++; } } - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Date creation - if (!empty($arrayfields['f.datec']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['f.tms']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date closing - if (!empty($arrayfields['f.date_closing']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_closing), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Note public - if (!empty($arrayfields['f.note_public']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_public); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Note private - if (!empty($arrayfields['f.note_private']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_private); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Template Invoice - if (!empty($arrayfields['f.fk_fac_rec_source']['checked'])) { - print ''; - if (!empty($obj->fk_fac_rec_source)) { - $facrec = new FactureRec($db); - $result = $facrec->fetch($obj->fk_fac_rec_source); - if ($result < 0) { - setEventMessages($facrec->error, $facrec->errors, 'errors'); + if (!empty($arrayfields['sale_representative']['checked'])) { + // Sales representatives + print ''; + if ($obj->socid > 0) { + $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user); + if ($listsalesrepresentatives < 0) { + dol_print_error($db); + } + $nbofsalesrepresentative = count($listsalesrepresentatives); + if ($nbofsalesrepresentative > 6) { + // We print only number + print $nbofsalesrepresentative; + } elseif ($nbofsalesrepresentative > 0) { + $j = 0; + foreach ($listsalesrepresentatives as $val) { + $userstatic->id = $val['id']; + $userstatic->lastname = $val['lastname']; + $userstatic->firstname = $val['firstname']; + $userstatic->email = $val['email']; + $userstatic->statut = $val['statut']; + $userstatic->entity = $val['entity']; + $userstatic->photo = $val['photo']; + $userstatic->login = $val['login']; + $userstatic->office_phone = $val['office_phone']; + $userstatic->office_fax = $val['office_fax']; + $userstatic->user_mobile = $val['user_mobile']; + $userstatic->job = $val['job']; + $userstatic->gender = $val['gender']; + //print '
': + print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); + $j++; + if ($j < $nbofsalesrepresentative) { + print ' '; + } + //print '
'; + } + } + //else print $langs->trans("NoSalesRepresentativeAffected"); } else { - print $facrec->getNomUrl(); + print ' '; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; } } - print ''; + + if (!empty($arrayfields['f.retained_warranty']['checked'])) { + print ''.(!empty($obj->retained_warranty) ? price($obj->retained_warranty).'%' : ' ').''; + } + + if (!empty($arrayfields['dynamount_payed']['checked'])) { + print ''.(!empty($totalpay) ? price($totalpay, 0, $langs) : ' ').''; // TODO Use a denormalized field + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'totalam'; + } + $totalarray['val']['totalam'] += $totalpay; + } + + // Pending amount + if (!empty($arrayfields['rtp']['checked'])) { + print ''; + print (!empty($remaintopay) ? price($remaintopay, 0, $langs) : ' '); + print ''; // TODO Use a denormalized field + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'rtp'; + } + $totalarray['val']['rtp'] += $remaintopay; + } + + + // Currency + if (!empty($arrayfields['f.multicurrency_code']['checked'])) { + print ''; + if (empty($conf->global->MAIN_SHOW_ONLY_CODE_MULTICURRENCY)) { + print $langs->transnoentitiesnoconv('Currency'.$obj->multicurrency_code); + } else { + print dol_escape_htmltag($obj->multicurrency_code); + } + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Currency rate + if (!empty($arrayfields['f.multicurrency_tx']['checked'])) { + print ''; + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount HT + if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) { + print ''.price($obj->multicurrency_total_ht)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount VAT + if (!empty($arrayfields['f.multicurrency_total_vat']['checked'])) { + print ''.price($obj->multicurrency_total_vat)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount TTC + if (!empty($arrayfields['f.multicurrency_total_ttc']['checked'])) { + print ''.price($obj->multicurrency_total_ttc)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['multicurrency_dynamount_payed']['checked'])) { + print ''.(!empty($multicurrency_totalpay) ?price($multicurrency_totalpay, 0, $langs) : ' ').''; // TODO Use a denormalized field + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Pending amount + if (!empty($arrayfields['multicurrency_rtp']['checked'])) { + print ''; + print (!empty($multicurrency_remaintopay) ? price($multicurrency_remaintopay, 0, $langs) : ' '); + print ''; // TODO Use a denormalized field + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Total buying or cost price + if (!empty($arrayfields['total_pa']['checked'])) { + print ''.price($marginInfo['pa_total']).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Total margin + if (!empty($arrayfields['total_margin']['checked'])) { + print ''.price($marginInfo['total_margin']).''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_margin'; + } + $totalarray['val']['total_margin'] += $marginInfo['total_margin']; + } + // Total margin rate + if (!empty($arrayfields['total_margin_rate']['checked'])) { + print ''.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Total mark rate + if (!empty($arrayfields['total_mark_rate']['checked'])) { + print ''.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate'; + } + if ($i >= $imaxinloop - 1) { + if (!empty($total_ht)) { + $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT'); + } else { + $totalarray['val']['total_mark_rate'] = ''; + } + } + } + + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (!empty($arrayfields['f.datec']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date modification + if (!empty($arrayfields['f.tms']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date closing + if (!empty($arrayfields['f.date_closing']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_closing), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Note public + if (!empty($arrayfields['f.note_public']['checked'])) { + print ''; + print dol_string_nohtmltag($obj->note_public); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Note private + if (!empty($arrayfields['f.note_private']['checked'])) { + print ''; + print dol_string_nohtmltag($obj->note_private); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Template Invoice + if (!empty($arrayfields['f.fk_fac_rec_source']['checked'])) { + print ''; + if (!empty($obj->fk_fac_rec_source)) { + $facrec = new FactureRec($db); + $result = $facrec->fetch($obj->fk_fac_rec_source); + if ($result < 0) { + setEventMessages($facrec->error, $facrec->errors, 'errors'); + } else { + print $facrec->getNomUrl(); + } + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['f.fk_statut']['checked'])) { + print ''; + print $facturestatic->getLibStatut(5, $paiement); + print ""; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Action column (Show the massaction button only when this page is not opend from the Extended POS) + + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; + } if (!$i) { $totalarray['nbfield']++; } + print "\n"; } - // Status - if (!empty($arrayfields['f.fk_statut']['checked'])) { - print ''; - print $facturestatic->getLibStatut(5, $paiement); - print ""; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Action column (Show the massaction button only when this page is not opend from the Extended POS) - - if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; - if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->id, $arrayofselected)) { - $selected = 1; - } - print ''; - } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - print "\n"; - $i++; } From 130e9d8df2a931ae4da54e339699922f08e9201a Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 10 Jan 2023 13:29:46 +0100 Subject: [PATCH 064/218] kanban for list of suppliers invoices --- .../fourn/class/fournisseur.facture.class.php | 37 + htdocs/fourn/facture/list.php | 810 +++++++++--------- 2 files changed, 452 insertions(+), 395 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index de012c86a58..93a8fc0d1ef 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3225,6 +3225,43 @@ class FactureFournisseur extends CommonInvoice return $isUsed; } + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'socid')) { + $return .= ' | '.$this->socid.''; + } + if (property_exists($this, 'date_echeance') && property_exists($this, 'date')) { + if (!empty($this->date_echeance)) { + $return .= '
'.dol_print_date($this->date_echeance).''; + } else { + $return .= '
'.dol_print_date($this->date).''; + } + } + if (property_exists($this, 'total_ht')) { + $return .= '
'.$langs->trans("AmountHT").' : '.price($this->total_ht).''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index be215e891eb..3c4dfb32b15 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -766,6 +766,9 @@ if ($socid) { } $param = '&socid='.$socid; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -918,7 +921,10 @@ $url = DOL_URL_ROOT.'/fourn/facture/card.php?action=create'; if (!empty($socid)) { $url .= '&socid='.urlencode($socid); } -$newcardbutton = dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)); +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)); $i = 0; print ''."\n"; @@ -1430,409 +1436,423 @@ if ($num > 0) { $remaintopay = -$facturestatic->getSumFromThisCreditNotesNotUsed(); } } - - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->facid, $arrayofselected)) { - $selected = 1; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban + $facturestatic->socid = $thirdparty->getNomUrl(1, 'supplier', 3); + $facturestatic->total_ht = $obj->total_ht; + $facturestatic->date = $obj->datef; + print $facturestatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->facid, $arrayofselected)) { + $selected = 1; + } + print ''; } - print ''; + print ''; } - print ''; - } - if (!empty($arrayfields['f.ref']['checked'])) { - print ''; + if (!empty($arrayfields['f.ref']['checked'])) { + print ''; - print ''; - // Picto + Ref - print '
'; - print $facturestatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1); + print ''; + // Picto + Ref + print '
'; + print $facturestatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1); - $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($obj->facid, 2, 0, 0, $facturestatic, 'invoice_supplier').dol_sanitizeFileName($obj->ref); - $subdir = get_exdir($obj->facid, 2, 0, 0, $facturestatic, 'invoice_supplier').dol_sanitizeFileName($obj->ref); - print $formfile->getDocumentsLink('facture_fournisseur', $subdir, $filedir); - print '
'; + $filename = dol_sanitizeFileName($obj->ref); + $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($obj->facid, 2, 0, 0, $facturestatic, 'invoice_supplier').dol_sanitizeFileName($obj->ref); + $subdir = get_exdir($obj->facid, 2, 0, 0, $facturestatic, 'invoice_supplier').dol_sanitizeFileName($obj->ref); + print $formfile->getDocumentsLink('facture_fournisseur', $subdir, $filedir); + print '
'; - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Supplier ref - if (!empty($arrayfields['f.ref_supplier']['checked'])) { - print ''; - print $obj->ref_supplier; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Type - if (!empty($arrayfields['f.type']['checked'])) { - print ''; - print $facturestatic->getLibType(); - print ""; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Label - if (!empty($arrayfields['f.label']['checked'])) { - print ''; - print $obj->label; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date - if (!empty($arrayfields['f.datef']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->datef), 'day'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date limit - if (!empty($arrayfields['f.date_lim_reglement']['checked'])) { - print ''.dol_print_date($datelimit, 'day'); - if ($facturestatic->hasDelay()) { - print img_warning($langs->trans('Alert').' - '.$langs->trans('Late')); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Project - if (!empty($arrayfields['p.ref']['checked'])) { - print ''; - if ($obj->project_id > 0) { - $projectstatic->id = $obj->project_id; - $projectstatic->ref = $obj->project_ref; - $projectstatic->title = $obj->project_label; - print $projectstatic->getNomUrl(1); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Third party - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; - print $thirdparty->getNomUrl(1, 'supplier', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Alias - if (!empty($arrayfields['s.name_alias']['checked'])) { - print ''; - print $thirdparty->name_alias; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Town - if (!empty($arrayfields['s.town']['checked'])) { - print ''; - print $obj->town; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Zip - if (!empty($arrayfields['s.zip']['checked'])) { - print ''; - print dol_escape_htmltag($obj->zip); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // State - if (!empty($arrayfields['state.nom']['checked'])) { - print "".$obj->state_name."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Country - if (!empty($arrayfields['country.code_iso']['checked'])) { - print ''; - $tmparray = getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Type ent - if (!empty($arrayfields['typent.code']['checked'])) { - print ''; - if (empty($typenArray)) { - $typenArray = $formcompany->typent_array(1); - } - print $typenArray[$obj->typent_code]; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Payment condition - if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { - $s = $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 1, '', -1, -1, 1); - print ''; - print dol_escape_htmltag($s); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Payment mode - if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) { - $s = $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1, 0, '', 1); - print ''; - print dol_escape_htmltag($s); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Amount HT - if (!empty($arrayfields['f.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht'; - } - $totalarray['val']['f.total_ht'] += $obj->total_ht; - } - // Amount VAT - if (!empty($arrayfields['f.total_vat']['checked'])) { - print ''.price($obj->total_vat)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_vat'; - } - $totalarray['val']['f.total_vat'] += $obj->total_vat; - } - // Amount LocalTax1 - if (!empty($arrayfields['f.total_localtax1']['checked'])) { - print ''.price($obj->total_localtax1)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax1'; - } - $totalarray['val']['f.total_localtax1'] += $obj->total_localtax1; - } - // Amount LocalTax2 - if (!empty($arrayfields['f.total_localtax2']['checked'])) { - print ''.price($obj->total_localtax2)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax2'; - } - $totalarray['val']['f.total_localtax2'] += $obj->total_localtax2; - } - // Amount TTC - if (!empty($arrayfields['f.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc'; - } - $totalarray['val']['f.total_ttc'] += $obj->total_ttc; - } - - $userstatic->id = $obj->fk_user_author; - $userstatic->login = $obj->login; - $userstatic->lastname = $obj->lastname; - $userstatic->firstname = $obj->firstname; - $userstatic->email = $obj->user_email; - $userstatic->statut = $obj->user_statut; - $userstatic->entity = $obj->entity; - $userstatic->photo = $obj->photo; - $userstatic->office_phone = $obj->office_phone; - $userstatic->office_fax = $obj->office_fax; - $userstatic->user_mobile = $obj->user_mobile; - $userstatic->job = $obj->job; - $userstatic->gender = $obj->gender; - - // Author - if (!empty($arrayfields['u.login']['checked'])) { - print ''; - if ($userstatic->id) { - print $userstatic->getLoginUrl(-1); - } else { - print ' '; - } - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['dynamount_payed']['checked'])) { - print ''.(!empty($totalpay) ?price($totalpay, 0, $langs) : '').''; // TODO Use a denormalized field - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'totalam'; - } - $totalarray['val']['totalam'] += $totalpay; - } - - if (!empty($arrayfields['rtp']['checked'])) { - print ''.(!empty($remaintopay) ?price($remaintopay, 0, $langs) : ' ').''; // TODO Use a denormalized field - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'rtp'; - } - $totalarray['val']['rtp'] += $remaintopay; - } - - // Currency - if (!empty($arrayfields['f.multicurrency_code']['checked'])) { - print ''.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Currency rate - if (!empty($arrayfields['f.multicurrency_tx']['checked'])) { - print ''; - $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount HT - if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) { - print ''.price($obj->multicurrency_total_ht)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount VAT - if (!empty($arrayfields['f.multicurrency_total_vat']['checked'])) { - print ''.price($obj->multicurrency_total_vat)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount TTC - if (!empty($arrayfields['f.multicurrency_total_ttc']['checked'])) { - print ''.price($obj->multicurrency_total_ttc)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['multicurrency_dynamount_payed']['checked'])) { - print ''.(!empty($multicurrency_totalpay) ?price($multicurrency_totalpay, 0, $langs) : '').''; // TODO Use a denormalized field - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Pending amount - if (!empty($arrayfields['multicurrency_rtp']['checked'])) { - print ''; - print (!empty($multicurrency_remaintopay) ? price($multicurrency_remaintopay, 0, $langs) : ''); - print ''; // TODO Use a denormalized field - if (!$i) { - $totalarray['nbfield']++; - } - } - - - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - // Date creation - if (!empty($arrayfields['f.datec']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['f.tms']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - if (!empty($arrayfields['f.fk_statut']['checked'])) { - print ''; - print $facturestatic->LibStatut($obj->paye, $obj->fk_statut, 5, $paiement, $obj->type); - print ""; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->facid, $arrayofselected)) { - $selected = 1; + print "\n"; + if (!$i) { + $totalarray['nbfield']++; } - print ''; } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - print "\n"; + // Supplier ref + if (!empty($arrayfields['f.ref_supplier']['checked'])) { + print ''; + print $obj->ref_supplier; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Type + if (!empty($arrayfields['f.type']['checked'])) { + print ''; + print $facturestatic->getLibType(); + print ""; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Label + if (!empty($arrayfields['f.label']['checked'])) { + print ''; + print $obj->label; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date + if (!empty($arrayfields['f.datef']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->datef), 'day'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date limit + if (!empty($arrayfields['f.date_lim_reglement']['checked'])) { + print ''.dol_print_date($datelimit, 'day'); + if ($facturestatic->hasDelay()) { + print img_warning($langs->trans('Alert').' - '.$langs->trans('Late')); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Project + if (!empty($arrayfields['p.ref']['checked'])) { + print ''; + if ($obj->project_id > 0) { + $projectstatic->id = $obj->project_id; + $projectstatic->ref = $obj->project_ref; + $projectstatic->title = $obj->project_label; + print $projectstatic->getNomUrl(1); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Third party + if (!empty($arrayfields['s.nom']['checked'])) { + print ''; + print $thirdparty->getNomUrl(1, 'supplier', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Alias + if (!empty($arrayfields['s.name_alias']['checked'])) { + print ''; + print $thirdparty->name_alias; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Town + if (!empty($arrayfields['s.town']['checked'])) { + print ''; + print $obj->town; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Zip + if (!empty($arrayfields['s.zip']['checked'])) { + print ''; + print dol_escape_htmltag($obj->zip); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // State + if (!empty($arrayfields['state.nom']['checked'])) { + print "".$obj->state_name."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Country + if (!empty($arrayfields['country.code_iso']['checked'])) { + print ''; + $tmparray = getCountry($obj->fk_pays, 'all'); + print $tmparray['label']; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Type ent + if (!empty($arrayfields['typent.code']['checked'])) { + print ''; + if (empty($typenArray)) { + $typenArray = $formcompany->typent_array(1); + } + print $typenArray[$obj->typent_code]; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Payment condition + if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { + $s = $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 1, '', -1, -1, 1); + print ''; + print dol_escape_htmltag($s); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Payment mode + if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) { + $s = $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1, 0, '', 1); + print ''; + print dol_escape_htmltag($s); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Amount HT + if (!empty($arrayfields['f.total_ht']['checked'])) { + print ''.price($obj->total_ht)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht'; + } + $totalarray['val']['f.total_ht'] += $obj->total_ht; + } + // Amount VAT + if (!empty($arrayfields['f.total_vat']['checked'])) { + print ''.price($obj->total_vat)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_vat'; + } + $totalarray['val']['f.total_vat'] += $obj->total_vat; + } + // Amount LocalTax1 + if (!empty($arrayfields['f.total_localtax1']['checked'])) { + print ''.price($obj->total_localtax1)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax1'; + } + $totalarray['val']['f.total_localtax1'] += $obj->total_localtax1; + } + // Amount LocalTax2 + if (!empty($arrayfields['f.total_localtax2']['checked'])) { + print ''.price($obj->total_localtax2)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax2'; + } + $totalarray['val']['f.total_localtax2'] += $obj->total_localtax2; + } + // Amount TTC + if (!empty($arrayfields['f.total_ttc']['checked'])) { + print ''.price($obj->total_ttc)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc'; + } + $totalarray['val']['f.total_ttc'] += $obj->total_ttc; + } + + $userstatic->id = $obj->fk_user_author; + $userstatic->login = $obj->login; + $userstatic->lastname = $obj->lastname; + $userstatic->firstname = $obj->firstname; + $userstatic->email = $obj->user_email; + $userstatic->statut = $obj->user_statut; + $userstatic->entity = $obj->entity; + $userstatic->photo = $obj->photo; + $userstatic->office_phone = $obj->office_phone; + $userstatic->office_fax = $obj->office_fax; + $userstatic->user_mobile = $obj->user_mobile; + $userstatic->job = $obj->job; + $userstatic->gender = $obj->gender; + + // Author + if (!empty($arrayfields['u.login']['checked'])) { + print ''; + if ($userstatic->id) { + print $userstatic->getLoginUrl(-1); + } else { + print ' '; + } + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + if (!empty($arrayfields['dynamount_payed']['checked'])) { + print ''.(!empty($totalpay) ?price($totalpay, 0, $langs) : '').''; // TODO Use a denormalized field + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'totalam'; + } + $totalarray['val']['totalam'] += $totalpay; + } + + if (!empty($arrayfields['rtp']['checked'])) { + print ''.(!empty($remaintopay) ?price($remaintopay, 0, $langs) : ' ').''; // TODO Use a denormalized field + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'rtp'; + } + $totalarray['val']['rtp'] += $remaintopay; + } + + // Currency + if (!empty($arrayfields['f.multicurrency_code']['checked'])) { + print ''.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Currency rate + if (!empty($arrayfields['f.multicurrency_tx']['checked'])) { + print ''; + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount HT + if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) { + print ''.price($obj->multicurrency_total_ht)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount VAT + if (!empty($arrayfields['f.multicurrency_total_vat']['checked'])) { + print ''.price($obj->multicurrency_total_vat)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount TTC + if (!empty($arrayfields['f.multicurrency_total_ttc']['checked'])) { + print ''.price($obj->multicurrency_total_ttc)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['multicurrency_dynamount_payed']['checked'])) { + print ''.(!empty($multicurrency_totalpay) ?price($multicurrency_totalpay, 0, $langs) : '').''; // TODO Use a denormalized field + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Pending amount + if (!empty($arrayfields['multicurrency_rtp']['checked'])) { + print ''; + print (!empty($multicurrency_remaintopay) ? price($multicurrency_remaintopay, 0, $langs) : ''); + print ''; // TODO Use a denormalized field + if (!$i) { + $totalarray['nbfield']++; + } + } + + + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + // Date creation + if (!empty($arrayfields['f.datec']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date modification + if (!empty($arrayfields['f.tms']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['f.fk_statut']['checked'])) { + print ''; + print $facturestatic->LibStatut($obj->paye, $obj->fk_statut, 5, $paiement, $obj->type); + print ""; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->facid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + + print "\n"; + } $i++; } From 7f96c642f1c610df3f7578bc60bc2da00e079ee8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 14:09:20 +0100 Subject: [PATCH 065/218] Doc --- .../mysql/tables/llx_societe_account.sql | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_societe_account.sql b/htdocs/install/mysql/tables/llx_societe_account.sql index b200d4f3854..56eb4eb1985 100644 --- a/htdocs/install/mysql/tables/llx_societe_account.sql +++ b/htdocs/install/mysql/tables/llx_societe_account.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2016 Laurent Destailleur +-- Copyright (C) 2016-2022 Laurent Destailleur -- -- 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 @@ -19,16 +19,17 @@ CREATE TABLE llx_societe_account( -- BEGIN MODULEBUILDER FIELDS rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, - entity integer DEFAULT 1, - login varchar(128) NOT NULL, + entity integer DEFAULT 1, + + login varchar(128) NOT NULL, -- a login string into website or external system pass_encoding varchar(24), - pass_crypted varchar(128), + pass_crypted varchar(128), -- the hashed password pass_temp varchar(128), -- temporary password when asked for forget password - fk_soc integer, - fk_website integer, -- id of local web site - site varchar(128), -- name of external web site - site_account varchar(128), -- a key to identify the account on external web site - key_account varchar(128), -- the id of third party in external web site (for site_account if site_account defined) + fk_soc integer, -- if entry is linked to a thirdparty + fk_website integer, -- id of local web site (if dk_website is filled, site is empty) + site varchar(128), -- name of external web site (if site is filled, fk_website is empty) + site_account varchar(128), -- a key to identify the account on external web site (for example: 'stripe', 'paypal', 'myextapp') + key_account varchar(128), -- the id of an account in external web site (for site_account if site_account defined. some sites needs both an account name and a login that is different) note_private text, date_last_login datetime, date_previous_login datetime, From 0601db1c7a3d5973c8c84dfa17c270d1256c49ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 14:19:12 +0100 Subject: [PATCH 066/218] Doc --- htdocs/societe/societecontact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index 1767973a001..f626139abcb 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -23,7 +23,7 @@ /** * \file htdocs/societe/societecontact.php * \ingroup societe - * \brief Onglet de gestion des contacts additionnel d'une société + * \brief Tab to manage differently contact. Used when unstable feature MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES is on. */ From 7dea3cca50681f5d96d9a942d96166c1a931487c Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 10 Jan 2023 14:40:06 +0100 Subject: [PATCH 067/218] kanban for list of Donnation --- htdocs/don/class/don.class.php | 35 ++++++++++++ htdocs/don/list.php | 97 +++++++++++++++++++++++----------- 2 files changed, 101 insertions(+), 31 deletions(-) diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 333f9673175..9c80cb85dad 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -1141,4 +1141,39 @@ class Don extends CommonObject return (float) $this->amount - $sum_amount; } } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs; + + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'date')) { + $return .= ' | '.$langs->trans("Date").' : '.dol_print_date($this->date).''; + } + if (property_exists($this, 'societe') && !empty($this->societe)) { + $return .= '
'.$langs->trans("Company").' : '.$this->societe.''; + } + if (property_exists($this, 'amount')) { + $return .= '
'.$langs->trans("Amount").' : '.price($this->amount).''; + } + if (method_exists($this, 'LibStatut')) { + $return .= '
'.$this->LibStatut($this->labelStatus, 5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/don/list.php b/htdocs/don/list.php index ac704571daa..469ebbef6a9 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -42,6 +42,7 @@ $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $type = GETPOST('type', 'aZ'); +$mode = GETPOST('mode', 'alpha'); if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 @@ -153,6 +154,9 @@ if ($resql) { $i = 0; $param = ''; + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -179,6 +183,8 @@ if ($resql) { } $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); if ($user->rights->don->creer) { $newcardbutton .= dolGetButtonTitle($langs->trans('NewDonation'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/don/card.php?action=create'); } @@ -193,6 +199,9 @@ if ($resql) { print ''; print ''; print ''; + print ''; + + print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'object_donation', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -267,44 +276,70 @@ if ($resql) { while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); + $donationstatic->setVarsFromFetchObj($objp); + $company = new Societe($db); + $result = $company->fetch($objp->socid); + + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban + $donationstatic->amount = $objp->amount; + $donationstatic->date = $objp->datedon; + $donationstatic->labelStatus = $objp->status; + $donationstatic->id = $objp->rowid; + $donationstatic->ref = $objp->rowid; - print ''; - $donationstatic->id = $objp->rowid; - $donationstatic->ref = $objp->rowid; - $donationstatic->lastname = $objp->lastname; - $donationstatic->firstname = $objp->firstname; - print "".$donationstatic->getNomUrl(1).""; - if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) { - $company = new Societe($db); - $result = $company->fetch($objp->socid); if (!empty($objp->socid) && $company->id > 0) { - print "".$company->getNomUrl(1).""; + $donationstatic->societe = $company->getNomUrl(1); + } else { + $donationstatic->societe = $objp->societe; + } + + print $donationstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + print ''; + $donationstatic->id = $objp->rowid; + $donationstatic->ref = $objp->rowid; + $donationstatic->lastname = $objp->lastname; + $donationstatic->firstname = $objp->firstname; + print "".$donationstatic->getNomUrl(1).""; + if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) { + if (!empty($objp->socid) && $company->id > 0) { + print "".$company->getNomUrl(1).""; + } else { + print "".$objp->societe.""; + } } else { print "".$objp->societe.""; } - } else { - print "".$objp->societe.""; - } - print "".$donationstatic->getFullName($langs).""; - print ''.dol_print_date($db->jdate($objp->datedon), 'day').''; - if (isModEnabled('project')) { - print ""; - if ($objp->pid) { - $projectstatic->id = $objp->pid; - $projectstatic->ref = $objp->ref; - $projectstatic->id = $objp->pid; - $projectstatic->public = $objp->public; - $projectstatic->title = $objp->title; - print $projectstatic->getNomUrl(1); - } else { - print ' '; + print "".$donationstatic->getFullName($langs).""; + print ''.dol_print_date($db->jdate($objp->datedon), 'day').''; + if (isModEnabled('project')) { + print ""; + if ($objp->pid) { + $projectstatic->id = $objp->pid; + $projectstatic->ref = $objp->ref; + $projectstatic->id = $objp->pid; + $projectstatic->public = $objp->public; + $projectstatic->title = $objp->title; + print $projectstatic->getNomUrl(1); + } else { + print ' '; + } + print "\n"; } - print "\n"; + print ''.price($objp->amount).''; + print ''.$donationstatic->LibStatut($objp->status, 5).''; + print ''; + print ""; } - print ''.price($objp->amount).''; - print ''.$donationstatic->LibStatut($objp->status, 5).''; - print ''; - print ""; $i++; } print ""; From 8e53013bd97062dbc334032402e563d36ccb6679 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 10 Jan 2023 15:36:14 +0100 Subject: [PATCH 068/218] kanban mode for list of TVA --- htdocs/compta/tva/class/tva.class.php | 35 +++++ htdocs/compta/tva/list.php | 209 ++++++++++++++------------ 2 files changed, 152 insertions(+), 92 deletions(-) diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index dffba34d59b..78fb178ff27 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -906,4 +906,39 @@ class Tva extends CommonObject return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + //$return .= ''; // Can be image + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'amount')) { + $return .= ' | '.$langs->trans("Amount").' : '.price($this->amount).''; + } + if (property_exists($this, 'type_payment')) { + $return .= '
'.$langs->trans("Payement").' : '.$this->type_payment.''; + } + if (property_exists($this, 'datev')) { + $return .= '
'.$langs->trans("DateEnd").' : '.dol_print_date($this->datev).''; + } + if (method_exists($this, 'LibStatut')) { + $return .= '
'.$this->LibStatut($this->paiementtype, 5, $this->alreadypaid).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 1c70cf93c22..e0d5e094c35 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -44,6 +44,7 @@ $massaction = GETPOST('massaction', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'salestaxeslist'; +$mode = GETPOST('mode', 'alpha'); $search_ref = GETPOST('search_ref', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); @@ -230,6 +231,9 @@ if (!$resql) { $num = $db->num_rows($resql); $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER['PHP_SELF']) { $param .= '&contextpage='.$contextpage; } @@ -317,7 +321,10 @@ $url = DOL_URL_ROOT.'/compta/tva/card.php?action=create'; if (!empty($socid)) { $url .= '&socid='.$socid; } -$newcardbutton = dolGetButtonTitle($langs->trans('NewVATPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->tax->charges->creer); +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('NewVATPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->tax->charges->creer); print_barre_liste($langs->trans("VATDeclarations"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1); $varpage = empty($contextpage) ? $_SERVER['PHP_SELF'] : $contextpage; @@ -461,116 +468,134 @@ while ($i < min($num, $limit)) { $tva_static->id = $obj->rowid; $tva_static->ref = $obj->rowid; $tva_static->label = $obj->label; + $tva_static->paiementtype = $obj->paye; + $tva_static->type_payment = $obj->payment_code; + $tva_static->datev = $obj->datev; + $tva_static->amount = $obj->amount; - print ''; - - // No - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { - print ''.(($offset * $limit) + $i).''; - if (!$i) { - $totalarray['nbfield']++; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } - } + // Output Kanban - // Ref - if (!empty($arrayfields['t.rowid']['checked'])) { - print ''; - print $tva_static->getNomUrl(1); - $filename = dol_sanitizeFileName($tva_static->ref); - $filedir = $conf->tax->dir_output.'/vat/'.dol_sanitizeFileName($tva_static->ref); - $urlsource = $_SERVER['PHP_SELF'].'?id='.$tva_static->id; - print $formfile->getDocumentsLink($tva_static->element, $filename, $filedir, '', 'valignmiddle paddingleft2imp'); - print ''; - if (!$i) { - $totalarray['nbfield']++; + print $tva_static->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; } - } + } else { + print ''; - // Label - if (!empty($arrayfields['t.label']['checked'])) { - print ''.dol_trunc($obj->label, 40).''; - if (!$i) { - $totalarray['nbfield']++; + // No + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { + print ''.(($offset * $limit) + $i).''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - // Date end period - if (!empty($arrayfields['t.datev']['checked'])) { - print ''.dol_print_date($db->jdate($obj->datev), 'day').''; - if (!$i) { - $totalarray['nbfield']++; + // Ref + if (!empty($arrayfields['t.rowid']['checked'])) { + print ''; + print $tva_static->getNomUrl(1); + $filename = dol_sanitizeFileName($tva_static->ref); + $filedir = $conf->tax->dir_output.'/vat/'.dol_sanitizeFileName($tva_static->ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$tva_static->id; + print $formfile->getDocumentsLink($tva_static->element, $filename, $filedir, '', 'valignmiddle paddingleft2imp'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - // Date payment - /*if (!empty($arrayfields['t.datep']['checked'])) { - print ''.dol_print_date($db->jdate($obj->datep), 'day').''; - if (!$i) $totalarray['nbfield']++; - }*/ - - // Type - if (!empty($arrayfields['t.fk_typepayment']['checked'])) { - print ''; - if (!empty($obj->payment_code)) print $langs->trans("PaymentTypeShort".$obj->payment_code); - print ''; - if (!$i) { - $totalarray['nbfield']++; + // Label + if (!empty($arrayfields['t.label']['checked'])) { + print ''.dol_trunc($obj->label, 40).''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - // Account - if (!empty($arrayfields['t.fk_account']['checked'])) { - print ''; - if ($obj->fk_account > 0) { - $bankstatic->id = $obj->fk_account; - $bankstatic->ref = $obj->bref; - $bankstatic->number = $obj->bnumber; - $bankstatic->iban = $obj->iban; - $bankstatic->bic = $obj->bic; - $bankstatic->currency_code = $langs->trans("Currency".$obj->currency_code); - $bankstatic->account_number = $obj->account_number; - $bankstatic->clos = $obj->clos; - - //$accountingjournal->fetch($obj->fk_accountancy_journal); - //$bankstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); - - $bankstatic->label = $obj->blabel; - print $bankstatic->getNomUrl(1); + // Date end period + if (!empty($arrayfields['t.datev']['checked'])) { + print ''.dol_print_date($db->jdate($obj->datev), 'day').''; + if (!$i) { + $totalarray['nbfield']++; + } } - print ''; - if (!$i) $totalarray['nbfield']++; - } - // Amount - if (!empty($arrayfields['t.amount']['checked'])) { - $total = $total + $obj->amount; - print '' . price($obj->amount) . ''; - if (!$i) { - $totalarray['nbfield']++; - } - $totalarray['pos'][$totalarray['nbfield']] = 'amount'; - if (empty($totalarray['val']['amount'])) { - $totalarray['val']['amount'] = $obj->amount; - } else { - $totalarray['val']['amount'] += $obj->amount; - } - } + // Date payment + /*if (!empty($arrayfields['t.datep']['checked'])) { + print ''.dol_print_date($db->jdate($obj->datep), 'day').''; + if (!$i) $totalarray['nbfield']++; + }*/ - if (!empty($arrayfields['t.status']['checked'])) { - print '' . $tva_static->LibStatut($obj->paye, 5, $obj->alreadypayed) . ''; - if (!$i) { - $totalarray['nbfield']++; + // Type + if (!empty($arrayfields['t.fk_typepayment']['checked'])) { + print ''; + if (!empty($obj->payment_code)) print $langs->trans("PaymentTypeShort".$obj->payment_code); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } + + // Account + if (!empty($arrayfields['t.fk_account']['checked'])) { + print ''; + if ($obj->fk_account > 0) { + $bankstatic->id = $obj->fk_account; + $bankstatic->ref = $obj->bref; + $bankstatic->number = $obj->bnumber; + $bankstatic->iban = $obj->iban; + $bankstatic->bic = $obj->bic; + $bankstatic->currency_code = $langs->trans("Currency".$obj->currency_code); + $bankstatic->account_number = $obj->account_number; + $bankstatic->clos = $obj->clos; + + //$accountingjournal->fetch($obj->fk_accountancy_journal); + //$bankstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); + + $bankstatic->label = $obj->blabel; + print $bankstatic->getNomUrl(1); + } + print ''; + if (!$i) $totalarray['nbfield']++; + } + + // Amount if (!empty($arrayfields['t.amount']['checked'])) { - $totalarray['pos'][$totalarray['nbfield']] = ''; + $total = $total + $obj->amount; + print '' . price($obj->amount) . ''; + if (!$i) { + $totalarray['nbfield']++; + } + $totalarray['pos'][$totalarray['nbfield']] = 'amount'; + if (empty($totalarray['val']['amount'])) { + $totalarray['val']['amount'] = $obj->amount; + } else { + $totalarray['val']['amount'] += $obj->amount; + } } + + if (!empty($arrayfields['t.status']['checked'])) { + print '' . $tva_static->LibStatut($obj->paye, 5, $obj->alreadypayed) . ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.amount']['checked'])) { + $totalarray['pos'][$totalarray['nbfield']] = ''; + } + } + + // Buttons + print ''; + + print ''; } - // Buttons - print ''; - - print ''; - $i++; } From 8238d1df97fa3ef054798f3e97baa3e6887b0697 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 10 Jan 2023 16:17:16 +0100 Subject: [PATCH 069/218] kanban mode for list charge social --- .../sociales/class/chargesociales.class.php | 34 ++ htdocs/compta/sociales/list.php | 306 ++++++++++-------- 2 files changed, 200 insertions(+), 140 deletions(-) diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 37b3540a0f5..b5e98b3b62e 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -749,4 +749,38 @@ class ChargeSociales extends CommonObject $this->type = 1; $this->type_label = 'Type of social contribution'; } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'fk_project') && !empty($this->fk_project)) { + $return .= ' | '.$this->fk_project.''; + } + if (property_exists($this, 'date_ech')) { + $return .= '
'.$langs->trans("DateEnd").':'.dol_print_date($this->date_ech).''; + } + if (property_exists($this, 'amount')) { + $return .= '
'.$langs->trans("Amount").' : '.price($this->amount).''; + } + if (method_exists($this, 'LibStatut')) { + $return .= '
'.$this->LibStatut($this->paye, 5, $this->alreadypaid).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index f70ed44de0c..18a67ff9e29 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -47,6 +47,8 @@ $massaction = GETPOST('massaction', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'sclist'; +$mode = GETPOST('mode', 'alpha'); + $search_ref = GETPOST('search_ref', 'int'); $search_label = GETPOST('search_label', 'alpha'); @@ -294,6 +296,9 @@ $num = $db->num_rows($resql); $i = 0; $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -367,6 +372,8 @@ if ($search_date_limit_endyear) { } $newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); if ($user->rights->tax->charges->creer) { $newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewSocialContribution'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/sociales/card.php?action=create'); } @@ -382,6 +389,8 @@ print ''; print ''; print ''; print ''; +print ''; + $center = ''; @@ -576,162 +585,179 @@ while ($i < min($num, $limit)) { $chargesociale_static->ref = $obj->rowid; $chargesociale_static->label = $obj->label; $chargesociale_static->type_label = $obj->type_label; + $chargesociale_static->amount = $obj->amount; + $chargesociale_static->paye = $obj->paye; + $chargesociale_static->date_ech = $obj->date_ech; + if (isModEnabled('project')) { $projectstatic->id = $obj->project_id; $projectstatic->ref = $obj->project_ref; $projectstatic->title = $obj->project_label; } - - print ''; - - // Line number - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { - print ''.(($offset * $limit) + $i).''; - if (!$i) { - $totalarray['nbfield']++; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } - } + // Output Kanban - // Ref - if (!empty($arrayfields['cs.rowid']['checked'])) { - print ''.$chargesociale_static->getNomUrl(1, '20').''; - if (!$i) { - $totalarray['nbfield']++; + $chargesociale_static->fk_project = $projectstatic->getNomUrl(); + print $chargesociale_static->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; } - } + } else { + print ''; - // Label - if (!empty($arrayfields['cs.libelle']['checked'])) { - print ''.dol_escape_htmltag($obj->label).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Type - if (!empty($arrayfields['cs.fk_type']['checked'])) { - $typelabeltoshow = $obj->type_label; - $typelabelpopup = $obj->type_label; - if (isModEnabled('accounting')) { - $typelabelpopup .= ' - '.$langs->trans("AccountancyCode").': '.$obj->type_accountancy_code; - } - print ''.dol_escape_htmltag($typelabeltoshow).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date - if (!empty($arrayfields['cs.date_ech']['checked'])) { - print ''.dol_print_date($db->jdate($obj->date_ech), 'day').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date end period - if (!empty($arrayfields['cs.periode']['checked'])) { - print ''.dol_print_date($db->jdate($obj->periode), 'day').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Project ref - if (!empty($arrayfields['p.ref']['checked'])) { - print ''; - if ($obj->project_id > 0) { - print $projectstatic->getNomUrl(1); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['cs.fk_user']['checked'])) { - // Employee - print ''; - if (!empty($obj->fk_user)) { - if (!empty($TLoadedUsers[$obj->fk_user])) { - $ustatic = $TLoadedUsers[$obj->fk_user]; - } else { - $ustatic = new User($db); - $ustatic->fetch($obj->fk_user); - $TLoadedUsers[$obj->fk_user] = $ustatic; + // Line number + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { + print ''.(($offset * $limit) + $i).''; + if (!$i) { + $totalarray['nbfield']++; } - print $ustatic->getNomUrl(-1); } - print "\n"; + + // Ref + if (!empty($arrayfields['cs.rowid']['checked'])) { + print ''.$chargesociale_static->getNomUrl(1, '20').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Label + if (!empty($arrayfields['cs.libelle']['checked'])) { + print ''.dol_escape_htmltag($obj->label).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Type + if (!empty($arrayfields['cs.fk_type']['checked'])) { + $typelabeltoshow = $obj->type_label; + $typelabelpopup = $obj->type_label; + if (isModEnabled('accounting')) { + $typelabelpopup .= ' - '.$langs->trans("AccountancyCode").': '.$obj->type_accountancy_code; + } + print ''.dol_escape_htmltag($typelabeltoshow).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date + if (!empty($arrayfields['cs.date_ech']['checked'])) { + print ''.dol_print_date($db->jdate($obj->date_ech), 'day').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date end period + if (!empty($arrayfields['cs.periode']['checked'])) { + print ''.dol_print_date($db->jdate($obj->periode), 'day').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Project ref + if (!empty($arrayfields['p.ref']['checked'])) { + print ''; + if ($obj->project_id > 0) { + print $projectstatic->getNomUrl(1); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + if (!empty($arrayfields['cs.fk_user']['checked'])) { + // Employee + print ''; + if (!empty($obj->fk_user)) { + if (!empty($TLoadedUsers[$obj->fk_user])) { + $ustatic = $TLoadedUsers[$obj->fk_user]; + } else { + $ustatic = new User($db); + $ustatic->fetch($obj->fk_user); + $TLoadedUsers[$obj->fk_user] = $ustatic; + } + print $ustatic->getNomUrl(-1); + } + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Type + if (!empty($arrayfields['cs.fk_mode_reglement']['checked'])) { + print 'payment_code)).'">'; + if (!empty($obj->payment_code)) { + print $langs->trans("PaymentTypeShort".$obj->payment_code); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Account + if (!empty($arrayfields['cs.fk_account']['checked'])) { + print ''; + if ($obj->fk_account > 0) { + $bankstatic->id = $obj->fk_account; + $bankstatic->ref = $obj->bref; + $bankstatic->number = $obj->bnumber; + $bankstatic->iban = $obj->iban; + $bankstatic->bic = $obj->bic; + $bankstatic->currency_code = $langs->trans("Currency".$obj->currency_code); + $bankstatic->account_number = $obj->account_number; + $bankstatic->clos = $obj->clos; + + //$accountingjournal->fetch($obj->fk_accountancy_journal); + //$bankstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); + + $bankstatic->label = $obj->blabel; + print $bankstatic->getNomUrl(1); + } + print ''; + if (!$i) $totalarray['nbfield']++; + } + + // Amount + if (!empty($arrayfields['cs.amount']['checked'])) { + print ''.price($obj->amount).''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; + } + $totalarray['val']['totalttcfield'] += $obj->amount; + } + + // Status + if (!empty($arrayfields['cs.paye']['checked'])) { + print ''.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Buttons + print ''; if (!$i) { $totalarray['nbfield']++; } + + print ''."\n"; } - - // Type - if (!empty($arrayfields['cs.fk_mode_reglement']['checked'])) { - print 'payment_code)).'">'; - if (!empty($obj->payment_code)) { - print $langs->trans("PaymentTypeShort".$obj->payment_code); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Account - if (!empty($arrayfields['cs.fk_account']['checked'])) { - print ''; - if ($obj->fk_account > 0) { - $bankstatic->id = $obj->fk_account; - $bankstatic->ref = $obj->bref; - $bankstatic->number = $obj->bnumber; - $bankstatic->iban = $obj->iban; - $bankstatic->bic = $obj->bic; - $bankstatic->currency_code = $langs->trans("Currency".$obj->currency_code); - $bankstatic->account_number = $obj->account_number; - $bankstatic->clos = $obj->clos; - - //$accountingjournal->fetch($obj->fk_accountancy_journal); - //$bankstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); - - $bankstatic->label = $obj->blabel; - print $bankstatic->getNomUrl(1); - } - print ''; - if (!$i) $totalarray['nbfield']++; - } - - // Amount - if (!empty($arrayfields['cs.amount']['checked'])) { - print ''.price($obj->amount).''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; - } - $totalarray['val']['totalttcfield'] += $obj->amount; - } - - // Status - if (!empty($arrayfields['cs.paye']['checked'])) { - print ''.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Buttons - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - - print ''."\n"; - $i++; } From d1e7e527ba63d2edea7b50689e5090dad2b8bfa4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 16:31:12 +0100 Subject: [PATCH 070/218] Debug virtual card --- htdocs/core/class/vcard.class.php | 226 ++++++++++++++++++++---------- htdocs/public/users/view.php | 106 +++++++++----- htdocs/user/virtualcard.php | 8 ++ 3 files changed, 230 insertions(+), 110 deletions(-) diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index 8a62c0aea5e..0e9372360e6 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -117,22 +117,25 @@ class vCard if ($type != "") { $key .= ";".$type; } - $key .= ";".$this->encoding; - $this->properties[$key] = 'VALUE=uri:tel:'.encode($number); + $key .= ";VALUE=uri"; + //$key .= ";".$this->encoding; + $this->properties[$key] = 'tel:'.$number; } /** * mise en forme de la photo * warning NON TESTE ! * - * @param string $type Type 'image/gif' + * @param string $type Type 'image/jpeg' or 'JPEG' * @param string $photo Photo * @return void */ public function setPhoto($type, $photo) { // $type = "GIF" | "JPEG" - $this->properties["PHOTO;MEDIATYPE=$type;ENCODING=BASE64"] = base64_encode($photo); + //$this->properties["PHOTO;MEDIATYPE=$type;ENCODING=BASE64"] = base64_encode($photo); + $this->properties["PHOTO;MEDIATYPE=$type"] = $photo; // must be url of photo + //$this->properties["PHOTO;TYPE=$type;ENCODING=BASE64"] = base64_encode($photo); // must be content of image } /** @@ -152,13 +155,14 @@ class vCard * @param string $family Family name * @param string $first First name * @param string $additional Additional (e.g. second name, nick name) - * @param string $prefix Prefix (e.g. "Mr.", "Ms.", "Prof.") + * @param string $prefix Title prefix (e.g. "Mr.", "Ms.", "Prof.") * @param string $suffix Suffix (e.g. "sen." for senior, "jun." for junior) * @return void */ public function setName($family = "", $first = "", $additional = "", $prefix = "", $suffix = "") { - $this->properties["N;".$this->encoding] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix); + //$this->properties["N;".$this->encoding] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix); + $this->properties["N"] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix); $this->filename = "$first%20$family.vcf"; if (empty($this->properties["FN"])) { $this->setFormattedName(trim("$prefix $first $additional $family $suffix")); @@ -173,8 +177,9 @@ class vCard */ public function setBirthday($date) { - // $date format is YYYY-MM-DD - RFC 2425 and RFC 2426 - $this->properties["BDAY"] = dol_print_date($date, 'dayrfc'); + // $date format is YYYY-MM-DD - RFC 2425 and RFC 2426 for vcard v3 + // $date format is YYYYMMDD or ISO8601 for vcard v4 + $this->properties["BDAY"] = dol_print_date($date, 'dayxcard'); } /** @@ -309,7 +314,7 @@ class vCard */ public function setProdId($prodid) { - $this->properties["PRODID;".$this->encoding] = encode($prodid); + $this->properties["PRODID"] = encode($prodid); } @@ -321,7 +326,7 @@ class vCard */ public function setUID($uid) { - $this->properties["UID;".$this->encoding] = encode($uid); + $this->properties["UID"] = encode($uid); } @@ -355,7 +360,7 @@ class vCard foreach ($this->properties as $key => $value) { $text .= $key.":".$value."\r\n"; } - $text .= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n"; + $text .= "REV:".date("Ymd")."T".date("His")."Z\r\n"; //$text .= "MAILER: Dolibarr\r\n"; $text .= "END:VCARD\r\n"; return $text; @@ -374,12 +379,13 @@ class vCard /** * Return a VCARD string * - * @param Object $object Object (User, Contact) - * @param Societe $company Company - * @param Translate $langs Lang object - * @return string String + * @param Object $object Object (User or Contact) + * @param Societe|null $company Company. May be null + * @param Translate $langs Lang object + * @param string $urlphoto Full public URL of photo + * @return string String */ - public function buildVCardString($object, $company, $langs) + public function buildVCardString($object, $company, $langs, $urlphoto = '') { global $dolibarr_main_instance_unique_id; @@ -389,70 +395,136 @@ class vCard $this->setName($object->lastname, $object->firstname, "", $object->civility_code, ""); $this->setFormattedName($object->getFullName($langs, 1)); - $this->setPhoneNumber($object->office_phone, "TYPE=WORK,VOICE"); - $this->setPhoneNumber($object->personal_mobile, "TYPE=HOME,VOICE"); - $this->setPhoneNumber($object->user_mobile, "TYPE=CELL,VOICE"); - $this->setPhoneNumber($object->office_fax, "TYPE=WORK,FAX"); - - $country = $object->country_code ? $object->country : ''; - - $this->setAddress("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK"); - //$this->setLabel("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK"); - - $this->setEmail($object->email, "TYPE=WORK"); - $this->setNote($object->note_public); - $this->setTitle($object->job); - - // For user, type=home - // For contact, this is not defined - $this->setURL($object->url, "TYPE=HOME"); - - if (is_object($company)) { - $this->setURL($company->url, "TYPE=WORK"); - - if (!$object->office_phone) { - $this->setPhoneNumber($company->phone, "TYPE=WORK,VOICE"); - } - if (!$object->office_fax) { - $this->setPhoneNumber($company->fax, "TYPE=WORK,FAX"); - } - if (!$object->zip) { - $this->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK"); - } - - // when company e-mail is empty, use only user e-mail - if (empty(trim($company->email))) { - // was set before, don't set twice - } elseif (empty(trim($object->email))) { - // when user e-mail is empty, use only company e-mail - $this->setEmail($company->email, "TYPE=WORK"); - } else { - $tmpuser2 = explode("@", trim($object->email)); - $tmpcompany = explode("@", trim($company->email)); - - if (strtolower(end($tmpuser2)) == strtolower(end($tmpcompany))) { - // when e-mail domain of user and company are the same, use user e-mail at first (and company e-mail at second) - $this->setEmail($object->email, "TYPE=WORK"); - - // support by Microsoft Outlook (2019 and possible earlier) - $this->setEmail($company->email, ''); - } else { - // when e-mail of user and company complete different use company e-mail at first (and user e-mail at second) - $this->setEmail($company->email, "TYPE=WORK"); - - // support by Microsoft Outlook (2019 and possible earlier) - $this->setEmail($object->email, ''); - } - } - - // Si user lie a un tiers non de type "particulier" - if ($company->typent_code != 'TE_PRIVATE') { - $this->setOrg($company->name); + if ($urlphoto) { + $mimetype = dol_mimetype($urlphoto); + if ($mimetype) { + $this->setPhoto($mimetype, $urlphoto); } } - // Personal informations - $this->setPhoneNumber($object->personal_mobile, "TYPE=HOME,VOICE"); + if ($object->office_phone) { + $this->setPhoneNumber($object->office_phone, "TYPE=WORK,VOICE"); + } + /* disabled + if ($object->personal_mobile) { + $this->setPhoneNumber($object->personal_mobile, "TYPE=CELL,VOICE"); + }*/ + if ($object->user_mobile) { + $this->setPhoneNumber($object->user_mobile, "TYPE=CELL,VOICE"); + } + if ($object->office_fax) { + $this->setPhoneNumber($object->office_fax, "TYPE=WORK,FAX"); + } + + if (!empty($object->socialnetworks)) { + foreach ($object->socialnetworks as $key => $val) { + $urlsn = ''; + if ($key == 'linkedin') { + if (!preg_match('/^http/', $val)) { + $urlsn = 'https://www.'.$key.'.com/company/'.urlencode($val); + } else { + $urlsn = $val; + } + } elseif ($key == 'youtube') { + if (!preg_match('/^http/', $val)) { + $urlsn = 'https://www.'.$key.'.com/user/'.urlencode($val); + } else { + $urlsn = $val; + } + } else { + if (!preg_match('/^http/', $val)) { + $urlsn = 'https://www.'.$key.'.com/'.urlencode($val); + } else { + $urlsn = $val; + } + } + if ($urlsn) { + $this->properties["socialProfile;type=".$key] = $urlsn; + } + } + } + + $country = $object->country_code ? $object->country : ''; + + if ($object->address || $object->town || $object->state || $object->zip || $object->country) { + $this->setAddress("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK"); + //$this->setLabel("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=HOME"); + } + + if ($object->email) { + $this->setEmail($object->email, "TYPE=WORK"); + } + /* disabled + if ($object->personal_email) { + $this->setEmail($object->personal_email, "TYPE=HOME"); + } */ + if ($object->note_public) { + $this->setNote($object->note_public); + } + if ($object->job) { + $this->setTitle($object->job); + } + + // For user, type=home + // For contact, $object->url is not defined + if ($object->url) { + $this->setURL($object->url, ""); + } + + if (is_object($company)) { + // Si user linked to a thirdparty and not a physical people + if ($company->typent_code != 'TE_PRIVATE') { + $this->setOrg($company->name); + } + + $this->setURL($company->url, ""); + + if ($company->phone && $company->phone != $object->office_phone) { + $this->setPhoneNumber($company->phone, "TYPE=WORK,VOICE"); + } + if ($company->fax && $company->fax != $object->office_fax) { + $this->setPhoneNumber($company->fax, "TYPE=WORK,FAX"); + } + if ($company->address || $company->town || $company->state || $company->zip || $company->country) { + $this->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK"); + } + + if ($company->email && $company->email != $object->email) { + $this->setEmail($company->email, "TYPE=WORK"); + } + + /* + if (!empty($company->socialnetworks)) { + foreach ($company->socialnetworks as $key => $val) { + $urlsn = ''; + if ($key == 'linkedin') { + if (!preg_match('/^http/', $val)) { + $urlsn = 'https://www.'.$key.'.com/company/'.urlencode($val); + } else { + $urlsn = $val; + } + } elseif ($key == 'youtube') { + if (!preg_match('/^http/', $val)) { + $urlsn = 'https://www.'.$key.'.com/user/'.urlencode($val); + } else { + $urlsn = $val; + } + } else { + if (!preg_match('/^http/', $val)) { + $urlsn = 'https://www.'.$key.'.com/'.urlencode($val); + } else { + $urlsn = $val; + } + } + if ($urlsn) { + $this->properties["socialProfile;type=".$key] = $urlsn; + } + } + } + */ + } + + // Birthday if ($object->birth) { $this->setBirthday($object->birth); } diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php index ba1a6dd0908..ec5f53377c2 100644 --- a/htdocs/public/users/view.php +++ b/htdocs/public/users/view.php @@ -91,13 +91,79 @@ if ($cancel) { */ $form = new Form($db); +$v = new vCard(); + $company = $mysoc; -if ($mode == 'vcard') { - // We create VCard - $v = new vCard(); +$modulepart = 'userphotopublic'; +$dir = $conf->user->dir_output; - $output = $v->buildVCardString($object, $company, $langs); +// Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo) +// Define logo and logosmall +$logo = ''; +$logosmall = ''; +if (!empty($object->photo)) { + if (dolIsAllowedForPreview($object->photo)) { + $logosmall = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small'); + $logo = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; + //$originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; + } +} +//print ''."\n"; +// Define urllogo +$urllogo = ''; +$urllogofull = ''; +if (!empty($logosmall) && is_readable($dir.'/'.$logosmall)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&securekey='.urlencode($securekey).'&file='.urlencode($logosmall); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&securekey='.urlencode($securekey).'&file='.urlencode($logosmall); +} elseif (!empty($logo) && is_readable($dir.'/'.$logo)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&securekey='.urlencode($securekey).'&file='.urlencode($logo); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&securekey='.urlencode($securekey).'&file='.urlencode($logo); +} + +// Clean data we don't want on public page +if (getDolUserInt('USER_PUBLIC_HIDE_PHOTO', 0, $object)) { + $logo = ''; + $logosmall = ''; + $urllogo = ''; + $urllogofull = ''; +} +if (getDolUserInt('USER_PUBLIC_HIDE_JOBPOSITION', 0, $object)) { + $object->job = ''; +} +if (getDolUserInt('USER_PUBLIC_HIDE_EMAIL', 0, $object)) { + $object->email = ''; +} +if (getDolUserInt('USER_PUBLIC_HIDE_EMAIL', 0, $object)) { + $object->job = ''; +} +if (getDolUserInt('USER_PUBLIC_HIDE_OFFICE_PHONE', 0, $object)) { + $object->office_phone = ''; +} +if (getDolUserInt('USER_PUBLIC_HIDE_OFFICE_FAX', 0, $object)) { + $object->office_fax = ''; +} +if (getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object)) { + $object->user_mobile = ''; +} +if (getDolUserInt('USER_PUBLIC_HIDE_BIRTH', 0, $object)) { + $object->birth = ''; +} +if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object)) { + $object->socialnetworks = ''; +} +if (getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) { + $company = null; +} + + +// Output vcard +if ($mode == 'vcard') { + // Reset data no selected for public VCard + + + // We create VCard + $output = $v->buildVCardString($object, $company, $langs, $urllogofull); $filename = trim(urldecode($v->getFileName())); // "Nom prenom.vcf" $filenameurlencoded = dol_sanitizeFileName(urlencode($filename)); @@ -147,34 +213,6 @@ print ''; print "\n"; print ''."\n"; -$modulepart = 'userphotopublic'; -$imagesize = 'small'; -$dir = $conf->user->dir_output; -$email = $object->email; - -// Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo) -// Define logo and logosmall -$logo = ''; -$logosmall = ''; -if (!empty($object->photo)) { - if (dolIsAllowedForPreview($object->photo)) { - $logosmall = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small'); - $logo = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; - //$originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; - } -} -//print ''."\n"; -// Define urllogo -$urllogo = ''; -$urllogofull = ''; -if (!empty($logosmall) && is_readable($conf->user->dir_output.'/'.$logosmall)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&securekey='.urlencode($securekey).'&file='.urlencode($logosmall); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&securekey='.urlencode($securekey).'&file='.urlencode($logosmall); -} elseif (!empty($logo) && is_readable($conf->user->dir_output.'/'.$logo)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&securekey='.urlencode($securekey).'&file='.urlencode($logo); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&securekey='.urlencode($securekey).'&file='.urlencode($logo); -} - // Output html code for logo print '
'; print '
'; @@ -211,9 +249,11 @@ $socialnetworksdict = getArrayOfSocialNetworks(); // Show barcode $showbarcode = GETPOST('nobarcode') ? 0 : 1; if ($showbarcode) { + $qrcodecontent = $output = $v->buildVCardString($object, $company, $langs); + print '
'; print '
'; - print ''; + print ''; print '
'; print '
'; } diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php index 8d023c2c9a9..c2de7e17b06 100644 --- a/htdocs/user/virtualcard.php +++ b/htdocs/user/virtualcard.php @@ -73,6 +73,7 @@ if ($action == 'update') { $tmparray['USER_PUBLIC_HIDE_OFFICE_PHONE'] = (GETPOST('USER_PUBLIC_HIDE_OFFICE_PHONE') ? 1 : 0); $tmparray['USER_PUBLIC_HIDE_OFFICE_FAX'] = (GETPOST('USER_PUBLIC_HIDE_OFFICE_FAX') ? 1 : 0); $tmparray['USER_PUBLIC_HIDE_USER_MOBILE'] = (GETPOST('USER_PUBLIC_HIDE_USER_MOBILE') ? 1 : 0); + $tmparray['USER_PUBLIC_HIDE_BIRTH'] = (GETPOST('USER_PUBLIC_HIDE_BIRTH') ? 1 : 0); $tmparray['USER_PUBLIC_HIDE_SOCIALNETWORKS'] = (GETPOST('USER_PUBLIC_HIDE_SOCIALNETWORKS') ? 1 : 0); $tmparray['USER_PUBLIC_HIDE_COMPANY'] = (GETPOST('USER_PUBLIC_HIDE_COMPANY') ? 1 : 0); $tmparray['USER_PUBLIC_MORE'] = (GETPOST('USER_PUBLIC_MORE') ? GETPOST('USER_PUBLIC_MORE') : ''); @@ -230,6 +231,13 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { print $form->selectyesno("USER_PUBLIC_HIDE_USER_MOBILE", (getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object) : 0), 1); print "\n"; + // User mobile + print ''; + print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Birthdate")); + print ''; + print $form->selectyesno("USER_PUBLIC_HIDE_BIRTH", (getDolUserInt('USER_PUBLIC_HIDE_BIRTH', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_BIRTH', 0, $object) : 0), 1); + print "\n"; + // Social networks print ''; print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("SocialNetworks")); From ac5a07fee803d9f9712f7c2f76c38a6e244f3ea8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 17:27:19 +0100 Subject: [PATCH 071/218] Debug v17 --- htdocs/comm/propal/card.php | 2 +- htdocs/commande/card.php | 2 +- htdocs/compta/facture/card.php | 2 +- htdocs/supplier_proposal/card.php | 2 -- .../supplier_proposal/class/supplier_proposal.class.php | 9 +++++++-- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 7953691f11b..84e4e1bfb5e 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -938,7 +938,7 @@ if (empty($reshook)) { $prod_entry_mode = GETPOST('prod_entry_mode', 'aZ09'); if ($prod_entry_mode == 'free') { $idprod = 0; - $tva_tx = (GETPOST('tva_tx', 'alpha') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx', 'alpha'))) : 0); + $tva_tx = (GETPOSTISSET('tva_tx') ? GETPOST('tva_tx', 'alpha') : 0); } else { $idprod = GETPOST('idprod', 'int'); $tva_tx = ''; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 135c6fc9ab9..0510f089045 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -676,7 +676,7 @@ if (empty($reshook)) { $prod_entry_mode = GETPOST('prod_entry_mode', 'aZ09'); if ($prod_entry_mode == 'free') { $idprod = 0; - $tva_tx = (GETPOST('tva_tx', 'alpha') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx', 'alpha'))) : 0); + $tva_tx = (GETPOSTISSET('tva_tx') ? GETPOST('tva_tx', 'alpha') : 0); } else { $idprod = GETPOST('idprod', 'int'); $tva_tx = ''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d8e235193b5..287d99fc1fb 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2038,7 +2038,7 @@ if (empty($reshook)) { $prod_entry_mode = GETPOST('prod_entry_mode', 'aZ09'); if ($prod_entry_mode == 'free') { $idprod = 0; - $tva_tx = (GETPOST('tva_tx', 'alpha') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx', 'alpha'))) : 0); + $tva_tx = (GETPOSTISSET('tva_tx') ? GETPOST('tva_tx', 'alpha') : 0); } else { $idprod = GETPOST('idprod', 'int'); $tva_tx = ''; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 4b898a75645..c9dc776c9c5 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -591,10 +591,8 @@ if (empty($reshook)) { $prod_entry_mode = GETPOST('prod_entry_mode', 'aZ09'); if ($prod_entry_mode == 'free') { $idprod = 0; - $tva_tx = (GETPOST('tva_tx', 'alpha') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx', 'alpha'))) : 0); } else { $idprod = GETPOST('idprod', 'int'); - $tva_tx = ''; } $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 1f95e3de5fd..16211e7a027 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2584,7 +2584,7 @@ class SupplierProposal extends CommonObject // For other object, here we call fetch_lines. But fetch_lines does not exists on supplier proposal $sql = 'SELECT pt.rowid, pt.label as custom_label, pt.description, pt.fk_product, pt.fk_remise_except,'; - $sql .= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,'; + $sql .= ' pt.qty, pt.tva_tx, pt.vat_src_code, pt.remise_percent, pt.subprice, pt.info_bits,'; $sql .= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,'; $sql .= ' pt.product_type, pt.rang, pt.fk_parent_line,'; $sql .= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,'; @@ -2620,6 +2620,7 @@ class SupplierProposal extends CommonObject $this->lines[$i]->fk_remise_except = $obj->fk_remise_except; $this->lines[$i]->remise_percent = $obj->remise_percent; $this->lines[$i]->tva_tx = $obj->tva_tx; + $this->lines[$i]->vat_src_code = $obj->vat_src_code; $this->lines[$i]->info_bits = $obj->info_bits; $this->lines[$i]->total_ht = $obj->total_ht; $this->lines[$i]->total_tva = $obj->total_tva; @@ -2988,6 +2989,9 @@ class SupplierProposalLine extends CommonObjectLine if (empty($this->tva_tx)) { $this->tva_tx = 0; } + if (empty($this->vat_src_code)) { + $this->vat_src_code = ''; + } if (empty($this->localtax1_tx)) { $this->localtax1_tx = 0; } @@ -3056,7 +3060,7 @@ class SupplierProposalLine extends CommonObjectLine $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'supplier_proposaldet'; $sql .= ' (fk_supplier_proposal, fk_parent_line, label, description, fk_product, product_type,'; $sql .= ' date_start, date_end,'; - $sql .= ' fk_remise_except, qty, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,'; + $sql .= ' fk_remise_except, qty, tva_tx, vat_src_code, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,'; $sql .= ' subprice, remise_percent, '; $sql .= ' info_bits, '; $sql .= ' total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_product_fournisseur_price, buy_price_ht, special_code, rang,'; @@ -3073,6 +3077,7 @@ class SupplierProposalLine extends CommonObjectLine $sql .= " ".($this->fk_remise_except ? ((int) $this->fk_remise_except) : "null").","; $sql .= " ".price2num($this->qty, 'MS').","; $sql .= " ".price2num($this->tva_tx).","; + $sql .= " '".$this->db->escape($this->vat_src_code)."',"; $sql .= " ".price2num($this->localtax1_tx).","; $sql .= " ".price2num($this->localtax2_tx).","; $sql .= " '".$this->db->escape($this->localtax1_type)."',"; From 83bb95f318c5039eaa584b76e2d853b76b7d617b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 18:50:01 +0100 Subject: [PATCH 072/218] Fix warning php8 --- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index eac6e0261ee..5f637373507 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -675,10 +675,18 @@ class pdf_azur extends ModelePDFPropales // retrieve global local tax if ($localtax1_type && $localtax1ligne != 0) { - $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne; + if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) { + $this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne; + } else { + $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne; + } } if ($localtax2_type && $localtax2ligne != 0) { - $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; + if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) { + $this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne; + } else { + $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; + } } if (($object->lines[$i]->info_bits & 0x01) == 0x01) { From 153a91335e69ca058ff77bf2f3c9ab9074d28c26 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 10 Jan 2023 20:05:40 +0100 Subject: [PATCH 073/218] Update ChangeLog --- ChangeLog | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9ec9fb4525a..f752894b4d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -96,18 +96,18 @@ NEW: can sort and preselected best supplier price NEW: Can use products categories to make inventory NEW: Change filter type on tickets list into a multiselect combo NEW: conf TIMESPENT_ALWAYS_UPDATE_THM, when it's on we always check current thm of user to update it in task time line -NEW: constant PROPAL_NEW_AS_SIGNED NEW: show date delivery planned on orders linked to company and product NEW: Default values in extrafields are not more limited to 255 char. NEW: display currency in takepos menu NEW: Enable online signature for interventions NEW: Encrypt all sensitive constants in llx_const -NEW: extrafield price with currency NEW: filter on reception dates (from / to) in cheque paiement card NEW: Contracts: Default template of contract is not mandatory NEW: Contracts: Manage Position (Rank) on Contract Lines NEW: EMail-Collector: add IMAP port setting NEW: EMail-Collector: add a button "Test collect" +NEW: Extrafields: field price with currency +NEW: Extrafields: support IP type in extrafields NEW: Members: default_lang for members NEW: Members: Table of membership types NEW: Members: add free membership amounts at the membership type level @@ -127,21 +127,17 @@ NEW: Website: can switch status of website and page from the website toolbar NEW: Website: Templates of websites are now directories and not zip into core repo NEW: Website: add 4 other templates in website module NEW: If we select another view list mode, we keep it -NEW: Init module bookcal NEW: Introduce dolEncrypt and dolDecrypt to be able to encrypt data in db NEW: Invoice - Add french mention on pdf when vat debit option is on NEW: invoice export : add accounting affectation NEW: label on products categories filter NEW: The link "add to bookmark" is always on top in the bookmark popup -NEW: MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS const to show category customer filter NEW: Make module WebservicesClient deprecated. Use module WebHook instead. NEW: manage no email with thirdparties (better for GDPR) NEW: Manage VAT on all lines on purchases cycle NEW: manage virtual stock at a future date NEW: On a bank reconciled line, we can modify the bank receipt NEW: On a form to send an email, we show all emails of all contacts of object -NEW: Option PRODUCTBATCH_SHOW_WAREHOUSE_ON_SHIPMENT showing wh on PDF -NEW: Option PRODUIT_DESC_IN_FORM accept (desktop only or +smartphone) NEW: Page for mass stock transfer can be used with no source stock NEW: parent company column and filter in invoice and order list NEW: Add show "Sales rep" option for PDF @@ -168,19 +164,25 @@ NEW: skip accept/refuse process for proposals (option PROPAL_SKIP_ACCEPT_REFUSE) NEW: experimental SMTP using PhpImap allowing OAuth2 authentication (need to add option MAIN_IMAP_USE_PHPIMAP) NEW: can substitue project title in mail template NEW: Supplier order list - Add column private and public note -NEW: Support IP type in extrafields NEW: The purge of files can purge only if older than a number of seconds NEW: Update ActionComm type_code on email message ticket NEW: VAT - Admin - Add information on deadline day for submission of VAT declaration NEW: expand/collapse permissions on user permission page NEW: Add the target to select attendees of event for emailings + Option / Const for System: +NEW: Option PRODUCTBATCH_SHOW_WAREHOUSE_ON_SHIPMENT showing warehouse on PDF +NEW: Option PRODUIT_DESC_IN_FORM accept (desktop only or +smartphone) +NEW: MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS const to show category customer filter +NEW: constant PROPAL_NEW_AS_SIGNED + Localisation: NEW: adding JAPAN Chart-of-Account and regions/departments NEW: adding NIF verification for Algeria Modules NEW: Experimental module Asset +NEW: Init module bookcal For developers or integrators: @@ -190,20 +192,26 @@ NEW: ModuleBuilder can generate code of class from an existing SQL table NEW: #20912 Add trigger to record the event of sending an email from a project NEW: #21750 Added "Get lines and Post lines from BOM" at the REST Service NEW: #22370 Modulebuilder supports 'alwayseditable' (like extrafields) -NEW: Removed completely the need for the library adodbtime -NEW: hook on agenda pages -NEW: hook to complete payment in TakePOS -NEW: hook "changeHelpURL" to modify target of the help button -NEW: hook formConfirm on action comm card -NEW: hook to modify supplier product html select -NEW: Add new hook for show virtual stock details on product stock card -NEW: Add new hooks for actioncomm NEW: conf->global->SYSLOG_FILE_ONEPERSESSION accept a string -NEW: translate for contact type API, setup/ticket API, shipping method API NEW: All ajax pages have now a top_httphead() -NEW: support multilang in Civilities API + + API: NEW: Add API for the partnership module NEW: Add "Get lines and Post lines from BOM" in the API +NEW: translate for contact type API, setup/ticket API, shipping method API +NEW: support multilang in Civilities API + + Hooks: +NEW: Actioncomm - add new hooks for actioncomm +NEW: Actioncomm - hook formConfirm on action comm card +NEW: Agenda - hook on agenda pages +NEW: Help - hook "changeHelpURL" to modify target of the help button +NEW: Product - add hook to show virtual stock details on product stock card +NEW: Product - add hook to modify supplier product html select +NEW: TakePOS - add hook to complete payment in TakePOS + + +NEW: Removed completely the need for the library adodbtime NEW: Replace fk_categories_product with categories_product in inventory NEW: Rewrite of SQL request. Removed the join on category (for filter on categ), replaced with a EXISTS/NOT From f52f18fb95da1558f516e72d0d035227418e18f2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 21:27:56 +0100 Subject: [PATCH 074/218] Fix picto edit must not be visilbe in edit mode --- htdocs/core/tpl/objectline_title.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index 7fe63613ea1..4640d710705 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -71,7 +71,7 @@ if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || !empty($conf->global->FA if (in_array($object->element, array('propal', 'commande', 'facture', 'supplier_proposal', 'order_supplier', 'invoice_supplier')) && $object->status == $object::STATUS_DRAFT) { global $mysoc; - if (empty($disableedit)) { + if (empty($disableedit) && GETPOST('mode', 'aZ09') != 'vatforalllines') { print 'id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').''; } //print ''; @@ -111,7 +111,7 @@ print $langs->trans('ReductionShort'); if (in_array($object->element, array('propal', 'commande', 'facture')) && $object->status == $object::STATUS_DRAFT) { global $mysoc; - if (empty($disableedit)) { + if (empty($disableedit) && GETPOST('mode', 'aZ09') != 'remiseforalllines') { print 'id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').''; } //print ''; From 2f2c710a33b116f7ef0b86a73d062fde8f468e02 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 21:34:59 +0100 Subject: [PATCH 075/218] Fix reposition when adding a contract line --- htdocs/contrat/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 79897cdc16d..12f53b49390 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2046,11 +2046,12 @@ if ($action == 'create') { $dateSelector = 1; print "\n"; - print ' + print ' + '; print '
'; From 3769861a8adb54fd99306bf3f55f0508a4e3a921 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 21:46:11 +0100 Subject: [PATCH 076/218] NEW VAT can be modified during add of line --- htdocs/comm/propal/card.php | 27 +++++++------ htdocs/commande/card.php | 8 ++-- htdocs/compta/facture/card.php | 9 ++--- htdocs/contrat/card.php | 11 +++--- htdocs/core/class/html.form.class.php | 7 +--- htdocs/core/tpl/objectline_create.tpl.php | 35 ++++++++++++++++- htdocs/product/ajax/products.php | 48 ++++++++++++++--------- 7 files changed, 91 insertions(+), 54 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 5fb464a6e8e..c2dcd19eb9b 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -938,12 +938,12 @@ if (empty($reshook)) { $prod_entry_mode = GETPOST('prod_entry_mode', 'aZ09'); if ($prod_entry_mode == 'free') { $idprod = 0; - $tva_tx = (GETPOST('tva_tx', 'alpha') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx', 'alpha'))) : 0); } else { $idprod = GETPOST('idprod', 'int'); - $tva_tx = ''; } + $tva_tx = GETPOST('tva_tx', 'alpha'); + $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2); $remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha'), '', 2) : 0); if (empty($remise_percent)) { @@ -992,6 +992,8 @@ if (empty($reshook)) { if (!$error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) { $pu_ht = 0; $pu_ttc = 0; + $pu_ht_devise = 0; + $pu_ttc_devise = 0; $price_min = 0; $price_min_ttc = 0; $price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT'); @@ -1002,7 +1004,6 @@ if (empty($reshook)) { // Ecrase $pu par celui du produit // Ecrase $desc par celui du produit - // Ecrase $tva_tx par celui du produit // Replaces $fk_unit with the product unit if (!empty($idprod) && $idprod > 0) { $prod = new Product($db); @@ -1011,11 +1012,11 @@ if (empty($reshook)) { $label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : ''); // Update if prices fields are defined - $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); + /*$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); if (empty($tva_tx)) { $tva_npr = 0; - } + }*/ // Price unique per product $pu_ht = $prod->price; @@ -1056,14 +1057,14 @@ if (empty($reshook)) { $price_min = price($prodcustprice->lines[0]->price_min); $price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc); $price_base_type = $prodcustprice->lines[0]->price_base_type; - $tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx.' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx); + /*$tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx.' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx); if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) { $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; } $tva_npr = $prodcustprice->lines[0]->recuperableonly; if (empty($tva_tx)) { $tva_npr = 0; - } + }*/ } } } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) { @@ -1114,12 +1115,12 @@ if (empty($reshook)) { $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); // Set unit price to use - if (!empty($price_ht) || $price_ht === '0') { + if (!empty($price_ht) || (string) $price_ht === '0') { $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); - } elseif (!empty($price_ttc) || $price_ttc === '0') { + $pu_ttc = price2num($pu_ht * (1 + ((float) $tmpvat / 100)), 'MU'); + } elseif (!empty($price_ttc) || (string) $price_ttc === '0') { $pu_ttc = price2num($price_ttc, 'MU'); - $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); + $pu_ht = price2num($pu_ttc / (1 + ((float) $tmpvat / 100)), 'MU'); } elseif ($tmpvat != $tmpprodvat) { // Is this still used ? if ($price_base_type != 'HT') { @@ -1416,12 +1417,12 @@ if (empty($reshook)) { //var_dump(price2num($price_min_ttc)); var_dump(price2num($pu_ttc)); var_dump($remise_percent);exit; if ($usermustrespectpricemin) { - if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - $remise_percent / 100)) < price2num($price_min))) { + if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - (float) $remise_percent / 100)) < price2num($price_min))) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; $action = 'editline'; - } elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc))) { + } elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - (float) $remise_percent / 100)) < price2num($price_min_ttc))) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index ccf706c9ac7..c2ab4fcd3bc 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -676,12 +676,11 @@ if (empty($reshook)) { $prod_entry_mode = GETPOST('prod_entry_mode', 'aZ09'); if ($prod_entry_mode == 'free') { $idprod = 0; - $tva_tx = (GETPOST('tva_tx', 'alpha') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx', 'alpha'))) : 0); } else { $idprod = GETPOST('idprod', 'int'); - $tva_tx = ''; } + $tva_tx = GETPOST('tva_tx', 'alpha'); // Prepare a price equivalent for minimum price check $pu_equivalent = $pu_ht; @@ -762,7 +761,6 @@ if (empty($reshook)) { // Ecrase $pu par celui du produit // Ecrase $desc par celui du produit - // Ecrase $tva_tx par celui du produit // Ecrase $base_price_type par celui du produit if (!empty($idprod) && $idprod > 0) { $prod = new Product($db); @@ -771,11 +769,11 @@ if (empty($reshook)) { $label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : ''); // Update if prices fields are defined - $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); + /*$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); if (empty($tva_tx)) { $tva_npr = 0; - } + }*/ $pu_ht = $prod->price; $pu_ttc = $prod->price_ttc; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index cc6b92f72cb..5f24ca87830 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2038,12 +2038,12 @@ if (empty($reshook)) { $prod_entry_mode = GETPOST('prod_entry_mode', 'aZ09'); if ($prod_entry_mode == 'free') { $idprod = 0; - $tva_tx = (GETPOST('tva_tx', 'alpha') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx', 'alpha'))) : 0); } else { $idprod = GETPOST('idprod', 'int'); - $tva_tx = ''; } + $tva_tx = GETPOST('tva_tx', 'alpha'); + $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2); $remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha'), '', 2) : 0); if (empty($remise_percent)) { @@ -2137,7 +2137,6 @@ if (empty($reshook)) { // Ecrase $pu par celui du produit // Ecrase $desc par celui du produit - // Ecrase $tva_tx par celui du produit // Ecrase $base_price_type par celui du produit // Replaces $fk_unit with the product's if (!empty($idprod) && $idprod > 0) { @@ -2157,8 +2156,8 @@ if (empty($reshook)) { $price_min_ttc = $datapriceofproduct['price_min_ttc']; $price_base_type = $datapriceofproduct['price_base_type']; - $tva_tx = $datapriceofproduct['tva_tx']; - $tva_npr = $datapriceofproduct['tva_npr']; + //$tva_tx = $datapriceofproduct['tva_tx']; + //$tva_npr = $datapriceofproduct['tva_npr']; $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 12f53b49390..123366fd630 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -427,6 +427,7 @@ if (empty($reshook)) { } else { $idprod = GETPOST('idprod', 'int'); } + $tva_tx = GETPOST('tva_tx', 'alpha'); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); @@ -474,11 +475,11 @@ if (empty($reshook)) { $prod->fetch($idprod); // Update if prices fields are defined - $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); + /*$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); if (empty($tva_tx)) { $tva_npr = 0; - } + }*/ $price_min = $prod->price_min; $price_min_ttc = $prod->price_min_ttc; @@ -500,14 +501,14 @@ if (empty($reshook)) { if (count($prodcustprice->lines) > 0) { $price_min = price($prodcustprice->lines[0]->price_min); $price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc); - $tva_tx = $prodcustprice->lines[0]->tva_tx; + /*$tva_tx = $prodcustprice->lines[0]->tva_tx; if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) { $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; } $tva_npr = $prodcustprice->lines[0]->recuperableonly; if (empty($tva_tx)) { $tva_npr = 0; - } + }*/ } } } @@ -699,7 +700,7 @@ if (empty($reshook)) { $date_end_real_update = $objectline->date_end_real; } - $vat_rate = GETPOST('eltva_tx'); + $vat_rate = GETPOST('eltva_tx', 'alpha'); // Define info_bits $info_bits = 0; if (preg_match('/\*/', $vat_rate)) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1c54df24e06..369deba4455 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2344,11 +2344,7 @@ class Form } } // mode=1 means customers products - $urloption = 'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&status_purchase='.$status_purchase.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus; - //Price by customer - if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) { - $urloption .= '&socid='.$socid; - } + $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&status_purchase='.$status_purchase.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus; $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); if (isModEnabled('variants') && is_array($selected_combinations)) { @@ -3247,6 +3243,7 @@ class Form // mode=2 means suppliers products $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice; print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); + print ($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').''; } else { print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder); diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 32a9f1cdaae..52761509890 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -40,6 +40,7 @@ if (empty($object) || !is_object($object)) { print "Error: this template page cannot be called directly as an URL"; exit; } + $usemargins = 0; if (isModEnabled('margin') && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) { $usemargins = 1; @@ -48,6 +49,7 @@ if (!isset($dateSelector)) { global $dateSelector; // Take global var only if not already defined into function calling (for example formAddObjectLine) } global $forceall, $forcetoshowtitlelines, $senderissupplier, $inputalsopricewithtax; +global $mysoc; if (!isset($dateSelector)) { $dateSelector = 1; // For backward compatibility @@ -776,6 +778,35 @@ if (!empty($usemargins) && $user->rights->margins->creer) { var stringforvatrateselection = tva_tx; if (typeof default_vat_code != 'undefined' && default_vat_code != null && default_vat_code != '') { stringforvatrateselection = stringforvatrateselection+' ('+default_vat_code+')'; + + console.log("MAIN_SALETAX_AUTOSWITCH_I_CS_FOR_INDIA is on so we check if we need to autoswith the vat code"); + console.log("mysoc->country_code=country_code; ?> thirdparty->country_code=thirdparty->country_code; ?>"); + new_default_vat_code = default_vat_code; + country_code == 'IN' && !empty($object->thirdparty) && $object->thirdparty->country_code == 'IN' && $mysoc->state_code == $object->thirdparty->state_code) { + // We are in India and states are same, we revert the vat code "I-x" into "CS-x" + ?> + console.log("Countries are both IN and states are same, so we revert I into CS in default_vat_code="+default_vat_code); + new_default_vat_code = default_vat_code.replace(/^I\-/, 'C+S-'); + country_code == 'IN' && !empty($object->thirdparty) && $object->thirdparty->country_code == 'IN' && $mysoc->state_code != $object->thirdparty->state_code) { + // We are in India and states differs, we revert the vat code "CS-x" into "I-x" + ?> + console.log("Countries are both IN and states differs, so we revert CS into I in default_vat_code="+default_vat_code); + new_default_vat_code = default_vat_code.replace(/^C\+S\-/, 'I-'); + + if (new_default_vat_code != default_vat_code && jQuery('#tva_tx option:contains("'+new_default_vat_code+'")').val()) { + console.log("We found en entry into VAT with new default_vat_code, we will use it"); + stringforvatrateselection = jQuery('#tva_tx option:contains("'+new_default_vat_code+'")').val(); + } + } // Set vat rate if field is an input box $('#tva_tx').val(tva_tx); @@ -1113,7 +1144,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) { }); - /* Function to set fields from choice */ + /* Function to set fields visibility after selecting a free product */ function setforfree() { console.log("objectline_create.tpl::setforfree. We show most fields"); jQuery("#idprodfournprice").val('0'); // Set cursor on not selected product @@ -1148,7 +1179,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) { jQuery("#multicurrency_price_ttc").val('').hide(); jQuery("#title_up_ttc, #title_up_ttc_currency").hide(); - jQuery("#tva_tx, #title_vat").hide(); + /* jQuery("#tva_tx, #title_vat").hide(); */ /* jQuery("#title_fourn_ref").hide(); */ jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").hide(); jQuery("#buying_price").show(); diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index f61e92c56f3..e07aa4ab5c5 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -103,26 +103,36 @@ if ($action == 'fetch' && !empty($id)) { $price_level = 1; if ($socid > 0) { - $thirdpartytemp = new Societe($db); - $thirdpartytemp->fetch($socid); - - //Load translation description and label - if (getDolGlobalInt('MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { - $newlang = $thirdpartytemp->default_lang; - - if (!empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - $outdesc_trans = (!empty($object->multilangs[$outputlangs->defaultlang]["description"])) ? $object->multilangs[$outputlangs->defaultlang]["description"] : $object->description; - $outlabel_trans = (!empty($object->multilangs[$outputlangs->defaultlang]["label"])) ? $object->multilangs[$outputlangs->defaultlang]["label"] : $object->label; - } else { - $outdesc_trans = $object->description; - $outlabel_trans = $object->label; - } + $needchangeaccordingtothirdparty = 0; + if (getDolGlobalInt('MAIN_MULTILANGS') && getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { + $needchangeaccordingtothirdparty = 1; } + if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { + $needchangeaccordingtothirdparty = 1; + } + if ($needchangeaccordingtothirdparty) { + $thirdpartytemp = new Societe($db); + $thirdpartytemp->fetch($socid); - if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { - $price_level = $thirdpartytemp->price_level; + //Load translation description and label according to thirdparty language + if (getDolGlobalInt('MAIN_MULTILANGS') && getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { + $newlang = $thirdpartytemp->default_lang; + + if (!empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + $outdesc_trans = (!empty($object->multilangs[$outputlangs->defaultlang]["description"])) ? $object->multilangs[$outputlangs->defaultlang]["description"] : $object->description; + $outlabel_trans = (!empty($object->multilangs[$outputlangs->defaultlang]["label"])) ? $object->multilangs[$outputlangs->defaultlang]["label"] : $object->label; + } else { + $outdesc_trans = $object->description; + $outlabel_trans = $object->label; + } + } + + //Set price level according to thirdparty + if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { + $price_level = $thirdpartytemp->price_level; + } } } @@ -185,7 +195,7 @@ if ($action == 'fetch' && !empty($id)) { } // Price by customer - if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) { + if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; $prodcustprice = new Productcustomerprice($db); From 098e6c40759172bbb7e0d51305f246ad901ff3fb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 21:49:51 +0100 Subject: [PATCH 077/218] Fix look and feel v17 --- htdocs/commande/list.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 98d2b59d6a3..9ef9072d16a 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1526,16 +1526,16 @@ if ($resql) { } // Town if (!empty($arrayfields['s.town']['checked'])) { - print ''; + print ''; } // Zip if (!empty($arrayfields['s.zip']['checked'])) { - print ''; + print ''; } // State if (!empty($arrayfields['state.nom']['checked'])) { print ''; - print ''; + print ''; print ''; } // Country @@ -1723,18 +1723,18 @@ if ($resql) { } // Status billed if (!empty($arrayfields['c.facture']['checked'])) { - print ''; + print ''; print $form->selectyesno('search_billed', $search_billed, 1, 0, 1, 1); print ''; } // Import key if (!empty($arrayfields['c.import_key']['checked'])) { - print ''; + print ''; print ''; } // Status if (!empty($arrayfields['c.fk_statut']['checked'])) { - print ''; + print ''; $liststatus = array( Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraftShort"), Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"), @@ -1907,7 +1907,7 @@ if ($resql) { print_liste_field_titre($arrayfields['c.import_key']['label'], $_SERVER["PHP_SELF"], "c.import_key", "", $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['c.fk_statut']['checked'])) { - print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); } if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center '); @@ -2631,7 +2631,7 @@ if ($resql) { // Status if (!empty($arrayfields['c.fk_statut']['checked'])) { - print ''.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).''; + print ''.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).''; if (!$i) { $totalarray['nbfield']++; } From c78ad19186f8c410b01a85678dc74db776fb6366 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 18:50:01 +0100 Subject: [PATCH 078/218] Fix warning php8 --- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index e1afcc0c7a0..db076cd97b9 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -675,10 +675,18 @@ class pdf_azur extends ModelePDFPropales // retrieve global local tax if ($localtax1_type && $localtax1ligne != 0) { - $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne; + if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) { + $this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne; + } else { + $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne; + } } if ($localtax2_type && $localtax2ligne != 0) { - $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; + if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) { + $this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne; + } else { + $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; + } } if (($object->lines[$i]->info_bits & 0x01) == 0x01) { From 09a2028522f069acc032f36ee80d93b9dad8dc9f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 21:27:56 +0100 Subject: [PATCH 079/218] Fix picto edit must not be visilbe in edit mode --- htdocs/core/tpl/objectline_title.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index 7fe63613ea1..4640d710705 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -71,7 +71,7 @@ if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || !empty($conf->global->FA if (in_array($object->element, array('propal', 'commande', 'facture', 'supplier_proposal', 'order_supplier', 'invoice_supplier')) && $object->status == $object::STATUS_DRAFT) { global $mysoc; - if (empty($disableedit)) { + if (empty($disableedit) && GETPOST('mode', 'aZ09') != 'vatforalllines') { print 'id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').''; } //print ''; @@ -111,7 +111,7 @@ print $langs->trans('ReductionShort'); if (in_array($object->element, array('propal', 'commande', 'facture')) && $object->status == $object::STATUS_DRAFT) { global $mysoc; - if (empty($disableedit)) { + if (empty($disableedit) && GETPOST('mode', 'aZ09') != 'remiseforalllines') { print 'id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').''; } //print ''; From 00fce7eccd17d09074d1a6abb306d914b2b6217c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 21:34:59 +0100 Subject: [PATCH 080/218] Fix reposition when adding a contract line --- htdocs/contrat/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 38efdb3cca9..8af35072b93 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2046,11 +2046,12 @@ if ($action == 'create') { $dateSelector = 1; print "\n"; - print ' + print ' + '; print '
'; From 3c169ae09a96653be9c5d9bbf5c45c36b30810d4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 21:49:51 +0100 Subject: [PATCH 081/218] Fix look and feel v17 --- htdocs/commande/list.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 42b71b14c86..93a0d302fbf 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1515,16 +1515,16 @@ if ($resql) { } // Town if (!empty($arrayfields['s.town']['checked'])) { - print ''; + print ''; } // Zip if (!empty($arrayfields['s.zip']['checked'])) { - print ''; + print ''; } // State if (!empty($arrayfields['state.nom']['checked'])) { print ''; - print ''; + print ''; print ''; } // Country @@ -1712,18 +1712,18 @@ if ($resql) { } // Status billed if (!empty($arrayfields['c.facture']['checked'])) { - print ''; + print ''; print $form->selectyesno('search_billed', $search_billed, 1, 0, 1, 1); print ''; } // Import key if (!empty($arrayfields['c.import_key']['checked'])) { - print ''; + print ''; print ''; } // Status if (!empty($arrayfields['c.fk_statut']['checked'])) { - print ''; + print ''; $liststatus = array( Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraftShort"), Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"), @@ -1896,7 +1896,7 @@ if ($resql) { print_liste_field_titre($arrayfields['c.import_key']['label'], $_SERVER["PHP_SELF"], "c.import_key", "", $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['c.fk_statut']['checked'])) { - print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); } if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center '); @@ -2604,7 +2604,7 @@ if ($resql) { // Status if (!empty($arrayfields['c.fk_statut']['checked'])) { - print ''.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).''; + print ''.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).''; if (!$i) { $totalarray['nbfield']++; } From 313adba8f45382df6873c7749bb292192dd91d69 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 22:06:03 +0100 Subject: [PATCH 082/218] Fix set job recruitement back to draft --- htdocs/recruitment/recruitmentjobposition_card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/recruitment/recruitmentjobposition_card.php b/htdocs/recruitment/recruitmentjobposition_card.php index d1ca4ef2db1..34365e05792 100644 --- a/htdocs/recruitment/recruitmentjobposition_card.php +++ b/htdocs/recruitment/recruitmentjobposition_card.php @@ -401,7 +401,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Back to draft if ($object->status == $object::STATUS_VALIDATED) { if ($permissiontoadd) { - print ''.$langs->trans("SetToDraft").''; + print ''.$langs->trans("SetToDraft").''; } } From 3e4da8a1c587dea5feb861ea23dc2f7caa94f125 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 22:25:41 +0100 Subject: [PATCH 083/218] Fix standardize code --- .../recruitmentjobposition_card.php | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/htdocs/recruitment/recruitmentjobposition_card.php b/htdocs/recruitment/recruitmentjobposition_card.php index 34365e05792..b33ce55808e 100644 --- a/htdocs/recruitment/recruitmentjobposition_card.php +++ b/htdocs/recruitment/recruitmentjobposition_card.php @@ -108,7 +108,7 @@ if (empty($reshook)) { if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { $backtopage = $backurlforlist; } else { - $backtopage = dol_buildpath('/recruitment/recruitmentjobposition_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); + $backtopage = dol_buildpath('/recruitment/recruitmentjobposition_card.php', 1).'?id='.((!empty($id) && $id > 0) ? $id : '__ID__'); } } } @@ -130,7 +130,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; if ($action == 'set_thirdparty' && $permissiontoadd) { - $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, 'RECRUITMENTJOBPOSITION_MODIFY'); + $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, $triggermodname); } if ($action == 'classin' && $permissiontoadd) { $object->setProject(GETPOST('projectid', 'int')); @@ -257,8 +257,6 @@ if (($id || $ref) && $action == 'edit') { // Part to show record if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { - $res = $object->fetch_optionals(); - $head = recruitmentjobpositionPrepareHead($object); print dol_get_fiche_head($head, 'card', $langs->trans("RecruitmentJobPosition"), -1, $object->picto); @@ -395,31 +393,27 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send if (empty($user->socid)) { - print ''.$langs->trans('SendMail').''."\n"; + print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle'); } // Back to draft if ($object->status == $object::STATUS_VALIDATED) { if ($permissiontoadd) { - print ''.$langs->trans("SetToDraft").''; + print dolGetButtonAction('', $langs->trans('SetToDraft'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd); } } // Modify - if ($permissiontoadd) { - print ''.$langs->trans("Modify").''."\n"; - } else { - print ''.$langs->trans('Modify').''."\n"; - } + print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); // Validate if ($object->status == $object::STATUS_DRAFT) { if ($permissiontoadd) { if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { - print ''.$langs->trans("Validate").''; + print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes&token='.newToken(), '', $permissiontoadd); } else { $langs->load("errors"); - print ''.$langs->trans("Validate").''; + print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Validate"), 'default', '#', '', 0); } } } @@ -442,9 +436,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea /* if ($permissiontoadd) { if ($object->status == $object::STATUS_ENABLED) { - print ''.$langs->trans("Disable").''."\n"; + print dolGetButtonAction('', $langs->trans('Disable'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=disable&token='.newToken(), '', $permissiontoadd); } else { - print ''.$langs->trans("Enable").''."\n"; + print dolGetButtonAction('', $langs->trans('Enable'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=enable&token='.newToken(), '', $permissiontoadd); + } } }*/ if ($permissiontoadd) { @@ -454,7 +449,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // Delete - print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete); + $params = array(); + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete, $params); } print '
'."\n"; } From c5a83972ca9e7c1234799c8a5005b30060e33c0d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 23:47:47 +0100 Subject: [PATCH 084/218] Fix return warnings --- htdocs/core/class/stats.class.php | 2 +- htdocs/projet/class/projectstats.class.php | 12 ++++++------ htdocs/projet/class/taskstats.class.php | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index c8dbca747b9..60cdc5d5226 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -237,7 +237,7 @@ abstract class Stats /** * @param int $year year number - * @return int value + * @return array array of values */ protected abstract function getAverageByMonth($year); diff --git a/htdocs/projet/class/projectstats.class.php b/htdocs/projet/class/projectstats.class.php index 65d673a9ad2..e2b6c5129ff 100644 --- a/htdocs/projet/class/projectstats.class.php +++ b/htdocs/projet/class/projectstats.class.php @@ -298,7 +298,7 @@ class ProjectStats extends Stats * @param int $startyear End year * @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save) * @param int $wonlostfilter Add a filter on status won/lost - * @return array Array of values + * @return array|int Array of values or <0 if error */ public function getWeightedAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $wonlostfilter = 1) { @@ -411,10 +411,10 @@ class ProjectStats extends Stats /** * Return amount of elements by month for several years * - * @param int $endyear End year - * @param int $startyear Start year - * @param int $cachedelay accept for cache file (0=No read, no save of cache, -1=No read but save) - * @return array of values + * @param int $endyear End year + * @param int $startyear Start year + * @param int $cachedelay accept for cache file (0=No read, no save of cache, -1=No read but save) + * @return array|int Array of values or <0 if error */ public function getTransformRateByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0) { @@ -549,7 +549,7 @@ class ProjectStats extends Stats /** * Return average of entity by month * @param int $year year number - * @return int value + * @return array */ protected function getAverageByMonth($year) { diff --git a/htdocs/projet/class/taskstats.class.php b/htdocs/projet/class/taskstats.class.php index ce7c6c4f4c5..6ff56fd8132 100644 --- a/htdocs/projet/class/taskstats.class.php +++ b/htdocs/projet/class/taskstats.class.php @@ -212,7 +212,7 @@ class TaskStats extends Stats /** * Return average of entity by month * @param int $year year number - * @return int value + * @return array array of values */ protected function getAverageByMonth($year) { From e50a56290cd73811e10306ef6dadb876214252e9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2023 23:49:31 +0100 Subject: [PATCH 085/218] Fix warning --- htdocs/comm/propal/class/propal.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 2b429d0e8d1..b0aa5dba54c 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2903,7 +2903,7 @@ class Propal extends CommonObject * @param int $offset For pagination * @param string $sortfield Sort criteria * @param string $sortorder Sort order - * @return int -1 if KO, array with result if OK + * @return array|int -1 if KO, array with result if OK */ public function liste_array($shortlist = 0, $draft = 0, $notcurrentuser = 0, $socid = 0, $limit = 0, $offset = 0, $sortfield = 'p.datep', $sortorder = 'DESC') { @@ -2982,8 +2982,8 @@ class Propal extends CommonObject /** * Returns an array with id and ref of related invoices * - * @param int $id Id propal - * @return array Array of invoices id + * @param int $id Id propal + * @return array|int Array of invoices id */ public function InvoiceArrayList($id) { From 52f80737f593f7e199d106a4032adc2b0844e7ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Jan 2023 00:37:00 +0100 Subject: [PATCH 086/218] css --- htdocs/theme/eldy/global.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 289f44333cc..b9e35e1e9ea 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -49,7 +49,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) { --colortextbacktab: #; --colorboxiconbg: #eee; --refidnocolor:#444; - --tableforfieldcolor:#666; + --tableforfieldcolor:#888; --amountremaintopaycolor:#880000; --amountpaymentcomplete:#008800; --amountremaintopaybackcolor:none; From 33917e97b6bf5093cdaf80390d4d2e2b26ee16ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Jan 2023 01:12:08 +0100 Subject: [PATCH 087/218] NEW Increment website counter on each page access in website module --- htdocs/core/lib/website.lib.php | 27 +++++++++++++++++++++++++++ htdocs/core/lib/website2.lib.php | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index c258e3198ce..32a6d9d962a 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -423,6 +423,33 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '') print $content; } +/** + * Increase the website counter of page access. + * + * @param int $websiteid ID of website + * @param string $websitepagetype Type of page ('blogpost', 'page', ...) + * @param int $websitepageid ID of page + * @return int <0 if KO, >0 if OK + */ +function dolWebsiteIncrementCounter($websiteid, $websitepagetype, $websitepageid) +{ + if (!getDolGlobalInt('WEBSITE_PERF_DISABLE_COUNTERS')) { + //dol_syslog("dolWebsiteIncrementCounter websiteid=".$websiteid." websitepagetype=".$websitepagetype." websitepageid=".$websitepageid); + if (in_array($websitepagetype, array('blogpost', 'page'))) { + global $db; + + $sql = "UPDATE ".$db->prefix()."website SET pageviews_total = pageviews_total + 1, lastaccess = '".$db->idate(dol_now())."'"; + $sql .= " WHERE rowid = ".((int) $websiteid); + $resql = $db->query($sql); + if (! $resql) { + return -1; + } + } + } + + return 1; +} + /** * Format img tags to introduce viewimage on img src. diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 05727a1e539..c7099e8d2ed 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -271,7 +271,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage, $tplcontent .= ''."\n"; $tplcontent .= 'id.');'."\n"; + $tplcontent .= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp, "html", '.$objectpage->id.'); dolWebsiteIncrementCounter('.$object->id.', "'.$objectpage->type_container.'", '.$objectpage->id.');'."\n"; $tplcontent .= "// END PHP ?>\n"; //var_dump($filetpl);exit; From 8f5edcab02d45dcfaa84200013d36c9fad807be9 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 11 Jan 2023 06:11:41 +0100 Subject: [PATCH 088/218] Use isModEnabled() --- htdocs/bookcal/class/booking.class.php | 2 +- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/commande/class/commande.class.php | 2 +- .../facture/class/facture-rec.class.php | 2 +- htdocs/contrat/class/contrat.class.php | 2 +- htdocs/core/menus/init_menu_auguria.sql | 42 +++++++++---------- .../class/conferenceorbooth.class.php | 2 +- .../class/conferenceorboothattendee.class.php | 2 +- htdocs/fichinter/class/fichinter.class.php | 2 +- .../class/fournisseur.commande.class.php | 2 +- .../class/fournisseur.facture-rec.class.php | 2 +- .../fourn/class/fournisseur.facture.class.php | 2 +- .../template/class/myobject.class.php | 2 +- htdocs/mrp/class/mo.class.php | 2 +- .../class/recruitmentjobposition.class.php | 2 +- htdocs/ticket/class/ticket.class.php | 2 +- 16 files changed, 36 insertions(+), 36 deletions(-) diff --git a/htdocs/bookcal/class/booking.class.php b/htdocs/bookcal/class/booking.class.php index a74cb87a43d..51799fa09da 100644 --- a/htdocs/bookcal/class/booking.class.php +++ b/htdocs/bookcal/class/booking.class.php @@ -104,7 +104,7 @@ class Booking extends CommonObject public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1.2, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'searchall'=>1, 'validate'=>'1', 'comment'=>"Reference of object"), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'help'=>"LinkToThirparty", 'validate'=>'1',), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'isModEnabled("societe")', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'help'=>"LinkToThirparty", 'validate'=>'1',), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'validate'=>'1',), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3, 'validate'=>'1',), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0, 'cssview'=>'wordbreak', 'validate'=>'1',), diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 1b3df25c7d2..596e6e708aa 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -301,7 +301,7 @@ class Propal extends CommonObject 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>20), 'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>22), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>40), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>23), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'position'=>23), 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>24), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55), diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 73988594e6f..f6b304a7a52 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -306,7 +306,7 @@ class Commande extends CommonOrder 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>25), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>26), 'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>20), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>20), 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>25), 'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>1, 'position'=>60), 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>62), diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 3a586dfc3e5..6d7d2117147 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -169,7 +169,7 @@ class FactureRec extends CommonInvoice 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'titre' =>array('type'=>'varchar(100)', 'label'=>'Titre', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>15), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>25), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>25), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>30), //'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), 'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>40), diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 4352364452b..cc9f3319a5d 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -232,7 +232,7 @@ class Contrat extends CommonObject 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40), 'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>70), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>70), 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>75), 'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80), 'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85), diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index e6fc16a62d6..0308d52f67d 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -12,7 +12,7 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__; -- Top-Menu -- old: (module, enabled, rowid, ...) insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 1__+MAX_llx_menu__, '', '1', __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 2__+MAX_llx_menu__, 'societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 2__+MAX_llx_menu__, 'societe|fournisseur|supplier_order|supplier_invoice', '(isModEnabled("societe") && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 3__+MAX_llx_menu__, 'product|service', '$conf->product->enabled || $conf->service->enabled', __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 16__+MAX_llx_menu__, 'bom|mrp', '$conf->bom->enabled || $conf->mrp->enabled', __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'MRP', -1, 'mrp', '$user->rights->bom->read||$user->rights->mrp->read', '', 0, 31, __ENTITY__); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 7__+MAX_llx_menu__, 'projet', '$conf->project->enabled', __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__); @@ -83,36 +83,36 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 408__+MAX_llx_menu__, 'home', '', 407__+MAX_llx_menu__, '/user/group/card.php?mainmenu=home&leftmenu=users&action=create', 'NewGroup', 2, 'users', '(($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)', '', 2, 0, __ENTITY__); -- Third parties -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?mainmenu=companies&leftmenu=thirdparties', 'ThirdParty', 0, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 502__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&leftmenu=thirdparties', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=f&leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=supplier&action=create&type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=p&leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 507__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=prospects&action=create&type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=c&leftmenu=customers', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 510__+MAX_llx_menu__, 'companies', '', 509__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=customers&action=create&type=c', 'MenuNewCustomer', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?mainmenu=companies&leftmenu=thirdparties', 'ThirdParty', 0, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 502__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&leftmenu=thirdparties', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe") && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=f&leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe") && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=supplier&action=create&type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=p&leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 507__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=prospects&action=create&type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=c&leftmenu=customers', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 510__+MAX_llx_menu__, 'companies', '', 509__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=customers&action=create&type=c', 'MenuNewCustomer', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); -- Third parties - Contacts -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 600__+MAX_llx_menu__, 'companies', 'contacts', 2__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts', 'ContactsAddresses', 0, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 601__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/card.php?mainmenu=companies&leftmenu=contacts&action=create', 'NewContactAddress', 1, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 602__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 604__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=p', 'ThirdPartyProspects', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 605__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=c', 'ThirdPartyCustomers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))', __HANDLER__, 'left', 606__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=f', 'ThirdPartySuppliers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 607__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=o', 'Others', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 600__+MAX_llx_menu__, 'companies', 'contacts', 2__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts', 'ContactsAddresses', 0, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 601__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/card.php?mainmenu=companies&leftmenu=contacts&action=create', 'NewContactAddress', 1, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 602__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 604__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=p', 'ThirdPartyProspects', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 605__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=c', 'ThirdPartyCustomers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe") && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))', __HANDLER__, 'left', 606__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=f', 'ThirdPartySuppliers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 607__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=o', 'Others', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 4, __ENTITY__); -- Third parties - Category customer -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 650__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=1', 'SuppliersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 651__+MAX_llx_menu__, 'companies', '', 650__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=1', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe") && $conf->categorie->enabled', __HANDLER__, 'left', 650__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=1', 'SuppliersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe") && $conf->categorie->enabled', __HANDLER__, 'left', 651__+MAX_llx_menu__, 'companies', '', 650__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=1', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); -- Third parties - Category supplier insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '(isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $conf->categorie->enabled', __HANDLER__, 'left', 660__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=2', 'CustomersProspectsCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '(isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $conf->categorie->enabled', __HANDLER__, 'left', 661__+MAX_llx_menu__, 'companies', '', 660__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=2', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); -- Third parties - Category contact -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 670__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=4', 'ContactCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 671__+MAX_llx_menu__, 'companies', '', 670__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=4', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe") && $conf->categorie->enabled', __HANDLER__, 'left', 670__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=4', 'ContactCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe") && $conf->categorie->enabled', __HANDLER__, 'left', 671__+MAX_llx_menu__, 'companies', '', 670__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=4', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); -- Product - Product insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2800__+MAX_llx_menu__, 'products', 'product', 3__+MAX_llx_menu__, '/product/index.php?mainmenu=products&leftmenu=product&type=0', 'Products', 0, 'products', '$user->rights->produit->lire', '', 2, 0, __ENTITY__); diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index cdb67a2c37b..2d7d56ec65d 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -106,7 +106,7 @@ class ConferenceOrBooth extends ActionComm 'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'help'=>"OrganizationEvenLabelName", 'showoncombobox'=>'1',), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), 'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1), 'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width300'), diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 595eaf67eeb..f1e4fe2f3d5 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -108,7 +108,7 @@ class ConferenceOrBoothAttendee extends CommonObject 'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'autofocusoncreate'=>1, 'searchall'=>1), 'firstname' => array('type'=>'varchar(100)', 'label'=>'Firstname', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1), 'lastname' => array('type'=>'varchar(100)', 'label'=>'Lastname', 'enabled'=>'1', 'position'=>32, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), 'email_company' => array('type'=>'mail', 'label'=>'EmailCompany', 'enabled'=>'1', 'position'=>41, 'notnull'=>0, 'visible'=>-2, 'searchall'=>1), 'date_subscription' => array('type'=>'datetime', 'label'=>'DateOfRegistration', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1, 'showoncombobox'=>'1',), 'fk_invoice' => array('type'=>'integer:Facture:compta/facture/class/facture.class.php', 'label'=>'Invoice', 'enabled'=>'$conf->facture->enabled', 'position'=>57, 'notnull'=>0, 'visible'=>-1, 'index'=>0, 'picto'=>'bill', 'css'=>'tdoverflowmax150 maxwidth500'), diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index e36598d04bc..a7c3e43f599 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -38,7 +38,7 @@ class Fichinter extends CommonObject { public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>15), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>15), 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'isModEnabled("project")', 'visible'=>-1, 'position'=>20), 'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>'$conf->contrat->enabled', 'visible'=>-1, 'position'=>25), 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30), diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 4fc242bdbcc..0cfff5a8297 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -254,7 +254,7 @@ class CommandeFournisseur extends CommonOrder 'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>235), 'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>240), 'date_creation' =>array('type'=>'datetime', 'label'=>'Date creation', 'enabled'=>1, 'visible'=>-1, 'position'=>500), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>1, 'notnull'=>1, 'position'=>46), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>1, 'notnull'=>1, 'position'=>46), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>1000, 'index'=>1), 'tms'=>array('type'=>'datetime', 'label'=>"DateModificationShort", 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>501), 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>0, 'position'=>700), diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 738e27a84e9..53066afc0b7 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -181,7 +181,7 @@ class FactureFournisseurRec extends CommonInvoice 'titre' =>array('type'=>'varchar(100)', 'label'=>'Titre', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>15), 'ref_supplier' =>array('type'=>'varchar(180)', 'label'=>'RefSupplier', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>20), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>25, 'index'=>1), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>30), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>30), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>35), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>40), 'suspended' =>array('type'=>'integer', 'label'=>'Suspended', 'enabled'=>1, 'visible'=>-1, 'position'=>225), diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index adf9fac3bde..524b50a5061 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -275,7 +275,7 @@ class FactureFournisseur extends CommonInvoice 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>25, 'index'=>1), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>30), 'type' =>array('type'=>'smallint(6)', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>40), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>40), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>45), 'datef' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>50), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>55), diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 2fe7d983513..086420ef653 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -119,7 +119,7 @@ class MyObject extends CommonObject 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>'Help text', 'showoncombobox'=>2, 'validate'=>1, 'alwayseditable'=>1), 'amount' => array('type'=>'price', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount', 'validate'=>1), 'qty' => array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp', 'validate'=>1), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'OrganizationEventLinkToThirdParty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>'isModEnabled("societe")', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'OrganizationEventLinkToThirdParty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150'), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60, 'validate'=>1), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'validate'=>1, 'cssview'=>'wordbreak'), diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 8624713c689..1aaf51808b8 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -106,7 +106,7 @@ class Mo extends CommonObject 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:0', 'label'=>'Product', 'enabled'=>'$conf->product->enabled', 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce", 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax100', 'picto'=>'product'), 'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'comment'=>"Qty to produce", 'css'=>'width75', 'default'=>1, 'isameasure'=>1), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'2', 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200', 'alwayseditable'=>1), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax150'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax150'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>51, 'notnull'=>-1, 'index'=>1, 'css'=>'minwidth200 maxwidth400', 'csslist'=>'tdoverflowmax100'), 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'picto'=>'stock', 'enabled'=>'$conf->stock->enabled', 'visible'=>1, 'position'=>52, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax200'), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'notnull'=>-1,), diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 7a9d077f910..fb34e33376e 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -124,7 +124,7 @@ class RecruitmentJobPosition extends CommonObject 'email_recruiter' => array('type'=>'varchar(255)', 'label'=>'EmailRecruiter', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>-1, 'help'=>'ToUseAGenericEmail', 'picto'=>'email'), 'fk_user_supervisor' => array('type'=>'integer:User:user/class/user.class.php:t.statut = 1', 'label'=>'FutureManager', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'user.rowid', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150', 'picto'=>'user'), 'fk_establishment' => array('type'=>'integer:Establishment:hrm/class/establishment.class.php', 'label'=>'Establishment', 'enabled'=>'$conf->hrm->enabled', 'position'=>56, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'establishment.rowid',), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'WorkPlace', 'enabled'=>'$conf->societe->enabled', 'position'=>57, 'notnull'=>-1, 'visible'=>-1, 'css'=>'maxwidth500', 'index'=>1, 'help'=>"IfJobIsLocatedAtAPartner", 'picto'=>'company'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'WorkPlace', 'enabled'=>'isModEnabled("societe")', 'position'=>57, 'notnull'=>-1, 'visible'=>-1, 'css'=>'maxwidth500', 'index'=>1, 'help'=>"IfJobIsLocatedAtAPartner", 'picto'=>'company'), 'date_planned' => array('type'=>'date', 'label'=>'DateExpected', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1,), 'remuneration_suggested' => array('type'=>'varchar(255)', 'label'=>'Remuneration', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>1,), 'description' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>65, 'notnull'=>0, 'visible'=>3,), diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 2aacffefcd1..ac6abea95d3 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -280,7 +280,7 @@ class Ticket extends CommonObject 'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'help'=>"", 'csslist'=>'maxwidth125 tdoverflowmax50'), 'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketCategory', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100 tdoverflowmax200'), 'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>'isModEnabled("societe")', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), 'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-1, 'enabled'=>0, 'position'=>51, 'notnull'=>1, 'index'=>1), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>-1, 'enabled'=>'$conf->project->enabled', 'position'=>52, 'notnull'=>-1, 'index'=>1, 'help'=>"LinkToProject"), //'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""), // what is this ? From f6cde9507ec3bccabb1dc07b0e94e0ccec2195b2 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 11 Jan 2023 09:35:28 +0100 Subject: [PATCH 089/218] FIX : alias name in contact list --- htdocs/contact/list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index da07a2b699b..a025ef81b97 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -357,6 +357,9 @@ if (!empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES) $contactstatic->loadCacheOfProspStatus(); } +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + // Select every potentiels, and note each potentiels which fit in search parameters $tab_level = array(); $sql = "SELECT code, label, sortorder"; @@ -692,9 +695,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ( exit; } -$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas'; llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); @@ -1377,7 +1377,7 @@ while ($i < min($num, $limit)) { if ($obj->socid) { $objsoc = new Societe($db); $objsoc->fetch($obj->socid); - print $objsoc->getNomUrl(1); + print $objsoc->getNomUrl(1, '', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); } else { print ' '; } From c0a7bca04e173b6f4aa692f2dc2e0d2b6143bd7f Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 11 Jan 2023 10:50:58 +0100 Subject: [PATCH 090/218] Fix supplier reccurent invoice if no pdf model --- htdocs/fourn/class/fournisseur.facture-rec.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 31bc37b6e1a..024f6bf3e6f 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1331,7 +1331,7 @@ class FactureFournisseurRec extends CommonInvoice // We refresh the object in order to have all necessary data (like date_lim_reglement) $new_fac_fourn->fetch($new_fac_fourn->id); $result = $new_fac_fourn->generateDocument($facturerec->model_pdf, $langs); - if ($result <= 0) { + if ($result < 0) { $this->errors = $new_fac_fourn->errors; $this->error = $new_fac_fourn->error; $error++; From 7bcaae86f4b9656302a544805a316282e6591805 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 11 Jan 2023 13:33:29 +0100 Subject: [PATCH 091/218] Fix php 8 warning --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index d928931c9ab..e5c9dcb3127 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2514,7 +2514,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') print ''; } elseif ($value == 'type_duration') { print ''; - print $form->selectTypeDuration('', $obj->{$value}, array('i','h')); + print $form->selectTypeDuration('', (!empty($obj->{$value}) ? $obj->{$value}:''), array('i','h')); print ''; } else { $fieldValue = isset($obj->{$value}) ? $obj->{$value}: ''; From e820bb91c2662002e080c3e3796a8f6f1680e19d Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Wed, 11 Jan 2023 14:18:45 +0100 Subject: [PATCH 092/218] kanban view for localtax list --- .../compta/localtax/class/localtax.class.php | 34 ++++++++++++++ htdocs/compta/localtax/list.php | 44 ++++++++++++++----- 2 files changed, 68 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index ed467ec91f4..f5cb98c1199 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -629,4 +629,38 @@ class Localtax extends CommonObject return ''; } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs, $db; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if (property_exists($this, 'label')) { + $return .= ' | '.$this->label.''; + } + if (property_exists($this, 'datev')) { + $return .= '
'.$langs->trans("DateEnd").' : '.dol_print_date($db->jdate($this->datev), 'day').''; + } + if (property_exists($this, 'datep')) { + $return .= '
'.$langs->trans("DatePayment", '', '', '', '', 5).' : '.dol_print_date($db->jdate($this->datep), 'day').''; + } + if (property_exists($this, 'amount')) { + $return .= '
'.$langs->trans("Amount").' : '.price($this->amount).''; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/compta/localtax/list.php b/htdocs/compta/localtax/list.php index ee2e13e1d57..42f4d326811 100644 --- a/htdocs/compta/localtax/list.php +++ b/htdocs/compta/localtax/list.php @@ -35,7 +35,7 @@ if ($user->socid) { } $result = restrictedArea($user, 'tax', '', '', 'charges'); $ltt = GETPOST("localTaxType", 'int'); - +$mode = GETPOST('mode', 'alpha'); /* * View @@ -49,7 +49,14 @@ $url = DOL_URL_ROOT.'/compta/localtax/card.php?action=create&localTaxType='.$ltt if (!empty($socid)) { $url .= '&socid='.$socid; } -$newcardbutton = dolGetButtonTitle($langs->trans('NewLocalTaxPayment', ($ltt + 1)), '', 'fa fa-plus-circle', $url, '', $user->rights->tax->charges->creer); +$param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?localTaxType='.$ltt.'&mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?localTaxType='.$ltt.'&mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('NewLocalTaxPayment', ($ltt + 1)), '', 'fa fa-plus-circle', $url, '', $user->rights->tax->charges->creer); print load_fiche_titre($langs->transcountry($ltt == 2 ? "LT2Payments" : "LT1Payments", $mysoc->country_code), $newcardbutton, 'title_accountancy'); @@ -77,19 +84,36 @@ if ($result) { while ($i < $num) { $obj = $db->fetch_object($result); - print ''; - + $localtax_static->label = $obj->label; $localtax_static->id = $obj->rowid; $localtax_static->ref = $obj->rowid; - print "".$localtax_static->getNomUrl(1)."\n"; - print "".dol_trunc($obj->label, 40)."\n"; - print ''.dol_print_date($db->jdate($obj->datev), 'day')."\n"; - print ''.dol_print_date($db->jdate($obj->datep), 'day')."\n"; + $localtax_static->datev = $obj->datev; + $localtax_static->datep = $obj->datep; + $localtax_static->amount = $obj->amount; + $total = $total + $obj->amount; - print ''.price($obj->amount).''; - print "\n"; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban + print $localtax_static->getKanbanView(''); + if ($i == ($num - 1)) { + print '
'; + print ''; + } + } else { + print ''; + print "".$localtax_static->getNomUrl(1)."\n"; + print "".dol_trunc($obj->label, 40)."\n"; + print ''.dol_print_date($db->jdate($obj->datev), 'day')."\n"; + print ''.dol_print_date($db->jdate($obj->datep), 'day')."\n"; + print ''.price($obj->amount).''; + print "\n"; + } $i++; } print ''.$langs->trans("Total").''; From 91837dd2efc979721ed300807e827eb6d1c58da3 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Wed, 11 Jan 2023 15:03:55 +0100 Subject: [PATCH 093/218] kanban mode for list of salaries --- htdocs/salaries/class/salary.class.php | 34 ++++ htdocs/salaries/list.php | 217 ++++++++++++++----------- 2 files changed, 155 insertions(+), 96 deletions(-) diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 25adb60382c..72a228658d8 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -707,4 +707,38 @@ class Salary extends CommonObject return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs, $db; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'fk_user')) { + $return .= ' | '.$this->fk_user.''; + } + if (property_exists($this, 'type_payment')) { + $return .= '
'.$langs->trans("PaymentMode").' : '.$this->type_payment.''; + } + if (property_exists($this, 'amount')) { + $return .= '
'.$langs->trans("Amount").' : '.price($this->amount).''; + } + if (method_exists($this, 'LibStatut')) { + $return .= '
'.$this->LibStatut($this->paye, 5, $this->alreadypaid).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 361107005a6..edeafa94c6a 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -44,6 +44,8 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$mode = GETPOST('mode', 'alpha'); //for mode view + // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; @@ -315,6 +317,9 @@ llxHeader('', $title, $help_url); $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -379,11 +384,16 @@ print ''; print ''; print ''; print ''; +print ''; + $url = DOL_URL_ROOT.'/salaries/card.php?action=create'; if (!empty($socid)) { $url .= '&socid='.$socid; } +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); $newcardbutton = dolGetButtonTitle($langs->trans('NewSalaryPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->salaries->write); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'salary', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -534,121 +544,136 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $salstatic->ref = $obj->rowid; $salstatic->label = $obj->label; $salstatic->paye = $obj->paye; - $salstatic->datesp = $db->jdate($obj->datesp); - $salstatic->dateep = $db->jdate($obj->dateep); + $salstatic->datesp = $obj->datesp; + $salstatic->dateep = $obj->dateep; + $salstatic->amount = $obj->amount; + $salstatic->fk_user = $userstatic->getNomUrl(1); + $salstatic->type_payment = $obj->payment_code; - // Show here line of result - print ''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban + print $salstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + // Show here line of result + print ''; - // Ref - print "".$salstatic->getNomUrl(1)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } + // Ref + print "".$salstatic->getNomUrl(1)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } - // Label payment - print ''.dol_escape_htmltag($obj->label)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } + // Label payment + print ''.dol_escape_htmltag($obj->label)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } - // Date Start - print ''.dol_print_date($db->jdate($obj->datesp), 'day')."\n"; - if (!$i) { - $totalarray['nbfield']++; - } + // Date Start + print ''.dol_print_date($db->jdate($obj->datesp), 'day')."\n"; + if (!$i) { + $totalarray['nbfield']++; + } - // Date End - print ''.dol_print_date($db->jdate($obj->dateep), 'day')."\n"; - if (!$i) { - $totalarray['nbfield']++; - } + // Date End + print ''.dol_print_date($db->jdate($obj->dateep), 'day')."\n"; + if (!$i) { + $totalarray['nbfield']++; + } - // Employee - print ''.$userstatic->getNomUrl(1)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } + // Employee + print ''.$userstatic->getNomUrl(1)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } - // Type - print ''; - if (!empty($obj->payment_code)) print $langs->trans("PaymentTypeShort".$obj->payment_code); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - - // Account - if (isModEnabled("banque")) { + // Type print ''; - if ($obj->fk_account > 0) { - //$accountstatic->fetch($obj->fk_bank); - $accountstatic->id = $obj->bid; - $accountstatic->ref = $obj->bref; - $accountstatic->label = $obj->blabel; - $accountstatic->number = $obj->bnumber; - $accountstatic->iban = $obj->iban; - $accountstatic->bic = $obj->bic; - $accountstatic->currency_code = $langs->trans("Currency".$obj->currency_code); - $accountstatic->account_number = $obj->account_number; - $accountstatic->clos = $obj->clos; + if (!empty($obj->payment_code)) print $langs->trans("PaymentTypeShort".$obj->payment_code); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } - if (isModEnabled('accounting')) { + // Account + if (isModEnabled("banque")) { + print ''; + if ($obj->fk_account > 0) { + //$accountstatic->fetch($obj->fk_bank); + $accountstatic->id = $obj->bid; + $accountstatic->ref = $obj->bref; + $accountstatic->label = $obj->blabel; + $accountstatic->number = $obj->bnumber; + $accountstatic->iban = $obj->iban; + $accountstatic->bic = $obj->bic; + $accountstatic->currency_code = $langs->trans("Currency".$obj->currency_code); $accountstatic->account_number = $obj->account_number; + $accountstatic->clos = $obj->clos; - $accountingjournal = new AccountingJournal($db); - $accountingjournal->fetch($obj->fk_accountancy_journal); + if (isModEnabled('accounting')) { + $accountstatic->account_number = $obj->account_number; - $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch($obj->fk_accountancy_journal); + + $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); + } + //$accountstatic->label = $obj->blabel; + print $accountstatic->getNomUrl(1); + } else { + print ' '; } - //$accountstatic->label = $obj->blabel; - print $accountstatic->getNomUrl(1); - } else { - print ' '; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; + + // Amount + print ''.price($obj->amount).''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; + } + $totalarray['val']['totalttcfield'] += $obj->amount; + + print ''.$salstatic->LibStatut($obj->paye, 5, $obj->alreadypayed).''; + if (!$i) $totalarray['nbfield']++; + + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action column + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; } print ''; if (!$i) { $totalarray['nbfield']++; } + + print ''."\n"; } - - // if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; - - // Amount - print ''.price($obj->amount).''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; - } - $totalarray['val']['totalttcfield'] += $obj->amount; - - print ''.$salstatic->LibStatut($obj->paye, 5, $obj->alreadypayed).''; - if (!$i) $totalarray['nbfield']++; - - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Action column - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($object->id, $arrayofselected)) { - $selected = 1; - } - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - - print ''."\n"; - $i++; } From 7213595cef946f1c29b4516e2768586c710fe078 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Wed, 11 Jan 2023 15:19:21 +0100 Subject: [PATCH 094/218] modify kanban mode for list of salaries --- htdocs/salaries/class/salary.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 72a228658d8..7f9ea31cdc9 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -716,7 +716,7 @@ class Salary extends CommonObject */ public function getKanbanView($option = '') { - global $langs, $db; + global $langs; $return = '
'; $return .= '
'; $return .= ''; From a410100496dc54a16b4c713fff44d2e098bdba9a Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Wed, 11 Jan 2023 15:23:12 +0100 Subject: [PATCH 095/218] modify variable in class localtax --- htdocs/compta/localtax/class/localtax.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index f5cb98c1199..d2300128550 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -638,7 +638,7 @@ class Localtax extends CommonObject */ public function getKanbanView($option = '') { - global $langs, $db; + global $langs; $return = '
'; $return .= '
'; $return .= ''; @@ -650,10 +650,10 @@ class Localtax extends CommonObject $return .= ' | '.$this->label.''; } if (property_exists($this, 'datev')) { - $return .= '
'.$langs->trans("DateEnd").' : '.dol_print_date($db->jdate($this->datev), 'day').''; + $return .= '
'.$langs->trans("DateEnd").' : '.dol_print_date($this->db->jdate($this->datev), 'day').''; } if (property_exists($this, 'datep')) { - $return .= '
'.$langs->trans("DatePayment", '', '', '', '', 5).' : '.dol_print_date($db->jdate($this->datep), 'day').''; + $return .= '
'.$langs->trans("DatePayment", '', '', '', '', 5).' : '.dol_print_date($this->db->jdate($this->datep), 'day').''; } if (property_exists($this, 'amount')) { $return .= '
'.$langs->trans("Amount").' : '.price($this->amount).''; From cfb16cc9cd296553c5acf9141941b1e25901ed46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Courtier?= Date: Wed, 11 Jan 2023 16:49:59 +0100 Subject: [PATCH 096/218] FIX: ref not available after ecmFile create() --- htdocs/ecm/class/ecmfiles.class.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index a451a462ea3..d6c906527f4 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -240,12 +240,9 @@ class EcmFiles extends CommonObject } // If ref not defined - $ref = ''; - if (!empty($this->ref)) { - $ref = $this->ref; - } else { + if (empty($this->ref)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; - $ref = dol_hash($this->filepath.'/'.$this->filename, 3); + $this->ref = dol_hash($this->filepath.'/'.$this->filename, 3); } $maxposition = 0; @@ -300,7 +297,7 @@ class EcmFiles extends CommonObject $sql .= 'src_object_type,'; $sql .= 'src_object_id'; $sql .= ') VALUES ('; - $sql .= " '".$this->db->escape($ref)."', "; + $sql .= " '".$this->db->escape($this->ref)."', "; $sql .= ' '.(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'").','; $sql .= ' '.(!isset($this->share) ? 'NULL' : "'".$this->db->escape($this->share)."'").','; $sql .= ' '.$this->entity.','; From 62d33484715766b6c22ef3788327cc27d2d3052d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Jan 2023 16:56:06 +0100 Subject: [PATCH 097/218] Make module Paybox deprecated --- htdocs/core/modules/modPaybox.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modPaybox.class.php b/htdocs/core/modules/modPaybox.class.php index cf6ef512873..3df0b8f6a1d 100644 --- a/htdocs/core/modules/modPaybox.class.php +++ b/htdocs/core/modules/modPaybox.class.php @@ -54,7 +54,7 @@ class modPayBox extends DolibarrModules // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "Module to offer an online payment page by credit card with PayBox"; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = 'dolibarr'; + $this->version = 'dolibarr_deprecated'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Name of image file used for this module. From 2eb054a170fcc4706ab42a94c0a0e569efde6d1a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Jan 2023 17:06:23 +0100 Subject: [PATCH 098/218] Fix try fix function not found of qodana --- htdocs/api/index.php | 12 ++++++------ htdocs/core/class/dolgeoip.class.php | 6 ++++-- htdocs/core/class/translate.class.php | 6 ++++-- htdocs/core/lib/files.lib.php | 6 +++--- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/htdocs/api/index.php b/htdocs/api/index.php index ba195b82c08..4e4da2c94cc 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -389,13 +389,13 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' && $usecompression = (empty($conf->global->API_DISABLE_COMPRESSION) && !empty($_SERVER['HTTP_ACCEPT_ENCODING'])); $foundonealgorithm = 0; if ($usecompression) { - if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && is_callable('brotli_compress')) { + if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && function_exists('brotli_compress')) { $foundonealgorithm++; } - if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && is_callable('bzcompress')) { + if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && function_exists('bzcompress')) { $foundonealgorithm++; } - if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && is_callable('gzencode')) { + if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && function_exists('gzencode')) { $foundonealgorithm++; } if (!$foundonealgorithm) { @@ -413,13 +413,13 @@ $result = $api->r->handle(); if (Luracast\Restler\Defaults::$returnResponse) { // We try to compress the data received data - if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && is_callable('brotli_compress') && defined('BROTLI_TEXT')) { + if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && function_exists('brotli_compress') && defined('BROTLI_TEXT')) { header('Content-Encoding: br'); $result = brotli_compress($result, 11, constant('BROTLI_TEXT')); - } elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && is_callable('bzcompress')) { + } elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && function_exists('bzcompress')) { header('Content-Encoding: bz'); $result = bzcompress($result, 9); - } elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && is_callable('gzencode')) { + } elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && function_exists('gzencode')) { header('Content-Encoding: gzip'); $result = gzencode($result, 9); } else { diff --git a/htdocs/core/class/dolgeoip.class.php b/htdocs/core/class/dolgeoip.class.php index a2eea7023d9..e5001270131 100644 --- a/htdocs/core/class/dolgeoip.class.php +++ b/htdocs/core/class/dolgeoip.class.php @@ -144,10 +144,12 @@ class DolGeoIP return ''; } } else { - if (!function_exists('geoip_country_code_by_addr_v6')) { + if (function_exists('geoip_country_code_by_addr_v6')) { + return strtolower(geoip_country_code_by_addr_v6($this->gi, $ip)); + } elseif (function_exists('geoip_country_code_by_name_v6')) { return strtolower(geoip_country_code_by_name_v6($this->gi, $ip)); } - return strtolower(geoip_country_code_by_addr_v6($this->gi, $ip)); + return ''; } } } diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 3f2f756977d..2315428b37a 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -932,8 +932,10 @@ class Translate $fonc = 'numberwords'; if (file_exists($newdir.'/functions_'.$fonc.'.lib.php')) { include_once $newdir.'/functions_'.$fonc.'.lib.php'; - $newnumber = numberwords_getLabelFromNumber($this, $number, $isamount); - break; + if (function_exists('numberwords_getLabelFromNumber')) { + $newnumber = numberwords_getLabelFromNumber($this, $number, $isamount); + break; + } } } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index ad7d7cecfa5..207f5bafeb7 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2058,13 +2058,13 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring dol_syslog("dol_compress_file mode=".$mode." inputfile=".$inputfile." outputfile=".$outputfile); $data = implode("", file(dol_osencode($inputfile))); - if ($mode == 'gz') { + if ($mode == 'gz' && function_exists('gzencode')) { $foundhandler = 1; $compressdata = gzencode($data, 9); - } elseif ($mode == 'bz') { + } elseif ($mode == 'bz' && function_exists('bzcompress')) { $foundhandler = 1; $compressdata = bzcompress($data, 9); - } elseif ($mode == 'zstd') { + } elseif ($mode == 'zstd' && function_exists('zstd_compress')) { $foundhandler = 1; $compressdata = zstd_compress($data, 9); } elseif ($mode == 'zip') { From 356923b3695bd1ef773dd7789da6c04c7ea71394 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Wed, 11 Jan 2023 17:31:37 +0100 Subject: [PATCH 099/218] FIX 14.0: move splitting of module:submodule string out of the genallowed condition --- htdocs/core/class/html.formfile.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 6fe10788c54..c1438209d5e 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -463,6 +463,15 @@ class FormFile $titletoshow = ($title == 'none' ? '' : $title); } + $submodulepart = $modulepart; + + // modulepart = 'nameofmodule' or 'nameofmodule:NameOfObject' + $tmp = explode(':', $modulepart); + if (!empty($tmp[1])) { + $modulepart = $tmp[0]; + $submodulepart = $tmp[1]; + } + // Show table if ($genallowed) { $modellist = array(); @@ -662,15 +671,6 @@ class FormFile $modellist = ModelePDFUserGroup::liste_modeles($this->db); } } else { - $submodulepart = $modulepart; - - // modulepart = 'nameofmodule' or 'nameofmodule:NameOfObject' - $tmp = explode(':', $modulepart); - if (!empty($tmp[1])) { - $modulepart = $tmp[0]; - $submodulepart = $tmp[1]; - } - // For normalized standard modules $file = dol_buildpath('/core/modules/'.$modulepart.'/modules_'.strtolower($submodulepart).'.php', 0); if (file_exists($file)) { From 87d2e86abac222b85298746eb33cb56f227c3c81 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Wed, 11 Jan 2023 17:39:46 +0100 Subject: [PATCH 100/218] kanban mode for pyment salaries list --- htdocs/salaries/class/paymentsalary.class.php | 35 +++ htdocs/salaries/payments.php | 247 ++++++++++-------- 2 files changed, 176 insertions(+), 106 deletions(-) diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index 029e5732f9b..b855462b527 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -707,4 +707,39 @@ class PaymentSalary extends CommonObject return $result; } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs, $db; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'fk_bank')) { + $return .= ' | '.$this->fk_bank.''; + } + if (property_exists($this, 'fk_user_author')) { + $return .= '
'.$this->fk_user_author.''; + } + + if (property_exists($this, 'fk_typepayment')) { + $return .= '
'.$langs->trans("PaymentMode").' : '.$this->fk_typepayment.''; + } + if (property_exists($this, 'amount')) { + $return .= '
'.$langs->trans("Amount").' : '.price($this->amount).''; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index 8fcc7183dae..6fb41b1b38a 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -45,6 +45,8 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomlist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$mode = GETPOST('mode', 'alpha'); // mode view for result + // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; @@ -316,6 +318,9 @@ llxHeader('', $title, $help_url); $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -385,11 +390,16 @@ print ''; print ''; print ''; print ''; +print ''; + $url = DOL_URL_ROOT.'/salaries/card.php?action=create'; if (!empty($socid)) { $url .= '&socid='.$socid; } +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); $newcardbutton = dolGetButtonTitle($langs->trans('NewSalaryPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->salaries->write); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -532,8 +542,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); - // Show here line of result - print ''; + $userstatic->id = $obj->uid; $userstatic->lastname = $obj->lastname; @@ -549,136 +558,162 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $paymentsalstatic->id = $obj->rowid; $paymentsalstatic->ref = $obj->rowid; + $paymentsalstatic->amount = $obj->amount; + $paymentsalstatic->fk_typepayment = $obj->payment_code; + $paymentsalstatic->datec = $obj->dateep; + $paymentsalstatic->datep = $obj->datep; - // Ref - print "".$paymentsalstatic->getNomUrl(1)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } + $accountlinestatic->id = $obj->fk_bank; + $accountlinestatic->ref = $obj->fk_bank; + $paymentsalstatic->fk_bank = $accountlinestatic->getNomUrl(1); + $paymentsalstatic->fk_user_author = $userstatic->getNomUrl(1); - // Ref salary - print "".$salstatic->getNomUrl(1)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - // Label payment - print "".dol_trunc($obj->label, 40)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - // Date end period - print ''.dol_print_date($db->jdate($obj->dateep), 'day')."\n"; - if (!$i) { - $totalarray['nbfield']++; - } + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban - // Date payment - print ''.dol_print_date($db->jdate($obj->datep), 'day')."\n"; - if (!$i) { - $totalarray['nbfield']++; - } + print $paymentsalstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + // Show here line of result + print ''; + // Ref + print "".$paymentsalstatic->getNomUrl(1)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } - // Date value - /*print ''.dol_print_date($db->jdate($obj->datev), 'day')."\n"; - if (!$i) $totalarray['nbfield']++;*/ + // Ref salary + print "".$salstatic->getNomUrl(1)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } - // Employee - print "".$userstatic->getNomUrl(1)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } + // Label payment + print "".dol_trunc($obj->label, 40)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } - // Type - print ''; - print $langs->trans("PaymentTypeShort".$obj->payment_code); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } + // Date end period + print ''.dol_print_date($db->jdate($obj->dateep), 'day')."\n"; + if (!$i) { + $totalarray['nbfield']++; + } - // Chq number - print ''.$obj->num_payment.''; - if (!$i) { - $totalarray['nbfield']++; - } + // Date payment + print ''.dol_print_date($db->jdate($obj->datep), 'day')."\n"; + if (!$i) { + $totalarray['nbfield']++; + } - // Account - if (isModEnabled("banque")) { - // Bank transaction + // Date value + /*print ''.dol_print_date($db->jdate($obj->datev), 'day')."\n"; + if (!$i) $totalarray['nbfield']++;*/ + + // Employee + print "".$userstatic->getNomUrl(1)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + + // Type print ''; - $accountlinestatic->id = $obj->fk_bank; - print $accountlinestatic->getNomUrl(1); + print $langs->trans("PaymentTypeShort".$obj->payment_code); print ''; if (!$i) { $totalarray['nbfield']++; } - print ''; - if ($obj->fk_bank > 0) { - //$accountstatic->fetch($obj->fk_bank); - $accountstatic->id = $obj->bid; - $accountstatic->ref = $obj->bref; - $accountstatic->number = $obj->bnumber; - $accountstatic->iban = $obj->iban; - $accountstatic->bic = $obj->bic; - $accountstatic->currency_code = $langs->trans("Currency".$obj->currency_code); - $accountstatic->clos = $obj->clos; + // Chq number + print ''.$obj->num_payment.''; + if (!$i) { + $totalarray['nbfield']++; + } - if (isModEnabled('accounting')) { - $accountstatic->account_number = $obj->account_number; - - $accountingjournal = new AccountingJournal($db); - $accountingjournal->fetch($obj->fk_accountancy_journal); - - $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); + // Account + if (isModEnabled("banque")) { + // Bank transaction + print ''; + $accountlinestatic->id = $obj->fk_bank; + print $accountlinestatic->getNomUrl(1); + print ''; + if (!$i) { + $totalarray['nbfield']++; } - $accountstatic->label = $obj->blabel; - if ($accountstatic->id > 0) { - print $accountstatic->getNomUrl(1); + + print ''; + if ($obj->fk_bank > 0) { + //$accountstatic->fetch($obj->fk_bank); + $accountstatic->id = $obj->bid; + $accountstatic->ref = $obj->bref; + $accountstatic->number = $obj->bnumber; + $accountstatic->iban = $obj->iban; + $accountstatic->bic = $obj->bic; + $accountstatic->currency_code = $langs->trans("Currency".$obj->currency_code); + $accountstatic->clos = $obj->clos; + + if (isModEnabled('accounting')) { + $accountstatic->account_number = $obj->account_number; + + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch($obj->fk_accountancy_journal); + + $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); + } + $accountstatic->label = $obj->blabel; + if ($accountstatic->id > 0) { + print $accountstatic->getNomUrl(1); + } + } else { + print ' '; } - } else { - print ' '; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Amount + print ''.price($obj->amount).''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; + } + $totalarray['val']['totalttcfield'] += $obj->amount; + + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action column + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; } print ''; if (!$i) { $totalarray['nbfield']++; } - } - // Amount - print ''.price($obj->amount).''; - if (!$i) { - $totalarray['nbfield']++; + print ''."\n"; } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; - } - $totalarray['val']['totalttcfield'] += $obj->amount; - - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Action column - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($object->id, $arrayofselected)) { - $selected = 1; - } - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - - print ''."\n"; - $i++; } From 45725a1e9743d1840c9589982fce04be4bf3008c Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 11 Jan 2023 17:58:26 +0100 Subject: [PATCH 101/218] fix: display True volume in PDF --- htdocs/core/modules/expedition/doc/pdf_espadon.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 17999e59e4c..97be43da689 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -832,7 +832,7 @@ class pdf_espadon extends ModelePdfExpedition $totalToShip = $tmparray['toship']; // Set trueVolume and volume_units not currently stored into database if ($object->trueWidth && $object->trueHeight && $object->trueDepth) { - $object->trueVolume = price(($object->trueWidth * $object->trueHeight * $object->trueDepth), 0, $outputlangs, 0, 0); + $object->trueVolume = $object->trueWidth * $object->trueHeight * $object->trueDepth; $object->volume_units = $object->size_units * 3; } From 7cd1ea4962c46a65913c210d9952da1285de559d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Jan 2023 20:37:29 +0100 Subject: [PATCH 102/218] Fix phpcs --- htdocs/salaries/payments.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index 84e146c0bd2..5a5ccb08bf6 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -592,12 +592,11 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $totalarray['nbfield']++; } - // Date payment - print ''.dol_print_date($db->jdate($obj->datep), 'dayhour', 'tzuserrel')."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - + // Date payment + print ''.dol_print_date($db->jdate($obj->datep), 'dayhour', 'tzuserrel')."\n"; + if (!$i) { + $totalarray['nbfield']++; + } // Ref salary print "".$salstatic->getNomUrl(1)."\n"; From 4afc21ecb3bad84f1cddafbda7cf9cb8277693f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Jan 2023 20:39:09 +0100 Subject: [PATCH 103/218] Update dict.php --- htdocs/admin/dict.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index e5c9dcb3127..1bf360dccf7 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2510,11 +2510,11 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') print ''; } elseif ($value == 'block_if_negative') { print ''; - print $form->selectyesno("block_if_negative", (!empty($obj->{$value}) ? $obj->{$value}:''), 1); + print $form->selectyesno("block_if_negative", (empty($obj->block_if_negative) ? '' : $obj->block_if_negative), 1); print ''; } elseif ($value == 'type_duration') { print ''; - print $form->selectTypeDuration('', (!empty($obj->{$value}) ? $obj->{$value}:''), array('i','h')); + print $form->selectTypeDuration('', empty($obj->type_duration) ? '' : $obj->type_duration), array('i','h')); print ''; } else { $fieldValue = isset($obj->{$value}) ? $obj->{$value}: ''; From 71ea83d19e1886f81836d2d79c71aadcf20e5cad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Jan 2023 20:40:15 +0100 Subject: [PATCH 104/218] Update dict.php --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 1bf360dccf7..4919e377c9c 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2514,7 +2514,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') print ''; } elseif ($value == 'type_duration') { print ''; - print $form->selectTypeDuration('', empty($obj->type_duration) ? '' : $obj->type_duration), array('i','h')); + print $form->selectTypeDuration('', (empty($obj->type_duration) ? '' : $obj->type_duration), array('i','h')); print ''; } else { $fieldValue = isset($obj->{$value}) ? $obj->{$value}: ''; From 0303dff199543c3a3b4d5083afc861213fc93a89 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Jan 2023 20:51:55 +0100 Subject: [PATCH 105/218] Merge --- .../class/companybankaccount.class.php | 61 +++++++++++++------ htdocs/societe/paymentmodes.php | 4 +- 2 files changed, 47 insertions(+), 18 deletions(-) diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 26305bb0013..26a6169dbe6 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -35,6 +35,17 @@ class CompanyBankAccount extends Account { public $socid; + /** + * @var string ID to identify managed object + */ + public $element = 'societe_rib'; + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'societe_rib'; + + /** @var bool $default_rib 1 = this object is the third party's default bank information */ public $default_rib; /** @@ -64,6 +75,13 @@ class CompanyBankAccount extends Account */ public $datem; + /** + * @var string TRIGGER_PREFIX Dolibarr 16.0 and above use the prefix to prevent the creation of inconsistently + * named triggers + * @see CommonObject::call_trigger() + */ + const TRIGGER_PREFIX = 'COMPANY_RIB'; + /** * Constructor @@ -86,7 +104,7 @@ class CompanyBankAccount extends Account * * @param User $user User * @param int $notrigger 1=Disable triggers - * @return int <0 if KO, >= 0 if OK + * @return int <0 if KO, > 0 if OK (ID of newly created company bank account information) */ public function create(User $user = null, $notrigger = 0) { @@ -97,6 +115,7 @@ class CompanyBankAccount extends Account // Check paramaters if (empty($this->socid)) { $this->error = 'BadValueForParameter'; + $this->errors[] = $this->error; return -1; } @@ -114,6 +133,9 @@ class CompanyBankAccount extends Account } } + + $this->db->begin(); + $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, type, datec)"; $sql .= " VALUES (".((int) $this->socid).", 'ban', '".$this->db->idate($now)."')"; $resql = $this->db->query($sql); @@ -128,19 +150,20 @@ class CompanyBankAccount extends Account $error++; } // End call triggers - - if (!$error) { - return $this->id; - } else { - return 0; - } - } else { - return 1; } } } else { + $error++; $this->error = $this->db->lasterror(); - return 0; + $this->errors[] = $this->error; + } + + if (!$error) { + $this->db->commit(); + return $this->id; + } else { + $this->db->rollback(); + return -1; } } @@ -168,6 +191,8 @@ class CompanyBankAccount extends Account $this->owner_address = dol_trunc($this->owner_address, 254, 'right', 'UTF-8', 1); } + $this->db->begin(); + $sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET"; $sql .= " bank = '".$this->db->escape($this->bank)."'"; $sql .= ",code_banque='".$this->db->escape($this->code_banque)."'"; @@ -203,20 +228,22 @@ class CompanyBankAccount extends Account $error++; } // End call triggers - if (!$error) { - return 1; - } else { - return -1; - } - } else { - return 1; } } else { + $error++; if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $this->error = $langs->trans('ErrorDuplicateField'); } else { $this->error = $this->db->lasterror(); } + $this->errors[] = $this->error; + } + + if (!$error) { + $this->db->commit(); + return 1; + } else { + $this->db->rollback(); return -1; } } diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 6869e80bd87..744d2763b71 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -183,8 +183,10 @@ if (empty($reshook)) { $companybankaccount->stripe_card_ref = GETPOST('stripe_card_ref', 'alpha'); $result = $companybankaccount->update($user); - if (!$result) { + if ($result <= 0) { + // Display error message and get back to edit mode setEventMessages($companybankaccount->error, $companybankaccount->errors, 'errors'); + $action = 'edit'; } else { // If this account is the default bank account, we disable others if ($companybankaccount->default_rib) { From e4c5fee8df10824a36e9fc71c7bfe7dfc4f41e9c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Jan 2023 21:04:30 +0100 Subject: [PATCH 106/218] Fix hardcoded link. Fix from #23463 --- htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php index 192a39c9b06..e2e9fb5f899 100644 --- a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php @@ -46,7 +46,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { ?> trans("SupplierOrder"); ?> - trans("ShowOrder"), "order").' '.$objectlink->ref; ?> + getNomUrl(1); ?> ref_supplier; ?> date, 'day'); ?> Date: Sun, 8 Jan 2023 21:43:12 +0100 Subject: [PATCH 107/218] Fix: REST MO API - It's able to have a wrong value on the 'ref' Field --- htdocs/mrp/class/api_mos.class.php | 28 ++++++++++++++++++++++++++++ htdocs/mrp/class/mo.class.php | 1 + 2 files changed, 29 insertions(+) diff --git a/htdocs/mrp/class/api_mos.class.php b/htdocs/mrp/class/api_mos.class.php index 48396025957..794ab3d5378 100644 --- a/htdocs/mrp/class/api_mos.class.php +++ b/htdocs/mrp/class/api_mos.class.php @@ -203,6 +203,9 @@ class Mos extends DolibarrApi foreach ($request_data as $field => $value) { $this->mo->$field = $value; } + + $this->checkRefNumbering(); + if (!$this->mo->create(DolibarrApiAccess::$user)) { throw new RestException(500, "Error creating MO", array_merge(array($this->mo->error), $this->mo->errors)); } @@ -239,6 +242,8 @@ class Mos extends DolibarrApi $this->mo->$field = $value; } + $this->checkRefNumbering(); + if ($this->mo->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); } else { @@ -723,4 +728,27 @@ class Mos extends DolibarrApi } return $myobject; } + + /** + * Validate the ref field and get the next Number if it's necessary. + * + * @return void + */ + private function checkRefNumbering(): void + { + $ref = substr($this->mo->ref, 1, 4); + if ($this->mo->status > 0 && $ref == 'PROV') { + throw new RestException(400, "Wrong naming scheme '(PROV%)' is only allowed on 'DRAFT' status. For automatic increment use 'auto' on the 'ref' field."); + } + + if (strtolower($this->mo->ref) == 'auto') { + if (empty($this->mo->id) && $this->mo->status == 0) { + $this->mo->ref = ''; // 'ref' will auto incremented with '(PROV' + newID + ')' + } else { + $this->mo->fetch_product(); + $numref = $this->mo->getNextNumRef($this->mo->product); + $this->mo->ref = $numref; + } + } + } } diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 30d6a3660a3..13d0f67316c 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -277,6 +277,7 @@ class Mo extends CommonObject if ($this->fk_bom > 0) { // If there is a nown BOM, we force the type of MO to the type of BOM + include_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; $tmpbom = new BOM($this->db); $tmpbom->fetch($this->fk_bom); From db56ef90903460c254e9d0bb742de3c15f0adb9c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Jan 2023 21:32:01 +0100 Subject: [PATCH 108/218] Fix sql error --- htdocs/accountancy/class/bookkeeping.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index f880ac6481c..897f60e8aaa 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1168,8 +1168,10 @@ class BookKeeping extends CommonObject $sql = 'SELECT'; $sql .= " t.numero_compte,"; $sql .= " t.label_compte,"; - $sql .= " t.subledger_account,"; - $sql .= " t.subledger_label,"; + if (!empty($option)) { + $sql .= " t.subledger_account,"; + $sql .= " t.subledger_label,"; + } $sql .= " SUM(t.debit) as debit,"; $sql .= " SUM(t.credit) as credit"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; @@ -1210,11 +1212,11 @@ class BookKeeping extends CommonObject if (!empty($option)) { $sql .= ' AND t.subledger_account IS NOT NULL'; $sql .= ' AND t.subledger_account != ""'; - $sql .= ' GROUP BY t.subledger_account'; + $sql .= ' GROUP BY t.numero_compte, t.label_compte, t.subledger_account, t.subledger_label'; $sortfield = 't.subledger_account'.($sortfield ? ','.$sortfield : ''); $sortorder = 'ASC'.($sortfield ? ','.$sortfield : ''); } else { - $sql .= ' GROUP BY t.numero_compte'; + $sql .= ' GROUP BY t.numero_compte, t.label_compte'; $sortfield = 't.numero_compte'.($sortfield ? ','.$sortfield : ''); $sortorder = 'ASC'.($sortorder ? ','.$sortorder : ''); } From 968c50d6f9281ba0705c6e88367580e3cc0b0104 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 12 Jan 2023 09:49:12 +0100 Subject: [PATCH 109/218] FIX wrong stock list with multicompany and without stock sharing --- htdocs/product/reassort.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 79498562210..626d4e81ee2 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -141,7 +141,6 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product'; -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e ON s.fk_entrepot = e.rowid AND e.entity IN ('.getEntity('stock').')'; if (!empty($conf->global->PRODUCT_USE_UNITS)) { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_units as u on p.fk_unit = u.rowid'; } @@ -150,6 +149,7 @@ if ($search_categ > 0) { $sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp"; } $sql .= " WHERE p.entity IN (".getEntity('product').")"; +$sql .= " AND EXISTS (SELECT e.rowid FROM ".MAIN_DB_PREFIX."entrepot as e WHERE e.rowid = s.fk_entrepot AND e.entity IN (".getEntity('stock')."))"; if ($search_categ > 0) { $sql .= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ } From f251e92eaa54ad11559f3a9eab604aa9f2accf41 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2023 10:10:28 +0100 Subject: [PATCH 110/218] Fix warning --- htdocs/admin/modulehelp.php | 5 ++++- htdocs/core/modules/DolibarrModules.class.php | 4 ++-- htdocs/public/members/new.php | 3 --- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index 9a0c34aea2b..1af4b25bb27 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -498,7 +498,10 @@ if ($mode == 'feature') { if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes)) { $i = 0; foreach ($objMod->boxes as $val) { - $text .= ($i ? ', ' : '').($val['file'] ? $val['file'] : $val[0]); + $boxstring = (empty($val['file']) ? (empty($val[0]) ? '' : $val[0]) : $val['file']); + if ($boxstring) { + $text .= ($i ? ', ' : '').$boxstring; + } $i++; } } else { diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index f88a05bd12b..96c8d14da31 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -976,8 +976,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $tmp = json_decode($obj->note, true); } return array( - 'authorid' => $tmp['authorid'], - 'ip' => $tmp['ip'], + 'authorid' => empty($tmp['authorid']) ? '' : $tmp['authorid'], + 'ip' => empty($tmp['ip']) ? '' : $tmp['ip'], 'lastactivationdate' => $this->db->jdate($obj->tms), 'lastactivationversion' => (!empty($tmp['lastactivationversion']) ? $tmp['lastactivationversion'] : 'unknown'), ); diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index b37cb15d9c0..7c3e5754b23 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -46,9 +46,6 @@ if (!defined('NOLOGIN')) { if (!defined('NOCSRFCHECK')) { define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. } -if (!defined('NOIPCHECK')) { - define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -} if (!defined('NOBROWSERNOTIF')) { define('NOBROWSERNOTIF', '1'); } From 2093be9895b56ac4042c09cbdd40b9e911bfc7fd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2023 11:34:28 +0100 Subject: [PATCH 111/218] New add file .idea/php.xml for qodana --- .idea/php.xml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .idea/php.xml diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 00000000000..52e0bf0ae03 --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,5 @@ + + + + + From 1ed1ff953f618c4de5fa30a7ef8103d33d172aad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2023 11:40:24 +0100 Subject: [PATCH 112/218] Fix .gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 55a4c417ce7..e9603bd2d8f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,6 @@ default.properties /.pydevproject /.vscode .DS_Store -.idea *.iml *.orig Thumbs.db From 366abff4f9956281628ad7feeba0db9976381772 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2023 11:43:10 +0100 Subject: [PATCH 113/218] Avoid qodana error email --- qodana.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qodana.yaml b/qodana.yaml index 89cc459fdfa..44da591f9de 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -1,6 +1,6 @@ version: "1.0" linter: jetbrains/qodana-php:2022.3-eap -failThreshold: 0 +failThreshold: 20000 profile: name: qodana.recommended exclude: From 1e36b45791634e6668ccd3fe80efc502081544ac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2023 11:58:32 +0100 Subject: [PATCH 114/218] Fix missing entity --- htdocs/product/reassortlot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index 40c8fcf4292..1dc632bf13d 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -227,7 +227,7 @@ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as ps on p.rowid = ps.fk_pro $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e on ps.fk_entrepot = e.rowid'; // Link on unique key $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_batch as pb on pb.fk_product_stock = ps.rowid'; // Detail for each lot on each warehouse $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl on pl.fk_product = p.rowid AND pl.batch = pb.batch'; // Link on unique key -$sql .= " WHERE p.entity IN (".getEntity('product').")"; +$sql .= " WHERE p.entity IN (".getEntity('product').") AND e.entity IN (".getEntity('stock').")"; if (!empty($search_categ) && $search_categ != '-1') { $sql .= " AND "; if ($search_categ == -2) { From efe1d913a7e3b470bfcff39722b87d79be2257bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2023 12:06:02 +0100 Subject: [PATCH 115/218] Fix MAIN_CHECKBOX_LEFT_COLUMN --- htdocs/product/reassort.php | 36 ++++++++++++++++++++++++++++------ htdocs/product/reassortlot.php | 25 +++++++++++++++++++++-- 2 files changed, 53 insertions(+), 8 deletions(-) diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index fb74b4ed297..b91ae62f663 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -363,6 +363,13 @@ if ($resql) { // Fields title search print ''; + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + print ''; + } print ''; print ''; print ''; @@ -391,14 +398,20 @@ if ($resql) { $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print ''; - $searchpicto = $form->showFilterAndCheckAddButtons(0); - print $searchpicto; - print ''; + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + print ''; + } print ''; //Line for column titles print ""; + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print_liste_field_titre(''); + } print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", '', $param, "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", '', $param, "", $sortfield, $sortorder); if (isModEnabled("service") && $type == 1) { @@ -429,7 +442,10 @@ if ($resql) { $parameters = array('param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print_liste_field_titre(''); + // Action column + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print_liste_field_titre(''); + } print "\n"; while ($i < min($num, $limit)) { @@ -440,6 +456,10 @@ if ($resql) { $product->load_stock(); print ''; + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } print ''; print $product->getNomUrl(1, '', 16); //if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow")); @@ -504,7 +524,11 @@ if ($resql) { $parameters = array('obj'=>$objp); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $product); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print ''; + // Action column + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } + print "\n"; $i++; } diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index 1dc632bf13d..c07f0785e2c 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -514,6 +514,13 @@ print ''; +// Action column +if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; +} print ''; @@ -571,6 +578,10 @@ $totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print ''; +// Action column +if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print_liste_field_titre(''); +} print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", '', $param, "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", '', $param, "", $sortfield, $sortorder); if (isModEnabled("service") && $type == 1) { @@ -591,7 +602,9 @@ print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stock_physique", print_liste_field_titre(''); print_liste_field_titre("ProductStatusOnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("ProductStatusOnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'right '); -print_liste_field_titre(''); +if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print_liste_field_titre(''); +} print "\n"; $product_static = new Product($db); @@ -648,6 +661,11 @@ while ($i < $imaxinloop) { print ''; + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } + // Ref print ''; - print ''; + // Action column + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } print "\n"; $i++; From 24651aaa6c060ebaf1d7ad407713a6343c92aaaa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2023 12:41:02 +0100 Subject: [PATCH 116/218] FIX #22731 #23524 --- htdocs/commande/list.php | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index ed00efdf10a..eb8b824ef3e 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -51,6 +51,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Load translation files required by the page $langs->loadLangs(array("orders", 'sendings', 'deliveries', 'companies', 'compta', 'bills', 'stocks', 'products')); +// Get Parameters $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); @@ -58,6 +59,7 @@ $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'orderlist'; +// Search Parameters $search_datecloture_start = GETPOST('search_datecloture_start', 'int'); if (empty($search_datecloture_start)) { $search_datecloture_start = dol_mktime(0, 0, 0, GETPOST('search_datecloture_startmonth', 'int'), GETPOST('search_datecloture_startday', 'int'), GETPOST('search_datecloture_startyear', 'int')); @@ -103,6 +105,7 @@ $search_remove_btn = GETPOST('button_removefilter', 'alpha'); $search_project_ref = GETPOST('search_project_ref', 'alpha'); $search_project = GETPOST('search_project', 'alpha'); $search_shippable = GETPOST('search_shippable', 'aZ09'); + $search_fk_cond_reglement = GETPOST("search_fk_cond_reglement", 'int'); $search_fk_shipping_method = GETPOST("search_fk_shipping_method", 'int'); $search_fk_mode_reglement = GETPOST("search_fk_mode_reglement", 'int'); @@ -803,7 +806,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { } // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; @@ -836,7 +839,7 @@ if ($search_user > 0) { // Add table from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= ' WHERE c.fk_soc = s.rowid'; @@ -1197,7 +1200,7 @@ if ($resql) { // Add $param from hooks $parameters = array(); - $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $param .= $hookmanager->resPrint; // List of mass actions available @@ -1364,7 +1367,7 @@ if ($resql) { $moreforfilter .= ''; } $parameters = array(); - $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { $moreforfilter .= $hookmanager->resPrint; } else { @@ -1575,7 +1578,7 @@ if ($resql) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields); - $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['c.datec']['checked'])) { @@ -1769,7 +1772,7 @@ if ($resql) { 'sortorder' => $sortorder, 'totalarray' => &$totalarray, ); - $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['c.datec']['checked'])) { print_liste_field_titre($arrayfields['c.datec']['label'], $_SERVER["PHP_SELF"], "c.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap '); @@ -1825,8 +1828,10 @@ if ($resql) { $total_ht = 0; $total_margin = 0; + $savnbfield = $totalarray['nbfield']; + $totalarray = array(); + $totalarray['nbfield'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); - $last_num = min($num, $limit); while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); @@ -2063,7 +2068,7 @@ if ($resql) { } // Amount HT if (!empty($arrayfields['c.total_ht']['checked'])) { - print '\n"; + print '\n"; if (!$i) { $totalarray['nbfield']++; } @@ -2247,7 +2252,7 @@ if ($resql) { if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate'; } - if ($i >= $last_num - 1) { + if ($i >= $imaxinloop - 1) { if (!empty($total_ht)) { $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT'); } else { @@ -2260,7 +2265,7 @@ if ($resql) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation @@ -2479,7 +2484,7 @@ if ($resql) { $db->free($resql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); - $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print '
'; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print ''; print ''; print '
'; print $product_static->getNomUrl(1, '', 16); @@ -711,7 +729,10 @@ while ($i < $imaxinloop) { print ''.$product_static->LibStatut($objp->tobuy, 5, 1).'
'.price($obj->total_ht)."'.price($obj->total_ht)."
'."\n"; From 3c7092a114e8151d0c3fe69ad7b1515b53ea771c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2023 12:49:40 +0100 Subject: [PATCH 117/218] Doxygen --- htdocs/core/class/html.formadmin.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index a0d0dd2758e..2cc15a3dd42 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -36,7 +36,7 @@ class FormAdmin /** * Constructor * - * @param DoliDB $db Database handler + * @param DoliDB|null $db Database handler */ public function __construct($db) { From 8c1ce7873f9d0d1d99d3004f5af9335380541489 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2023 13:02:04 +0100 Subject: [PATCH 118/218] standardize code --- htdocs/fichinter/class/fichinter.class.php | 28 +++++++------- htdocs/reception/class/reception.class.php | 44 +++++++++++----------- 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 12159f29433..01533698b1c 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -749,25 +749,25 @@ class Fichinter extends CommonObject { // phpcs:enable // Init/load array of translation of status - if (empty($this->statuts) || empty($this->statuts_short) || empty($this->statuts_logo)) { + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; $langs->load("fichinter"); - $this->statuts[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); - $this->statuts[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated'); - $this->statuts[self::STATUS_BILLED] = $langs->transnoentitiesnoconv('StatusInterInvoiced'); - $this->statuts[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('Done'); - $this->statuts_short[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); - $this->statuts_short[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated'); - $this->statuts_short[self::STATUS_BILLED] = $langs->transnoentitiesnoconv('StatusInterInvoiced'); - $this->statuts_short[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('Done'); - $this->statuts_logo[self::STATUS_DRAFT] = 'status0'; - $this->statuts_logo[self::STATUS_VALIDATED] = 'status1'; - $this->statuts_logo[self::STATUS_BILLED] = 'status6'; - $this->statuts_logo[self::STATUS_CLOSED] = 'status6'; + $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); + $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated'); + $this->labelStatus[self::STATUS_BILLED] = $langs->transnoentitiesnoconv('StatusInterInvoiced'); + $this->labelStatus[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('Done'); + $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); + $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated'); + $this->labelStatusShort[self::STATUS_BILLED] = $langs->transnoentitiesnoconv('StatusInterInvoiced'); + $this->labelStatusShort[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('Done'); } - return dolGetStatus($this->statuts[$status], $this->statuts_short[$status], '', $this->statuts_logo[$status], $mode); + $statuscode = 'status'.$status; + if ($status == self::STATUS_BILLED || $status == self::STATUS_CLOSED) { + $statuscode = 'status6'; + } + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statuscode, $mode); } /** diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 03ed28a2200..e9a89691c88 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -140,27 +140,6 @@ class Reception extends CommonObject public function __construct($db) { $this->db = $db; - - // List of long language codes for status - $this->statuts = array(); - $this->statuts[-1] = 'StatusReceptionCanceled'; - $this->statuts[0] = 'StatusReceptionDraft'; - // product to receive if stock increase is on close or already received if stock increase is on validation - $this->statuts[1] = 'StatusReceptionValidated'; - if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION")) { - $this->statuts[1] = 'StatusReceptionValidatedReceived'; - } - if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION_CLOSE")) { - $this->statuts[1] = 'StatusReceptionValidatedToReceive'; - } - $this->statuts[2] = 'StatusReceptionProcessed'; - - // List of short language codes for status - $this->statuts_short = array(); - $this->statuts_short[-1] = 'StatusReceptionCanceledShort'; - $this->statuts_short[0] = 'StatusReceptionDraftShort'; - $this->statuts_short[1] = 'StatusReceptionValidatedShort'; - $this->statuts_short[2] = 'StatusReceptionProcessedShort'; } /** @@ -1317,8 +1296,27 @@ class Reception extends CommonObject // phpcs:enable global $langs; - $labelStatus = $langs->transnoentitiesnoconv($this->statuts[$status]); - $labelStatusShort = $langs->transnoentitiesnoconv($this->statuts_short[$status]); + // List of long language codes for status + $this->labelStatus[-1] = 'StatusReceptionCanceled'; + $this->labelStatus[0] = 'StatusReceptionDraft'; + // product to receive if stock increase is on close or already received if stock increase is on validation + $this->labelStatus[1] = 'StatusReceptionValidated'; + if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION")) { + $this->labelStatus[1] = 'StatusReceptionValidatedReceived'; + } + if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION_CLOSE")) { + $this->labelStatus[1] = 'StatusReceptionValidatedToReceive'; + } + $this->labelStatus[2] = 'StatusReceptionProcessed'; + + // List of short language codes for status + $this->labelStatusShort[-1] = 'StatusReceptionCanceledShort'; + $this->labelStatusShort[0] = 'StatusReceptionDraftShort'; + $this->labelStatusShort[1] = 'StatusReceptionValidatedShort'; + $this->labelStatusShort[2] = 'StatusReceptionProcessedShort'; + + $labelStatus = $langs->transnoentitiesnoconv($this->labelStatus[$status]); + $labelStatusShort = $langs->transnoentitiesnoconv($this->labelStatusShort[$status]); $statusType = 'status'.$status; if ($status == self::STATUS_VALIDATED) { From 924679515970789c67d9443e3a2b3c50ffa20f3c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2023 12:47:57 +0100 Subject: [PATCH 119/218] Fix warning --- htdocs/core/class/utils.class.php | 3 +++ htdocs/core/modules/action/rapport.class.php | 5 +++++ htdocs/modulebuilder/index.php | 2 +- htdocs/public/recruitment/index.php | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index f8096ed84e9..16e000e7f59 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -34,6 +34,9 @@ class Utils */ public $db; + public $error; + public $errors; + public $output; // Used by Cron method to return message public $result; // Used by Cron method to return data diff --git a/htdocs/core/modules/action/rapport.class.php b/htdocs/core/modules/action/rapport.class.php index 8c0964b1378..d91b748d7d5 100644 --- a/htdocs/core/modules/action/rapport.class.php +++ b/htdocs/core/modules/action/rapport.class.php @@ -40,6 +40,11 @@ class CommActionRapport */ public $db; + public $error; + + public $errors; + + /** * @var string description */ diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index a6f3431bd2e..f871d916aa7 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -4461,7 +4461,7 @@ if ($module == 'initmodule') { print ''; print ''; print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledocpdf), 'dayhour').')'; - print ' '.img_picto($langs->trans("Delete"), 'delete').''; + print ' '.img_picto($langs->trans("Delete"), 'delete').''; } print '
'; diff --git a/htdocs/public/recruitment/index.php b/htdocs/public/recruitment/index.php index 23a180b9a7b..4f82139656c 100644 --- a/htdocs/public/recruitment/index.php +++ b/htdocs/public/recruitment/index.php @@ -252,7 +252,7 @@ if (is_array($results)) { } } print ''; - print $tmpuser->getFullName(-1); + print $tmpuser->getFullName($langs); print '   '.dol_print_email($emailforcontact, 0, 0, 1, 0, 0, 'envelope'); print ''; print '
'; From c50c553999834427c38e0cad55e172f7a9387a0b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2023 14:40:00 +0100 Subject: [PATCH 120/218] NEW Save date to invalidate other session into user table --- htdocs/install/mysql/migration/17.0.0-18.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_user.sql | 1 + htdocs/user/class/user.class.php | 10 +++++++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql index 84022422fba..376d89861f2 100644 --- a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -56,3 +56,6 @@ ALTER TABLE llx_payment_salary MODIFY COLUMN datep datetime; INSERT INTO llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1179, 117, 'I-28' , 28, 0, '0', 0, '0', 0, 'IGST', 1); INSERT INTO llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1176, 117, 'C+S-18', 0, 9, '1', 9, '1', 0, 'CGST+SGST - Same state sales', 1); + +ALTER TABLE llx_user ADD COLUMN flagdelsessionsbefore datetime DEFAULT NULL; + diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index ca0c7bc818d..a10f8489bcb 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -84,6 +84,7 @@ create table llx_user datelastpassvalidation datetime, -- last date we change password or we made a disconnect all datestartvalidity datetime, dateendvalidity datetime, + flagdelsessionsbefore datetime DEFAULT NULL, -- set this to a date if we need to launch an external process to invalidate all sessions for the same login created before this date iplastlogin varchar(250), ippreviouslogin varchar(250), egroupware_id integer, diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 74093af63c6..65a7b7d7842 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1776,9 +1776,9 @@ class User extends CommonObject } } - if ($result > 0 && $member->fk_soc) { // If member is linked to a thirdparty + if ($result > 0 && $member->socid) { // If member is linked to a thirdparty $sql = "UPDATE ".$this->db->prefix()."user"; - $sql .= " SET fk_soc=".((int) $member->fk_soc); + $sql .= " SET fk_soc=".((int) $member->socid); $sql .= " WHERE rowid=".((int) $this->id); dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG); @@ -2243,9 +2243,10 @@ class User extends CommonObject * @param int $notrigger 1=Does not launch triggers * @param int $nosyncmember Do not synchronize linked member * @param int $passwordalreadycrypted 0=Value is cleartext password, 1=Value is crypted value. + * @param int $flagdelsessionsbefore 1=Save also the current date to ask to invalidate all other session before this date. * @return string If OK return clear password, 0 if no change (warning, you may retreive 1 instead of 0 even if password was same), < 0 if error */ - public function setPassword($user, $password = '', $changelater = 0, $notrigger = 0, $nosyncmember = 0, $passwordalreadycrypted = 0) + public function setPassword($user, $password = '', $changelater = 0, $notrigger = 0, $nosyncmember = 0, $passwordalreadycrypted = 0, $flagdelsessionsbefore = 1) { global $conf, $langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; @@ -2297,6 +2298,9 @@ class User extends CommonObject $sql = "UPDATE ".$this->db->prefix()."user"; $sql .= " SET pass_crypted = '".$this->db->escape($password_crypted)."',"; $sql .= " pass_temp = null"; + if (empty($flagdelsessionsbefore)) { + $sql .= ", flagdelsessionsbefore = '".$this->db->idate(dol_now() - 5, 'gmt')."'"; + } if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) { $sql .= ", pass = null"; } else { From 440d72ba9de2f151f6ab21a87db28057eb7f6c1b Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Thu, 12 Jan 2023 15:19:39 +0100 Subject: [PATCH 121/218] kanban mode for list of various payment --- .../bank/class/paymentvarious.class.php | 37 ++ htdocs/compta/bank/various_payment/list.php | 324 ++++++++++-------- 2 files changed, 214 insertions(+), 147 deletions(-) diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 3d07c280559..857b49d1576 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -768,4 +768,41 @@ class PaymentVarious extends CommonObject } return 0; } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'fk_bank')) { + $return .= ' | '.$this->fk_bank.''; + } + if (property_exists($this, 'datep')) { + $return .= '
'.$langs->trans("Date").' : '.dol_print_date($this->db->jdate($this->datep), 'day').''; + } + if (property_exists($this, 'type_payment') && !empty($this->type_payment)) { + $return .= '
'.$langs->trans("Payment", $this->type_payment).' : '.$this->type_payment.''; + } + if (property_exists($this, 'accountancy_code')) { + $return .= '
'.$langs->trans("Account").' : '.$this->accountancy_code.''; + } + if (property_exists($this, 'amount')) { + $return .= '
'.$langs->trans("Debit").' : '.price($this->amount).''; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 0721aeb7ef0..9cd43b01924 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -45,6 +45,7 @@ if ($user->socid) { } $optioncss = GETPOST('optioncss', 'alpha'); +$mode = GETPOST('mode', 'alpha'); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $search_ref = GETPOST('search_ref', 'int'); @@ -312,6 +313,9 @@ if ($resql) { $total = 0; $param = ''; + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -362,7 +366,10 @@ if ($resql) { if (!empty($socid)) { $url .= '&socid='.urlencode($socid); } - $newcardbutton = dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->banque->modifier); + $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->banque->modifier); print ''; @@ -375,6 +382,8 @@ if ($resql) { print ''; print ''; print ''; + print ''; + print_barre_liste($langs->trans("MenuVariousPayment"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -568,166 +577,187 @@ if ($resql) { $variousstatic->id = $obj->rowid; $variousstatic->ref = $obj->rowid; $variousstatic->label = $obj->label; + $variousstatic->datep = $obj->datep; + $variousstatic->type_payment = $obj->payment_code; + $bankline->fetch($obj->fk_bank); + $variousstatic->fk_bank = $bankline->getNomUrl(1); + $variousstatic->amount = $obj->amount; - print ''; + $accountingaccount->fetch('', $obj->accountancy_code, 1); + $variousstatic->accountancy_code = $accountingaccount->getNomUrl(0, 0, 1, $obj->accountingaccount, 1); - // No - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { - print ''.(($offset * $limit) + $i).''; - } - - // Ref - if ($arrayfields['ref']['checked']) { - print ''.$variousstatic->getNomUrl(1).""; - if (!$i) { - $totalarray['nbfield']++; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } - } + // Output Kanban - // Label payment - if ($arrayfields['label']['checked']) { - print ''.$variousstatic->label.""; - if (!$i) { - $totalarray['nbfield']++; + print $variousstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; } - } + } else { + print ''; - // Date payment - if ($arrayfields['datep']['checked']) { - print ''.dol_print_date($obj->datep, 'day').""; - if (!$i) { - $totalarray['nbfield']++; + // No + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { + print ''.(($offset * $limit) + $i).''; } - } - - // Date value - if ($arrayfields['datev']['checked']) { - print ''.dol_print_date($obj->datev, 'day').""; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Type - if ($arrayfields['type']['checked']) { - print ''; - if ($obj->payment_code) { - print $langs->trans("PaymentTypeShort".$obj->payment_code); - print ' '; - } - print $obj->num_payment; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Project - if ($arrayfields['project']['checked']) { - print ''; - if ($obj->fk_project > 0) { - $proj->fetch($obj->fk_project); - print $proj->getNomUrl(1); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Bank account - if ($arrayfields['bank']['checked']) { - print ''; - if ($obj->bid > 0) { - $accountstatic->id = $obj->bid; - $accountstatic->ref = $obj->bref; - $accountstatic->number = $obj->bnumber; - - if (isModEnabled('accounting')) { - $accountstatic->account_number = $obj->bank_account_number; - $accountingjournal->fetch($obj->accountancy_journal); - $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); + // Ref + if ($arrayfields['ref']['checked']) { + print ''.$variousstatic->getNomUrl(1).""; + if (!$i) { + $totalarray['nbfield']++; } - - $accountstatic->label = $obj->blabel; - print $accountstatic->getNomUrl(1); - } else { - print ' '; } - print ''; + + // Label payment + if ($arrayfields['label']['checked']) { + print ''.$variousstatic->label.""; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date payment + if ($arrayfields['datep']['checked']) { + print ''.dol_print_date($obj->datep, 'day').""; + if (!$i) { + $totalarray['nbfield']++; + } + } + + + // Date value + if ($arrayfields['datev']['checked']) { + print ''.dol_print_date($obj->datev, 'day').""; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Type + if ($arrayfields['type']['checked']) { + print ''; + if ($obj->payment_code) { + print $langs->trans("PaymentTypeShort".$obj->payment_code); + print ' '; + } + print $obj->num_payment; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Project + if ($arrayfields['project']['checked']) { + print ''; + if ($obj->fk_project > 0) { + $proj->fetch($obj->fk_project); + print $proj->getNomUrl(1); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Bank account + if ($arrayfields['bank']['checked']) { + print ''; + if ($obj->bid > 0) { + $accountstatic->id = $obj->bid; + $accountstatic->ref = $obj->bref; + $accountstatic->number = $obj->bnumber; + + if (isModEnabled('accounting')) { + $accountstatic->account_number = $obj->bank_account_number; + $accountingjournal->fetch($obj->accountancy_journal); + $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); + } + + $accountstatic->label = $obj->blabel; + print $accountstatic->getNomUrl(1); + } else { + print ' '; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Bank entry + if ($arrayfields['entry']['checked']) { + $bankline->fetch($obj->fk_bank); + print ''.$bankline->getNomUrl(1).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Accounting account + if (!empty($arrayfields['account']['checked'])) { + $accountingaccount->fetch('', $obj->accountancy_code, 1); + + print ''.$accountingaccount->getNomUrl(0, 1, 1, '', 1).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Accounting subledger account + if (!empty($arrayfields['subledger']['checked'])) { + print ''.length_accounta($obj->subledger_account).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Debit + if ($arrayfields['debit']['checked']) { + print ''; + if ($obj->sens == 0) { + print ''.price($obj->amount).''; + $totalarray['val']['total_deb'] += $obj->amount; + } + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_deb'; + } + print ''; + } + + // Credit + if ($arrayfields['credit']['checked']) { + print ''; + if ($obj->sens == 1) { + print ''.price($obj->amount).''; + $totalarray['val']['total_cred'] += $obj->amount; + } + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_cred'; + } + print ''; + } + + print ''; + if (!$i) { $totalarray['nbfield']++; } + + print ''."\n"; } - - // Bank entry - if ($arrayfields['entry']['checked']) { - $bankline->fetch($obj->fk_bank); - print ''.$bankline->getNomUrl(1).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Accounting account - if (!empty($arrayfields['account']['checked'])) { - $accountingaccount->fetch('', $obj->accountancy_code, 1); - - print ''.$accountingaccount->getNomUrl(0, 1, 1, '', 1).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Accounting subledger account - if (!empty($arrayfields['subledger']['checked'])) { - print ''.length_accounta($obj->subledger_account).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Debit - if ($arrayfields['debit']['checked']) { - print ''; - if ($obj->sens == 0) { - print ''.price($obj->amount).''; - $totalarray['val']['total_deb'] += $obj->amount; - } - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'total_deb'; - } - print ''; - } - - // Credit - if ($arrayfields['credit']['checked']) { - print ''; - if ($obj->sens == 1) { - print ''.price($obj->amount).''; - $totalarray['val']['total_cred'] += $obj->amount; - } - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'total_cred'; - } - print ''; - } - - print ''; - - if (!$i) { - $totalarray['nbfield']++; - } - - print ''."\n"; - $i++; } From a68df8e9f573751eff25ca66ee4e3b1d630d7318 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Thu, 12 Jan 2023 16:16:23 +0100 Subject: [PATCH 122/218] kanban mode for list of banks --- htdocs/compta/bank/class/account.class.php | 33 ++ htdocs/compta/bank/list.php | 429 +++++++++++---------- 2 files changed, 258 insertions(+), 204 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index a73fd2b5f2c..5332150dfb4 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1748,6 +1748,39 @@ class Account extends CommonObject return false; } } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + + if (property_exists($this, 'type_lib')) { + $return .= '
'.substr($this->type_lib[$this->type], 0, 24).'...'; + } + if (method_exists($this, 'solde')) { + $return .= '
'; + $return .= ''.$langs->trans("Balance").' : '.price($this->solde(1), 0, $langs, 1, -1, -1, $this->currency_code).''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 38b666cc2ef..8efe9451b64 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -52,6 +52,7 @@ $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bankaccountlist'; // To manage different context of search +$mode = GETPOST('mode', 'alpha'); $search_ref = GETPOST('search_ref', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); @@ -305,6 +306,9 @@ llxHeader('', $title, $help_url); $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -365,8 +369,13 @@ print ''; print ''; print ''; +print ''; -$newcardbutton = dolGetButtonTitle($langs->trans('NewFinancialAccount'), '', 'fa fa-plus-circle', 'card.php?action=create', '', $user->rights->banque->configurer); + +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('NewFinancialAccount'), '', 'fa fa-plus-circle', 'card.php?action=create', '', $user->rights->banque->configurer); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bank_account', 0, $newcardbutton, '', $limit, 1); @@ -584,224 +593,236 @@ foreach ($accounts as $key => $type) { $lastcurrencycode = $objecttmp->currency_code; } - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($objecttmp->id, $arrayofselected)) { - $selected = 1; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban + print $objecttmp->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($objecttmp->id, $arrayofselected)) { + $selected = 1; + } + print ''; } - print ''; + print ''; } - print ''; - } - // Ref - if (!empty($arrayfields['b.ref']['checked'])) { - print ''.$objecttmp->getNomUrl(1).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Label - if (!empty($arrayfields['b.label']['checked'])) { - print ''.dol_escape_htmltag($objecttmp->label).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Account type - if (!empty($arrayfields['accountype']['checked'])) { - print ''; - print $objecttmp->type_lib[$objecttmp->type]; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Number - if (!empty($arrayfields['b.number']['checked'])) { - print ''.dol_escape_htmltag($objecttmp->number).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Account number - if (!empty($arrayfields['b.account_number']['checked'])) { - print ''; - if (isModEnabled('accounting') && !empty($objecttmp->account_number)) { - $accountingaccount = new AccountingAccount($db); - $accountingaccount->fetch('', $objecttmp->account_number, 1); - print ''; - print $accountingaccount->getNomUrl(0, 1, 1, '', 0); - print ''; - } else { - print ''.$objecttmp->account_number.''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Accountancy journal - if (!empty($arrayfields['b.fk_accountancy_journal']['checked'])) { - print ''; - if (isModEnabled('accounting')) { - if (empty($objecttmp->fk_accountancy_journal)) { - print img_warning($langs->trans("Mandatory")); - } else { - $accountingjournal = new AccountingJournal($db); - $accountingjournal->fetch($objecttmp->fk_accountancy_journal); - print $accountingjournal->getNomUrl(0, 1, 1, '', 1); + // Ref + if (!empty($arrayfields['b.ref']['checked'])) { + print ''.$objecttmp->getNomUrl(1).''; + if (!$i) { + $totalarray['nbfield']++; } - } else { - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Currency - if (!empty($arrayfields['b.currency_code']['checked'])) { - print ''; - print $objecttmp->currency_code; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Transactions to reconcile - if (!empty($arrayfields['toreconcile']['checked'])) { - $conciliate = $objecttmp->canBeConciliated(); - - $labeltoshow = ''; - if ($conciliate == -2) { - $labeltoshow = $langs->trans("CashAccount"); - } elseif ($conciliate == -3) { - $labeltoshow = $langs->trans("Closed"); - } elseif (empty($objecttmp->rappro)) { - $labeltoshow = $langs->trans("ConciliationDisabled"); } - print ''; - if ($conciliate == -2) { - print ''.$langs->trans("CashAccount").''; - } elseif ($conciliate == -3) { - print ''.$langs->trans("Closed").''; - } elseif (empty($objecttmp->rappro)) { - print ''.$langs->trans("ConciliationDisabled").''; - } else { - $result = $objecttmp->load_board($user, $objecttmp->id); - if (is_numeric($result) && $result < 0) { - setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); - } else { - print '
'; - print ''; - print $result->nbtodo; + // Label + if (!empty($arrayfields['b.label']['checked'])) { + print ''.dol_escape_htmltag($objecttmp->label).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Account type + if (!empty($arrayfields['accountype']['checked'])) { + print ''; + print $objecttmp->type_lib[$objecttmp->type]; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Number + if (!empty($arrayfields['b.number']['checked'])) { + print ''.dol_escape_htmltag($objecttmp->number).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Account number + if (!empty($arrayfields['b.account_number']['checked'])) { + print ''; + if (isModEnabled('accounting') && !empty($objecttmp->account_number)) { + $accountingaccount = new AccountingAccount($db); + $accountingaccount->fetch('', $objecttmp->account_number, 1); + print ''; + print $accountingaccount->getNomUrl(0, 1, 1, '', 0); print ''; - print ''; - if ($result->nbtodolate) { - print ''; - print ' '.$result->nbtodolate; + } else { + print ''.$objecttmp->account_number.''; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Accountancy journal + if (!empty($arrayfields['b.fk_accountancy_journal']['checked'])) { + print ''; + if (isModEnabled('accounting')) { + if (empty($objecttmp->fk_accountancy_journal)) { + print img_warning($langs->trans("Mandatory")); + } else { + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch($objecttmp->fk_accountancy_journal); + print $accountingjournal->getNomUrl(0, 1, 1, '', 1); + } + } else { + print ''; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Currency + if (!empty($arrayfields['b.currency_code']['checked'])) { + print ''; + print $objecttmp->currency_code; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Transactions to reconcile + if (!empty($arrayfields['toreconcile']['checked'])) { + $conciliate = $objecttmp->canBeConciliated(); + + $labeltoshow = ''; + if ($conciliate == -2) { + $labeltoshow = $langs->trans("CashAccount"); + } elseif ($conciliate == -3) { + $labeltoshow = $langs->trans("Closed"); + } elseif (empty($objecttmp->rappro)) { + $labeltoshow = $langs->trans("ConciliationDisabled"); + } + + print ''; + if ($conciliate == -2) { + print ''.$langs->trans("CashAccount").''; + } elseif ($conciliate == -3) { + print ''.$langs->trans("Closed").''; + } elseif (empty($objecttmp->rappro)) { + print ''.$langs->trans("ConciliationDisabled").''; + } else { + $result = $objecttmp->load_board($user, $objecttmp->id); + if (is_numeric($result) && $result < 0) { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + } else { + print ''; + print ''; + print $result->nbtodo; print ''; + print ''; + if ($result->nbtodolate) { + print ''; + print ' '.$result->nbtodolate; + print ''; + } } } - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Extra fields - if (is_array($objecttmp->array_options)) { - $obj = new stdClass(); - foreach ($objecttmp->array_options as $k => $v) { - $obj->$k = $v; - } - } - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $objecttmp, $action); // Note that $action and $objecttmpect may have been modified by hook - print $hookmanager->resPrint; - // Date creation - if (!empty($arrayfields['b.datec']['checked'])) { - print ''; - print dol_print_date($objecttmp->date_creation, 'dayhour'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['b.tms']['checked'])) { - print ''; - print dol_print_date($objecttmp->date_update, 'dayhour'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Status - if (!empty($arrayfields['b.clos']['checked'])) { - print ''.$objecttmp->getLibStatut(5).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Balance - if (!empty($arrayfields['balance']['checked'])) { - print ''; - print ''; - print ''.price($solde, 0, $langs, 1, -1, -1, $objecttmp->currency_code).''; - print ''; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'balance'; - } - $totalarray['val']['balance'] += $solde; - } - - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($objecttmp->id, $arrayofselected)) { - $selected = 1; + print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - print ''; + // Extra fields + if (is_array($objecttmp->array_options)) { + $obj = new stdClass(); + foreach ($objecttmp->array_options as $k => $v) { + $obj->$k = $v; + } + } + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $objecttmp, $action); // Note that $action and $objecttmpect may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (!empty($arrayfields['b.datec']['checked'])) { + print ''; + print dol_print_date($objecttmp->date_creation, 'dayhour'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date modification + if (!empty($arrayfields['b.tms']['checked'])) { + print ''; + print dol_print_date($objecttmp->date_update, 'dayhour'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } - if (empty($total[$objecttmp->currency_code])) { - $total[$objecttmp->currency_code] = $solde; - } else { - $total[$objecttmp->currency_code] += $solde; + // Status + if (!empty($arrayfields['b.clos']['checked'])) { + print ''.$objecttmp->getLibStatut(5).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Balance + if (!empty($arrayfields['balance']['checked'])) { + print ''; + print ''; + print ''.price($solde, 0, $langs, 1, -1, -1, $objecttmp->currency_code).''; + print ''; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'balance'; + } + $totalarray['val']['balance'] += $solde; + } + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($objecttmp->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + + print ''; + + if (empty($total[$objecttmp->currency_code])) { + $total[$objecttmp->currency_code] = $solde; + } else { + $total[$objecttmp->currency_code] += $solde; + } } - $i++; } From 551daa5ca1806e0ac4d272a10a787ebf1b326a33 Mon Sep 17 00:00:00 2001 From: hystepik Date: Thu, 12 Jan 2023 16:26:39 +0100 Subject: [PATCH 123/218] New : Add reload of modules in configuration --- htdocs/admin/modules.php | 54 +++++++++++++++++++++++++++++++++++ htdocs/core/lib/admin.lib.php | 15 ++++++---- htdocs/langs/en_US/admin.lang | 2 ++ 3 files changed, 65 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index e93b5a58e96..db019bd262a 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -282,10 +282,39 @@ if ($action == 'set' && $user->admin) { } header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : '')); exit; +} elseif (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1 && $action == 'reload' && $user->admin && GETPOST('confirm') == 'yes') { + $result = unActivateModule($value, 0); + dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity); + if ($result) { + setEventMessages($result, null, 'errors'); + header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : '')); + } + $resarray = activateModule($value, 0, 1); + dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity); + if (!empty($resarray['errors'])) { + setEventMessages('', $resarray['errors'], 'errors'); + } else { + if ($resarray['nbperms'] > 0) { + $tmpsql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1"; + $resqltmp = $db->query($tmpsql); + if ($resqltmp) { + $obj = $db->fetch_object($resqltmp); + if ($obj && $obj->nb > 1) { + $msg = $langs->trans('ModuleEnabledAdminMustCheckRights'); + setEventMessages($msg, null, 'warnings'); + } + } else { + dol_print_error($db); + } + } + } + header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : '')); + exit; } + /* * View */ @@ -464,6 +493,19 @@ if ($action == 'reset_confirm' && $user->admin) { } } +if ($action == 'reload_confirm' && $user->admin) { + if (!empty($modules[$value])) { + $objMod = $modules[$value]; + + if (!empty($objMod->langfiles)) { + $langs->loadLangs($objMod->langfiles); + } + + $form = new Form($db); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?value='.$value.'&mode='.$mode.$param, $langs->trans('ConfirmReload'), $langs->trans(GETPOST('confirm_message_code')), 'reload', '', 'no', 1); + } +} + print $formconfirm; asort($orders); @@ -802,10 +844,22 @@ if ($mode == 'common' || $mode == 'commonkanban') { $codeenabledisable .= 'warnings_unactivation[$mysoc->country_code]).'&value='.$modName.'&mode='.$mode.$param.'">'; $codeenabledisable .= img_picto($langs->trans("Activated"), 'switch_on'); $codeenabledisable .= ''; + if (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1) { + $codeenabledisable .= ' '; + $codeenabledisable .= ''; + $codeenabledisable .= img_picto($langs->trans("Reload"), 'refresh', 'class="fa-15"'); + $codeenabledisable .= ''; + } } else { $codeenabledisable .= ''; $codeenabledisable .= img_picto($langs->trans("Activated"), 'switch_on'); $codeenabledisable .= ''; + if (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1) { + $codeenabledisable .= ' '; + $codeenabledisable .= ''; + $codeenabledisable .= img_picto($langs->trans("Reload"), 'refresh', 'class="fa-15"'); + $codeenabledisable .= ''; + } } } diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 71bcc082961..92895793082 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1084,11 +1084,12 @@ function purgeSessions($mysessionid) /** * Enable a module * - * @param string $value Name of module to activate - * @param int $withdeps Activate/Disable also all dependencies - * @return array array('nbmodules'=>nb modules activated with success, 'errors=>array of error messages, 'nbperms'=>Nb permission added); + * @param string $value Name of module to activate + * @param int $withdeps Activate/Disable also all dependencies + * @param int $noconfverification Remove verification of $conf variable for module + * @return array array('nbmodules'=>nb modules activated with success, 'errors=>array of error messages, 'nbperms'=>Nb permission added); */ -function activateModule($value, $withdeps = 1) +function activateModule($value, $withdeps = 1, $noconfverification = 0) { global $db, $langs, $conf, $mysoc; @@ -1144,8 +1145,10 @@ function activateModule($value, $withdeps = 1) } $const_name = $objMod->const_name; - if (!empty($conf->global->$const_name)) { - return $ret; + if ($noconfverification == 0) { + if (!empty($conf->global->$const_name)) { + return $ret; + } } $result = $objMod->init(); // Enable module diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 421ba4f6fa2..34bae07fc37 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2357,3 +2357,5 @@ AllowExternalDownload=Allow external download (without login, using a shared lin DeadlineDayVATSubmission=Deadline day for vat submission on the next month MaxNumberOfAttachementOnForms=Max number of joinded files in a form IfDefinedUseAValueBeetween=If defined, use a value between %s and %s +Reload=Reload +ConfirmReload=Confirm module reload \ No newline at end of file From 8a5423b464df64b3c825efc47901f2ec1c61342d Mon Sep 17 00:00:00 2001 From: hystepik Date: Thu, 12 Jan 2023 16:29:58 +0100 Subject: [PATCH 124/218] add newline end of file --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 34bae07fc37..cfe01784bea 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2358,4 +2358,4 @@ DeadlineDayVATSubmission=Deadline day for vat submission on the next month MaxNumberOfAttachementOnForms=Max number of joinded files in a form IfDefinedUseAValueBeetween=If defined, use a value between %s and %s Reload=Reload -ConfirmReload=Confirm module reload \ No newline at end of file +ConfirmReload=Confirm module reload From 23f89c9134640099ca5fa02bea86dff01864b392 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2023 17:59:19 +0100 Subject: [PATCH 125/218] Missing photo --- htdocs/salaries/list.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 17addfa22f4..d2344f378a0 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -458,7 +458,7 @@ if (isModEnabled("banque")) { // Amount print ''; -//Status +// Status print ''; $liststatus = array('0' => $langs->trans("Unpaid"), '1' => $langs->trans("Paid")); print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage'); @@ -538,7 +538,8 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $userstatic->login = $obj->login; $userstatic->email = $obj->email; $userstatic->socid = $obj->fk_soc; - $userstatic->statut = $obj->status; + $userstatic->statut = $obj->status; // deprecated + $userstatic->status = $obj->status; $salstatic->id = $obj->rowid; $salstatic->ref = $obj->rowid; @@ -590,7 +591,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } // Employee - print ''.$userstatic->getNomUrl(1)."\n"; + print ''.$userstatic->getNomUrl(-1)."\n"; if (!$i) { $totalarray['nbfield']++; } @@ -637,7 +638,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } } - // if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; + // if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; // Amount print ''.price($obj->amount).''; From 3ae453136b1d6cbf4011e5d2509ff538cfa252ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2023 18:06:26 +0100 Subject: [PATCH 126/218] Fix error --- htdocs/install/upgrade2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index c9f1eb76b41..1e153109140 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -4196,7 +4196,7 @@ function migrate_delete_old_dir($db, $langs, $conf) } foreach ($filetodeletearray as $filetodelete) { - //print ''.$filetodelete."
\n"; + $result = 1; if (file_exists($filetodelete)) { $result = dol_delete_dir_recursive($filetodelete); } From dac735dc4be9984266df767ff6de606afb2f6b20 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2023 18:11:10 +0100 Subject: [PATCH 127/218] Fix missing photo --- htdocs/salaries/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index d2344f378a0..fbbac2a2f3b 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -224,7 +224,7 @@ $now = dol_now(); $help_url = ''; $title = $langs->trans('Salaries'); -$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary as current_salary, u.fk_soc as fk_soc, u.statut as status,"; +$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.photo, u.salary as current_salary, u.fk_soc as fk_soc, u.statut as status,"; $sql .= " s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp, s.dateep, s.fk_typepayment as paymenttype, "; $sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos,"; $sql .= " pst.code as payment_code,"; @@ -540,6 +540,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $userstatic->socid = $obj->fk_soc; $userstatic->statut = $obj->status; // deprecated $userstatic->status = $obj->status; + $userstatic->photo = $obj->photo; $salstatic->id = $obj->rowid; $salstatic->ref = $obj->rowid; From 7124a59110b4c9c3fd60a449d3c367281461b2eb Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Thu, 12 Jan 2023 18:28:57 +0100 Subject: [PATCH 128/218] kanban mode for list of prelevement orders --- .../class/bonprelevement.class.php | 34 +++++++++++++ htdocs/compta/prelevement/orders_list.php | 49 ++++++++++++++----- 2 files changed, 70 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 959630a5538..e8e511f8c87 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -2397,4 +2397,38 @@ class BonPrelevement extends CommonObject */ return 0; } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs; + + + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + + if (property_exists($this, 'date_echeance')) { + $return .= '
'.$langs->trans("Date").' : '.dol_print_date($this->db->jdate($this->date_echeance), 'day').''; + } + if (property_exists($this, 'total')) { + $return .= '
'.$langs->trans("Amount").' : '.price($this->total).''; + } + if (method_exists($this, 'LibStatut')) { + $return .= '
'.$this->LibStatut($this->statut, 5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/compta/prelevement/orders_list.php b/htdocs/compta/prelevement/orders_list.php index 01ef33eea9d..bead580ab31 100644 --- a/htdocs/compta/prelevement/orders_list.php +++ b/htdocs/compta/prelevement/orders_list.php @@ -54,6 +54,8 @@ if (!$sortfield) { } $optioncss = GETPOST('optioncss', 'alpha'); +$mode = GETPOST('mode', 'alpha'); + // Get supervariables $statut = GETPOST('statut', 'int'); @@ -147,6 +149,9 @@ if ($result) { $i = 0; $param = ''; + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -161,6 +166,8 @@ if ($result) { $selectedfields = ''; $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); if ($usercancreate) { $newcardbutton .= dolGetButtonTitle($langs->trans('NewStandingOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php?type='.urlencode($type)); } @@ -176,6 +183,8 @@ if ($result) { print ''; print ''; print ''; + print ''; + if ($type != '') { print ''; } @@ -220,27 +229,41 @@ if ($result) { $directdebitorder->id = $obj->rowid; $directdebitorder->ref = $obj->ref; - $directdebitorder->datec = $obj->datec; - $directdebitorder->amount = $obj->amount; + $directdebitorder->date_echeance = $obj->datec; + $directdebitorder->total = $obj->amount; $directdebitorder->statut = $obj->statut; - print ''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban - print ''; - print $directdebitorder->getNomUrl(1); - print "\n"; + print $directdebitorder->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + print ''; - print ''.dol_print_date($db->jdate($obj->datec), 'day')."\n"; + print ''; + print $directdebitorder->getNomUrl(1); + print "\n"; - print ''.price($obj->amount)."\n"; + print ''.dol_print_date($db->jdate($obj->datec), 'day')."\n"; - print ''; - print $bon->LibStatut($obj->statut, 5); - print ''; + print ''.price($obj->amount)."\n"; - print ''."\n"; + print ''; + print $bon->LibStatut($obj->statut, 5); + print ''; - print "\n"; + print ''."\n"; + + print "\n"; + } $i++; } } else { From 68370083985e998642eba61b7e15d925a0423582 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Thu, 12 Jan 2023 18:53:27 +0100 Subject: [PATCH 129/218] kanban view for ligne prelevement --- htdocs/compta/prelevement/list.php | 117 +++++++++++++++++------------ 1 file changed, 71 insertions(+), 46 deletions(-) diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index 4906313cad1..8d9489bbec7 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -43,6 +43,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'directdebitcredittransferlinelist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$mode = GETPOST('mode', 'alpha'); $type = GETPOST('type', 'aZ09'); @@ -188,12 +189,18 @@ if ($result) { $param = "&statut=".urlencode($statut); $param .= "&search_bon=".urlencode($search_bon); + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if ($type == 'bank-transfer') { $param .= '&type=bank-transfer'; } if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } + $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); print"\n\n"; print ''."\n"; @@ -206,6 +213,8 @@ if ($result) { print ''; print ''; print ''; + print ''; + if ($type != '') { print ''; } @@ -214,7 +223,7 @@ if ($result) { if ($type == 'bank-transfer') { $title = $langs->trans("CreditTransferLines"); } - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, '', '', $limit, 0, 0, 1); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit, 0, 0, 1); $moreforfilter = ''; @@ -262,61 +271,77 @@ if ($result) { $bon->id = $obj->rowid; $bon->ref = $obj->ref; $bon->statut = $obj->status; + $bon->date_echeance = $obj->datec; + $bon->total = $obj->amount; $company->id = $obj->socid; $company->name = $obj->name; $company->email = $obj->email; $company->code_client = $obj->code_client; - print ''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban - print ''; - print $bon->getNomUrl(1); - print "\n"; + print $bon->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + print ''; - print ''; - print $line->LibStatut($obj->statut_ligne, 2); - print " "; - print ''; - print substr('000000'.$obj->rowid_ligne, -6); - print ''; + print ''; + print $bon->getNomUrl(1); + print "\n"; - print ''; - $link_to_bill = '/compta/facture/card.php?facid='; - $link_title = 'Invoice'; - $link_picto = 'bill'; - if ($type == 'bank-transfer') { - $link_to_bill = '/fourn/facture/card.php?facid='; - $link_title = 'SupplierInvoice'; - $link_picto = 'supplier_invoice'; + print ''; + print $line->LibStatut($obj->statut_ligne, 2); + print " "; + print ''; + print substr('000000'.$obj->rowid_ligne, -6); + print ''; + + print ''; + $link_to_bill = '/compta/facture/card.php?facid='; + $link_title = 'Invoice'; + $link_picto = 'bill'; + if ($type == 'bank-transfer') { + $link_to_bill = '/fourn/facture/card.php?facid='; + $link_title = 'SupplierInvoice'; + $link_picto = 'supplier_invoice'; + } + print ''; + print img_object($langs->trans($link_title), $link_picto); + print ' '.$obj->invoiceref."\n"; + print ''; + print ''; + + print ''; + print $company->getNomUrl(1); + print "\n"; + + + print ''; + $link_to_tab = '/comm/card.php?socid='; + $link_code = $obj->code_client; + if ($type == 'bank-transfer') { + $link_to_tab = '/fourn/card.php?socid='; + $link_code = $obj->code_fournisseur; + } + print ''.$link_code."\n"; + + print ''.dol_print_date($db->jdate($obj->datec), 'day')."\n"; + + print ''.price($obj->amount)."\n"; + + print ' '; + + print "\n"; } - print ''; - print img_object($langs->trans($link_title), $link_picto); - print ' '.$obj->invoiceref."\n"; - print ''; - print ''; - - print ''; - print $company->getNomUrl(1); - print "\n"; - - - print ''; - $link_to_tab = '/comm/card.php?socid='; - $link_code = $obj->code_client; - if ($type == 'bank-transfer') { - $link_to_tab = '/fourn/card.php?socid='; - $link_code = $obj->code_fournisseur; - } - print ''.$link_code."\n"; - - print ''.dol_print_date($db->jdate($obj->datec), 'day')."\n"; - - print ''.price($obj->amount)."\n"; - - print ' '; - - print "\n"; $i++; } } else { From ca8188ee90140d0fb9ee4ab38e53f6b0618d130f Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Thu, 12 Jan 2023 19:48:32 +0100 Subject: [PATCH 130/218] kanban mode for list of payment cheque --- .../cheque/class/remisecheque.class.php | 39 ++++++++ htdocs/compta/paiement/cheque/list.php | 91 +++++++++++++------ 2 files changed, 100 insertions(+), 30 deletions(-) diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index e193939cdd6..1e4e7d05a7d 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -1020,4 +1020,43 @@ class RemiseCheque extends CommonObject return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs; + + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + + if (property_exists($this, 'date_bordereau')) { + $return .= '
'.$langs->trans("DateCreation").' : '.dol_print_date($this->db->jdate($this->date_bordereau), 'day').''; + } + if (property_exists($this, 'nbcheque')) { + $return .= '
'.$langs->trans("Cheque", '', '', '', '', 5).' : '.$this->nbcheque.''; + } + if (property_exists($this, 'account_id')) { + $return .= ' | '.$this->account_id.''; + } + if (method_exists($this, 'LibStatut')) { + $return .= '
'.$this->LibStatut($this->statut, 5).'
'; + } + if (property_exists($this, 'amount')) { + $return .= ' |
'.$langs->trans("Amount").' : '.price($this->amount).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 054ef800586..38db4fca14b 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -44,6 +44,7 @@ $result = restrictedArea($user, 'banque', '', ''); $search_ref = GETPOST('search_ref', 'alpha'); $search_account = GETPOST('search_account', 'int'); $search_amount = GETPOST('search_amount', 'alpha'); +$mode = GETPOST('mode', 'alpha'); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -149,6 +150,9 @@ if ($resql) { $num = $db->num_rows($resql); $i = 0; $param = ''; + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.$contextpage; } @@ -160,7 +164,10 @@ if ($resql) { if (!empty($socid)) { $url .= '&socid='.$socid; } - $newcardbutton = dolGetButtonTitle($langs->trans('NewCheckDeposit'), '', 'fa fa-plus-circle', $url, '', $user->rights->banque->cheque); + $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('NewCheckDeposit'), '', 'fa fa-plus-circle', $url, '', $user->rights->banque->cheque); print ''; if ($optioncss != '') { @@ -172,6 +179,8 @@ if ($resql) { print ''; print ''; print ''; + print ''; + print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bank_account', 0, $newcardbutton, '', $limit); @@ -220,42 +229,64 @@ if ($resql) { while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); - print ''; - - // Num ref cheque - print ''; $checkdepositstatic->id = $objp->rowid; $checkdepositstatic->ref = ($objp->ref ? $objp->ref : $objp->rowid); $checkdepositstatic->statut = $objp->statut; - print $checkdepositstatic->getNomUrl(1); - print ''; + $checkdepositstatic->nbcheque = $objp->nbcheque; + $checkdepositstatic->amount = $objp->amount; + $checkdepositstatic->date_bordereau = $objp->date_bordereau; - // Date - print ''.dol_print_date($db->jdate($objp->date_bordereau), 'day').''; // TODO Use date hour + $account = new Account($db); + $account->fetch($objp->bid); + $checkdepositstatic->account_id = $account->getNomUrl(1); - // Bank - print ''; - if ($objp->bid) { - print ''.img_object($langs->trans("ShowAccount"), 'account').' '.$objp->label.''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban + print $checkdepositstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } } else { - print ' '; + print ''; + + // Num ref cheque + print ''; + + print $checkdepositstatic->getNomUrl(1); + print ''; + + // Date + print ''.dol_print_date($db->jdate($objp->date_bordereau), 'day').''; // TODO Use date hour + + // Bank + print ''; + if ($objp->bid) { + print ''.img_object($langs->trans("ShowAccount"), 'account').' '.$objp->label.''; + } else { + print ' '; + } + print ''; + + // Number of cheques + print ''.$objp->nbcheque.''; + + // Amount + print ''.price($objp->amount).''; + + // Statut + print ''; + print $checkdepositstatic->LibStatut($objp->statut, 5); + print ''; + + print ''; + + print "\n"; } - print ''; - - // Number of cheques - print ''.$objp->nbcheque.''; - - // Amount - print ''.price($objp->amount).''; - - // Statut - print ''; - print $checkdepositstatic->LibStatut($objp->statut, 5); - print ''; - - print ''; - - print "\n"; $i++; } } else { From 1b81cce3bb0a1886bfa820d4944cdd62547677a5 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Thu, 12 Jan 2023 20:46:49 +0100 Subject: [PATCH 131/218] kanban mode for list of cashcontrol --- .../compta/cashcontrol/cashcontrol_list.php | 157 ++++++++++-------- .../cashcontrol/class/cashcontrol.class.php | 32 ++++ 2 files changed, 124 insertions(+), 65 deletions(-) diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 7d433282367..b4c20a824ba 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -41,7 +41,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'cashcontrol'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') - +$mode = GETPOST('mode', 'alpha'); // for mode view result $id = GETPOST('id', 'int'); // Load variable for pagination @@ -344,6 +344,9 @@ $param = ''; if (!empty($mode)) { $param .= '&mode='.urlencode($mode); } +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -399,10 +402,13 @@ print ''; print ''; print ''; print ''; +print ''; $permforcashfence = 1; - -$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permforcashfence); +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permforcashfence); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'cash-register', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -552,81 +558,102 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); - // Show here line of result - $j = 0; - print ''; - foreach ($object->fields as $key => $val) { - $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } elseif ($key == 'status') { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; + // show kanban result + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } + // Output Kanban + //var_dump($obj->posmodule);exit; + $object->posmodule = $obj->posmodule; + $object->cash = $obj->cash; + $object->opening = $obj->opening; + $object->year_close = $obj->year_close; + $object->cheque = $obj->cheque; - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + + print $object->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; } + } else { + // Show here line of result + $j = 0; + print ''; + foreach ($object->fields as $key => $val) { + $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } elseif ($key == 'status') { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { - $cssforfield .= ($cssforfield ? ' ' : '').'right'; - } - //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; + if (in_array($val['type'], array('timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } elseif ($key == 'ref') { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } - if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; - if ($key == 'status') { - print $object->getLibStatut(5); - } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); - } else { - print $object->showOutputField($val, $key, $object->$key, ''); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; + + if (!empty($arrayfields['t.'.$key]['checked'])) { + print ''; + if ($key == 'status') { + print $object->getLibStatut(5); + } elseif ($key == 'rowid') { + print $object->showOutputField($val, $key, $object->id, ''); + } else { + print $object->showOutputField($val, $key, $object->$key, ''); + } + print ''; if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + $totalarray['nbfield']++; } - if (!isset($totalarray['val'])) { - $totalarray['val'] = array(); + if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + } + if (!isset($totalarray['val'])) { + $totalarray['val'] = array(); + } + if (!isset($totalarray['val']['t.'.$key])) { + $totalarray['val']['t.'.$key] = 0; + } + $totalarray['val']['t.'.$key] += $object->$key; } - if (!isset($totalarray['val']['t.'.$key])) { - $totalarray['val']['t.'.$key] = 0; - } - $totalarray['val']['t.'.$key] += $object->$key; } } - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Action column - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($object->id, $arrayofselected)) { - $selected = 1; + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action column + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - - print ''."\n"; + print ''."\n"; + } $i++; } diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index bc45f3b417d..01bebc35f5d 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -469,4 +469,36 @@ class CashControl extends CommonObject return $result; } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + //var_dump($this->fields['rowid']);exit; + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1, 1) : $this->ref).''; + if (property_exists($this, 'posmodule')) { + $return .= '
'.substr($langs->trans("Module/Application"), 0, 12).' : '.$this->posmodule.''; + } + if (property_exists($this, 'year_close')) { + $return .= '
'.$langs->trans("Year").' : '.$this->year_close.''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } From 256bd27c3307a0d5728856d90ad9b16d1c64bd50 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2023 21:59:34 +0100 Subject: [PATCH 132/218] Fix delete website --- htdocs/admin/website.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/website.php b/htdocs/admin/website.php index 3c348d71a12..aa2ee58853c 100644 --- a/htdocs/admin/website.php +++ b/htdocs/admin/website.php @@ -614,7 +614,7 @@ if ($id) { // Active print ''; - print ''.$actl[($obj->status ? 1 : 0)].''; + print ''.$actl[($obj->status ? 1 : 0)].''; print ""; // Modify link From 5bbfdbb77507372220dc3ee27163bc47ed357cb4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2023 22:11:13 +0100 Subject: [PATCH 133/218] NEW Show counter of access of website in website list --- htdocs/admin/website.php | 49 ++++++++++++++----- htdocs/core/lib/website.lib.php | 9 +++- .../install/mysql/migration/17.0.0-18.0.0.sql | 2 + .../mysql/tables/llx_website-website.sql | 7 +-- htdocs/langs/en_US/main.lang | 1 + htdocs/langs/en_US/website.lang | 2 + 6 files changed, 53 insertions(+), 17 deletions(-) diff --git a/htdocs/admin/website.php b/htdocs/admin/website.php index 3c348d71a12..28909470701 100644 --- a/htdocs/admin/website.php +++ b/htdocs/admin/website.php @@ -84,7 +84,7 @@ $tablib[1] = "Websites"; // Requests to extract data $tabsql = array(); -$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.position, f.status, f.date_creation FROM ".MAIN_DB_PREFIX.'website as f WHERE f.entity IN ('.getEntity('website').')'; +$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.position, f.status, f.date_creation, f.lastaccess, f.pageviews_previous_month, f.pageviews_total FROM ".MAIN_DB_PREFIX.'website as f WHERE f.entity IN ('.getEntity('website').')'; // Criteria to sort dictionaries $tabsqlsort = array(); @@ -92,7 +92,7 @@ $tabsqlsort[1] = "ref ASC"; // Nom des champs en resultat de select pour affichage du dictionnaire $tabfield = array(); -$tabfield[1] = "ref,description,virtualhost,position,date_creation"; +$tabfield[1] = "ref,description,virtualhost,position,date_creation,lastaccess,pageviews_previous_month,pageviews_total"; // Nom des champs d'edition pour modification d'un enregistrement $tabfieldvalue = array(); @@ -186,7 +186,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { $sql .= $tabrowid[$id].","; } $sql .= $tabfieldinsert[$id]; - $sql .= ",status)"; + $sql .= ", status, date_creation)"; $sql .= " VALUES("; // List of values @@ -211,7 +211,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { } $i++; } - $sql .= ",1)"; + $sql .= ", 1, '".$db->idate(dol_now())."')"; dol_syslog("actionadd", LOG_DEBUG); $result = $db->query($sql); @@ -441,12 +441,10 @@ if ($id) { // Form to add a new line if ($tabname[$id]) { - $fieldlist = explode(',', $tabfield[$id]); - // Line for title print ''; foreach ($fieldlist as $field => $value) { - if ($fieldlist[$field] == 'date_creation') { + if (in_array($fieldlist[$field], array('date_creation', 'lastaccess', 'pageviews_previous_month', 'pageviews_month', 'pageviews_total'))) { continue; } @@ -522,6 +520,7 @@ if ($id) { print ''; print ''; + print '
'; print ''; // Title of lines @@ -533,6 +532,10 @@ if ($id) { $align = "left"; $sortable = 1; $valuetoshow = ''; + if (in_array($fieldlist[$field], array('pageviews_total', 'pageviews_previous_month'))) { + $align = 'right'; + } + /* $tmparray=getLabelOfField($fieldlist[$field]); $showfield=$tmp['showfield']; @@ -554,14 +557,24 @@ if ($id) { if ($fieldlist[$field] == 'date_creation') { $valuetoshow = $langs->trans("DateCreation"); } + if ($fieldlist[$field] == 'lastaccess') { + $valuetoshow = $langs->trans("LastAccess"); + } + if ($fieldlist[$field] == 'pageviews_previous_month') { + $valuetoshow = $langs->trans("PagesViewedPreviousMonth"); + } + if ($fieldlist[$field] == 'pageviews_total') { + $valuetoshow = $langs->trans("PagesViewedTotal"); + } // Affiche nom du champ if ($showfield) { - print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), "", "align=".$align, $sortfield, $sortorder); + print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), "", '', $sortfield, $sortorder, $align.' '); } } - print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "status", ($page ? 'page='.$page.'&' : ''), "", 'align="center"', $sortfield, $sortorder); + // Status + print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "status", ($page ? 'page='.$page.'&' : ''), "", '', $sortfield, $sortorder, 'center '); print getTitleFieldOfList(''); print getTitleFieldOfList(''); print ''; @@ -581,8 +594,9 @@ if ($id) { fieldListWebsites($fieldlist, $obj, $tabname[$id], 'edit'); } - print ''; + print ''; } else { $tmpaction = 'view'; $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); @@ -593,13 +607,16 @@ if ($id) { if (empty($reshook)) { foreach ($fieldlist as $field => $value) { $showfield = 1; - $align = "left"; $fieldname = $fieldlist[$field]; + $align = "left"; + if (in_array($fieldname, array('pageviews_total', 'pageviews_previous_month'))) { + $align = 'right'; + } $valuetoshow = $obj->$fieldname; // Show value for field if ($showfield) { - print ''; + print ''; } } } @@ -612,6 +629,7 @@ if ($id) { $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '').'&'; + // Active print '
 '; - print '  '; + print ''; + print ' '.$valuetoshow.''.$valuetoshow.''; print ''.$actl[($obj->status ? 1 : 0)].''; @@ -633,6 +651,7 @@ if ($id) { } print '
'; + print '
'; print ''; } @@ -668,6 +687,10 @@ function fieldListWebsites($fieldlist, $obj = '', $tabname = '', $context = '') $formadmin = new FormAdmin($db); foreach ($fieldlist as $field => $value) { + if (in_array($fieldlist[$field], array('lastaccess', 'pageviews_previous_month', 'pageviews_month', 'pageviews_total'))) { + continue; + } + $fieldname = $fieldlist[$field]; if ($fieldlist[$field] == 'lang') { diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 32a6d9d962a..de5779a3f51 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -438,7 +438,14 @@ function dolWebsiteIncrementCounter($websiteid, $websitepagetype, $websitepageid if (in_array($websitepagetype, array('blogpost', 'page'))) { global $db; - $sql = "UPDATE ".$db->prefix()."website SET pageviews_total = pageviews_total + 1, lastaccess = '".$db->idate(dol_now())."'"; + $tmpnow = dol_getdate(dol_now('gmt'), true, 'gmt'); + + $sql = "UPDATE ".$db->prefix()."website SET "; + $sql .= " pageviews_total = pageviews_total + 1,"; + $sql .= " pageviews_month = pageviews_month + 1,"; + // if last access was done during previous month, we save pageview_month into pageviews_previous_month + $sql .= " pageviews_previous_month = ".$db->ifsql("lastaccess < '".$db->idate(dol_mktime(0, 0, 0, $tmpnow['month'], 1, $tmpnow['year'], 'gmt', 0), 'gmt')."'", 'pageviews_month', 'pageviews_previous_month').","; + $sql .= " lastaccess = '".$db->idate(dol_now('gmt'), 'gmt')."'"; $sql .= " WHERE rowid = ".((int) $websiteid); $resql = $db->query($sql); if (! $resql) { diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql index 376d89861f2..d8e1b4c12c9 100644 --- a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -59,3 +59,5 @@ INSERT INTO llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2 ALTER TABLE llx_user ADD COLUMN flagdelsessionsbefore datetime DEFAULT NULL; +ALTER TABLE llx_website ADD COLUMN pageviews_previous_month BIGINT UNSIGNED DEFAULT 0; + diff --git a/htdocs/install/mysql/tables/llx_website-website.sql b/htdocs/install/mysql/tables/llx_website-website.sql index 0df6ccf8ef3..8ac580919aa 100644 --- a/htdocs/install/mysql/tables/llx_website-website.sql +++ b/htdocs/install/mysql/tables/llx_website-website.sql @@ -36,9 +36,10 @@ CREATE TABLE llx_website fk_user_modif integer, date_creation datetime, position integer DEFAULT 0, - lastaccess datetime NULL, - pageviews_month BIGINT UNSIGNED DEFAULT 0, - pageviews_total BIGINT UNSIGNED DEFAULT 0, + lastaccess datetime NULL, -- updated at each page access + pageviews_previous_month BIGINT UNSIGNED DEFAULT 0, + pageviews_month BIGINT UNSIGNED DEFAULT 0, -- increased by 1 at each page access, saved into pageviews_previous_month when on different month than lastaccess + pageviews_total BIGINT UNSIGNED DEFAULT 0, -- increased by 1 at each page access, no reset tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 2473659a5c7..bdd0ef2bd0d 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1216,3 +1216,4 @@ NoSpecificContactAddress=No specific contact or address NoSpecificContactAddressBis=This tab is dedicated to force specific contacts or addresses for the current object. Use it only if you want to define one or several specific contacts or addresses for the object when the information on the thirdparty is not enough or not accurate. HideOnVCard=Hide %s AddToContacts=Add address to my contacts +LastAccess=Last access \ No newline at end of file diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index 742e3afff67..7b2cc90f7ac 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -155,3 +155,5 @@ WebpageMustBeDisabled=The web page must have the status "%s" SetWebsiteOnlineBefore=When website is offline, all pages are offline. Change status of website first. Booking=Booking Reservation=Reservation +PagesViewedPreviousMonth=Pages viewed (previous month) +PagesViewedTotal=Pages viewed (total) \ No newline at end of file From 22720b652ca6d50a1939fb98d5d2d314201f98e6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2023 22:28:08 +0100 Subject: [PATCH 134/218] Fix phpcs --- htdocs/fourn/facture/list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index deeecc3af6f..9b790050571 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -766,11 +766,11 @@ if ($limit > 0 && $limit != $conf->liste_limit) { if ($search_all) { $param .= '&search_all='.urlencode($search_all); } - if ($search_date_start) { - $param .= buildParamDate('search_date_start', null, '', 'tzserver'); +if ($search_date_start) { + $param .= buildParamDate('search_date_start', null, '', 'tzserver'); } - if ($search_date_end) { - $param .= buildParamDate('search_date_end', null, '', 'tzserver'); +if ($search_date_end) { + $param .= buildParamDate('search_date_end', null, '', 'tzserver'); } if ($search_datelimit_startday) { $param .= '&search_datelimit_startday='.urlencode($search_datelimit_startday); From 59a541ab8e43c413dbb5e6a0e6bc0eb42cfd0dfa Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 13 Jan 2023 10:33:48 +0100 Subject: [PATCH 135/218] NEW: Add SQL contraint on product_stock table to allow only exsting product and warehouse#23543 --- .../install/mysql/migration/17.0.0-18.0.0.sql | 36 +++++++++++++++++++ .../mysql/tables/llx_product_stock.key.sql | 2 ++ 2 files changed, 38 insertions(+) create mode 100644 htdocs/install/mysql/migration/17.0.0-18.0.0.sql diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql new file mode 100644 index 00000000000..4e68aebfdc8 --- /dev/null +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -0,0 +1,36 @@ +-- +-- Be carefull to requests order. +-- This file must be loaded by calling /install/index.php page +-- when current version is 16.0.0 or higher. +-- +-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field); +-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table; +-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex; +-- To make pk to be auto increment (mysql): +-- -- VMYSQL4.3 ALTER TABLE llx_table ADD PRIMARY KEY(rowid); +-- -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres): +-- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid; +-- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid); +-- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq'); +-- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table; +-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL; +-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; +-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL; +-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL; +-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; +-- Note: fields with type BLOB/TEXT can't have default value. +-- To rebuild sequence for postgresql after insert by forcing id autoincrement fields: +-- -- VPGSQL8.2 SELECT dol_util_rebuild_sequences(); + + +ALTER TABLE llx_product_stock ADD CONSTRAINT fk_product_product_rowid FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); +ALTER TABLE llx_product_stock ADD CONSTRAINT fk_entrepot_entrepot_rowid FOREIGN KEY (fk_entrepot) REFERENCES llx_entrepot (rowid); diff --git a/htdocs/install/mysql/tables/llx_product_stock.key.sql b/htdocs/install/mysql/tables/llx_product_stock.key.sql index 358a0c74f19..b07719a5478 100644 --- a/htdocs/install/mysql/tables/llx_product_stock.key.sql +++ b/htdocs/install/mysql/tables/llx_product_stock.key.sql @@ -20,5 +20,7 @@ ALTER TABLE llx_product_stock ADD INDEX idx_product_stock_fk_product (fk_product); ALTER TABLE llx_product_stock ADD INDEX idx_product_stock_fk_entrepot (fk_entrepot); +ALTER TABLE llx_product_stock ADD CONSTRAINT fk_product_product_rowid FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); +ALTER TABLE llx_product_stock ADD CONSTRAINT fk_entrepot_entrepot_rowid FOREIGN KEY (fk_entrepot) REFERENCES llx_entrepot (rowid); ALTER TABLE llx_product_stock ADD UNIQUE INDEX uk_product_stock (fk_product,fk_entrepot); From a06a5d0f65e47010263b4d3aa5825ece10dc35e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Jan 2023 11:09:06 +0100 Subject: [PATCH 136/218] Fix lang file not loaded --- scripts/emailings/mailing-send.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index fcaa40e1fde..71d1604df4e 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -66,6 +66,8 @@ if (empty($conf->global->MAILING_LIMIT_SENDBYCLI)) $conf->global->MAILING_LIMIT_SENDBYCLI = 0; } +$langs->loadLangs(array("main", "mails")); + /* * Main From fb25fcc46757ad201705a70d07c5f21bdfe90021 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 13 Jan 2023 11:22:45 +0100 Subject: [PATCH 137/218] kanban mode forl skill's list --- htdocs/hrm/class/skill.class.php | 31 +++++++ htdocs/hrm/skill_list.php | 153 ++++++++++++++++++------------- 2 files changed, 122 insertions(+), 62 deletions(-) diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 0cdc63ec24e..5f58412b65a 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -1113,4 +1113,35 @@ class Skill extends CommonObject } return $result; } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $selected, $langs; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + $return .= ''; + if (property_exists($this, 'skill_type')) { + $return .= '
'.$langs->trans("Type").''; + $return .= ' : '.$this->fields['skill_type']['arrayofkeyval'][$this->skill_type].''; + } + if (property_exists($this, 'description')) { + $return .= '
'.$langs->trans("Description").' : '; + $return .= '
'.(strlen($this->description) > 30 ? dol_substr($this->description, 0, 25).'...' : $this->description).''; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/hrm/skill_list.php b/htdocs/hrm/skill_list.php index ddf385b170e..03302a812ff 100644 --- a/htdocs/hrm/skill_list.php +++ b/htdocs/hrm/skill_list.php @@ -54,7 +54,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'skilllist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') - +$mode = GETPOST('mode', 'alpha'); // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -347,6 +347,9 @@ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', ''); $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -398,8 +401,12 @@ print ''; print ''; print ''; print ''; +print ''; -$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/hrm/skill_card.php?action=create', '', $permissiontoadd); +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/hrm/skill_card.php?action=create', '', $permissiontoadd); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -546,78 +553,100 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); - // Show here line of result - print ''; - foreach ($object->fields as $key => $val) { - $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } elseif ($key == 'status') { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } + // Output Kanban - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } + $object->skill_type = $obj->skill_type; + $object->description = $obj->description; - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { - $cssforfield .= ($cssforfield ? ' ' : '').'right'; - } - //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; - - if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; - if ($key == 'status') { - print $object->getLibStatut(5); - } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); - } elseif ($key == 'label') { - print $object->getNomUrl(1); - } else { - print $object->showOutputField($val, $key, $object->$key, ''); + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; } - print ''; - if (!$i) { - $totalarray['nbfield']++; + print $object->getKanbanView(''); + } + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + // Show here line of result + print ''; + foreach ($object->fields as $key => $val) { + $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } elseif ($key == 'status') { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; } - if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + + if (in_array($val['type'], array('timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } elseif ($key == 'ref') { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } + + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { + $cssforfield .= ($cssforfield ? ' ' : '').'right'; + } + //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; + + if (!empty($arrayfields['t.'.$key]['checked'])) { + print ''; + if ($key == 'status') { + print $object->getLibStatut(5); + } elseif ($key == 'rowid') { + print $object->showOutputField($val, $key, $object->id, ''); + } elseif ($key == 'label') { + print $object->getNomUrl(1); + } else { + print $object->showOutputField($val, $key, $object->$key, ''); + } + print ''; if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + $totalarray['nbfield']++; } - if (!isset($totalarray['val'])) { - $totalarray['val'] = array(); + if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + } + if (!isset($totalarray['val'])) { + $totalarray['val'] = array(); + } + if (!isset($totalarray['val']['t.'.$key])) { + $totalarray['val']['t.'.$key] = 0; + } + $totalarray['val']['t.'.$key] += $object->$key; } - if (!isset($totalarray['val']['t.'.$key])) { - $totalarray['val']['t.'.$key] = 0; - } - $totalarray['val']['t.'.$key] += $object->$key; } } - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Action column - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($object->id, $arrayofselected)) { - $selected = 1; + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action column + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - - print ''."\n"; + print ''."\n"; + } $i++; } From 336ac00ae382c803d3cb5824443d6b5d347dc918 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 13 Jan 2023 11:40:50 +0100 Subject: [PATCH 138/218] kanban mode for list of jobs --- htdocs/hrm/class/job.class.php | 31 +++++++ htdocs/hrm/job_list.php | 153 ++++++++++++++++++++------------- 2 files changed, 123 insertions(+), 61 deletions(-) diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php index 93950979a1a..a013bb57a36 100644 --- a/htdocs/hrm/class/job.class.php +++ b/htdocs/hrm/class/job.class.php @@ -1054,6 +1054,37 @@ class Job extends CommonObject return $error; } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $selected, $langs; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + $return .= ''; + if (property_exists($this, 'deplacement')) { + $return .= '
'.$langs->trans("Type").''; + $return .= ' : '.$this->fields['deplacement']['arrayofkeyval'][$this->deplacement].''; + } + if (property_exists($this, 'description') && !(empty($this->description))) { + $return .= '
'.$langs->trans("Description").' : '; + $return .= '
'.(strlen($this->description) > 30 ? dol_substr($this->description, 0, 25).'...' : $this->description).''; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/hrm/job_list.php b/htdocs/hrm/job_list.php index ed0fb480a3a..6e97c0d0483 100644 --- a/htdocs/hrm/job_list.php +++ b/htdocs/hrm/job_list.php @@ -52,6 +52,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'joblist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$mode = GETPOST('mode', 'alpha'); // for view result with other mode $id = GETPOST('id', 'int'); @@ -362,6 +363,9 @@ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', ''); $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -413,8 +417,13 @@ print ''; print ''; print ''; print ''; +print ''; -$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/job_card.php', 1).'?action=create', '', $permissiontoadd); + +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/job_card.php', 1).'?action=create', '', $permissiontoadd); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -561,78 +570,100 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); - // Show here line of result - print ''; - foreach ($object->fields as $key => $val) { - $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } elseif ($key == 'status') { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } + // Output Kanban - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } + $object->deplacement = $obj->deplacement; + $object->description = $obj->description; - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { - $cssforfield .= ($cssforfield ? ' ' : '').'right'; - } - //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; - - if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; - if ($key == 'status') { - print $object->getLibStatut(5); - } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); - } elseif ($key == 'label') { - print $object->getNomUrl(1); - } else { - print $object->showOutputField($val, $key, $object->$key, ''); + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; } - print ''; - if (!$i) { - $totalarray['nbfield']++; + print $object->getKanbanView(''); + } + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + // Show here line of result + print ''; + foreach ($object->fields as $key => $val) { + $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } elseif ($key == 'status') { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; } - if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + + if (in_array($val['type'], array('timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } elseif ($key == 'ref') { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } + + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { + $cssforfield .= ($cssforfield ? ' ' : '').'right'; + } + //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; + + if (!empty($arrayfields['t.'.$key]['checked'])) { + print ''; + if ($key == 'status') { + print $object->getLibStatut(5); + } elseif ($key == 'rowid') { + print $object->showOutputField($val, $key, $object->id, ''); + } elseif ($key == 'label') { + print $object->getNomUrl(1); + } else { + print $object->showOutputField($val, $key, $object->$key, ''); + } + print ''; if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + $totalarray['nbfield']++; } - if (!isset($totalarray['val'])) { - $totalarray['val'] = array(); + if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + } + if (!isset($totalarray['val'])) { + $totalarray['val'] = array(); + } + if (!isset($totalarray['val']['t.'.$key])) { + $totalarray['val']['t.'.$key] = 0; + } + $totalarray['val']['t.'.$key] += $object->$key; } - if (!isset($totalarray['val']['t.'.$key])) { - $totalarray['val']['t.'.$key] = 0; - } - $totalarray['val']['t.'.$key] += $object->$key; } } - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Action column - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($object->id, $arrayofselected)) { - $selected = 1; + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action column + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - - print ''."\n"; + print ''."\n"; + } $i++; } From 8eb89e0ad14015ec4080042db82581cdf026bcf4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Jan 2023 12:14:20 +0100 Subject: [PATCH 139/218] Remove merged feature with too many pb: 1=Not yet implemented everywhere. 2=Seems a duplicate info with the picto warning when late (so in past not done) 3=Is also a duplicate with the existing css event-future, event-past, event-current 4=It overwrites to choice done by the theme 5=Implementation is wrong, it must use css and not #background Use CSS instead --- htdocs/admin/agenda_other.php | 82 ++----------------------------- htdocs/admin/agenda_reminder.php | 1 - htdocs/comm/action/index.php | 1 + htdocs/comm/action/list.php | 21 ++++---- htdocs/core/lib/functions.lib.php | 2 +- htdocs/langs/en_US/admin.lang | 1 + htdocs/theme/eldy/global.inc.php | 4 ++ 7 files changed, 20 insertions(+), 92 deletions(-) diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 8916433707d..aef46db26ef 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -113,33 +113,6 @@ if ($action == 'set') { } else { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); } -} elseif ($action == 'setcolors') { - $event_color = preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('event_past_color', 'alphanohtml')); - $res = dolibarr_set_const($db, 'AGENDA_EVENT_PAST_COLOR', $event_color, 'chaine', 0, '', $conf->entity); - if (!$res > 0) { - $error++; - $errors[] = $db->lasterror(); - } - - $event_color = preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('event_current_color', 'alphanohtml')); - $res = dolibarr_set_const($db, 'AGENDA_EVENT_CURRENT_COLOR', $event_color, 'chaine', 0, '', $conf->entity); - if (!$res > 0) { - $error++; - $errors[] = $db->lasterror(); - } - - $event_color = preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('event_future_color', 'alphanohtml')); - $res = dolibarr_set_const($db, 'AGENDA_EVENT_FUTURE_COLOR', $event_color, 'chaine', 0, '', $conf->entity); - if (!$res > 0) { - $error++; - $errors[] = $db->lasterror(); - } - - if ($error) { - setEventMessages('', $errors, 'errors'); - } else { - setEventMessage($langs->trans('SetupSaved')); - } } elseif ($action == 'specimen') { // For orders $modele = GETPOST('module', 'alpha'); @@ -226,8 +199,6 @@ print dol_get_fiche_head($head, 'other', $langs->trans("Agenda"), -1, 'action'); * Miscellaneous */ -print load_fiche_titre($langs->trans('Miscellaneous'), '', ''); - // Define array def of models $def = array(); @@ -339,8 +310,11 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { } } print '
'; + + print load_fiche_titre($langs->trans('MiscellaneousOptions'), '', ''); } + print '
'; print ''; print ''; @@ -431,56 +405,6 @@ print $form->buttonsSaveCancel("Save", ''); print '
'; -/* - * User interface (colors) - */ - -print load_fiche_titre($langs->trans('UserInterface'), '', ''); - -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -$formother = new FormOther($db); - -print '
'; -print ''; -print ''; - -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; - -// AGENDA_EVENT_PAST_COLOR -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -// AGENDA_EVENT_CURRENT_COLOR -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -// AGENDA_EVENT_FUTURE_COLOR -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; - -print '
'.$langs->trans("Parameters").' '.$langs->trans("Value").'
'.$langs->trans('AGENDA_EVENT_PAST_COLOR').' '."\n"; -print $formother->selectColor($conf->global->AGENDA_EVENT_PAST_COLOR, 'event_past_color'); -print '
'.$langs->trans('AGENDA_EVENT_CURRENT_COLOR').' '."\n"; -print $formother->selectColor($conf->global->AGENDA_EVENT_CURRENT_COLOR, 'event_current_color'); -print '
'.$langs->trans('AGENDA_EVENT_FUTURE_COLOR').' '."\n"; -print $formother->selectColor($conf->global->AGENDA_EVENT_FUTURE_COLOR, 'event_future_color'); -print '
'; - -print $form->buttonsSaveCancel("Save", ''); - -print '
'; - -print "
"; - print dol_get_fiche_end(); // End of page diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index 76c717b669d..42967b4f275 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -150,7 +150,6 @@ $linkback = 'trans("Agenda"), -1, 'action'); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 5b51d48392b..3460355a803 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -299,6 +299,7 @@ if (empty($user->conf->AGENDA_DISABLE_EXT)) { $enabled = 'AGENDA_EXT_ENABLED_'.$user->id.'_'.$i; $default = 'AGENDA_EXT_ACTIVEBYDEFAULT_'.$user->id.'_'.$i; $buggedfile = 'AGENDA_EXT_BUGGEDFILE_'.$user->id.'_'.$i; + if (getDolUserString($source) && getDolUserString($name)) { // Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight' $listofextcals[] = array( diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index dd137690e47..5abd2d3f101 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -951,14 +951,15 @@ while ($i < $imaxinloop) { $event_owner_style .= 'border-left: #' . $cache_user_list[$obj->fk_user_action]->color . ' 5px solid;'; } - // get event style for start date + // get event style for start and end date $event_more_class = ''; - $event_start_date_style = ''; + $event_start_date_css = ''; + $event_end_date_css = ''; $event_start_date_time = $actionstatic->datep; if ($event_start_date_time > $now) { // future event $event_more_class = 'event-future'; - $event_start_date_color = $conf->global->AGENDA_EVENT_FUTURE_COLOR; + $event_start_date_css = $event_end_date_css = $event_more_class; } else { if ($obj->fulldayevent == 1) { $today_start_date_time = $today_start_time; @@ -971,20 +972,16 @@ while ($i < $imaxinloop) { if ($event_end_date_time != null && $event_end_date_time < $today_start_date_time) { // past event $event_more_class = 'event-past'; - $event_start_date_color = $conf->global->AGENDA_EVENT_PAST_COLOR; } elseif ($event_end_date_time == null && $event_start_date_time < $today_start_date_time) { // past event $event_more_class = 'event-past'; - $event_start_date_color = $conf->global->AGENDA_EVENT_PAST_COLOR; } else { // current event $event_more_class = 'event-current'; - $event_start_date_color = $conf->global->AGENDA_EVENT_CURRENT_COLOR; } + $event_start_date_css = $event_end_date_css = $event_more_class; } - if ($event_start_date_color != '') { - $event_start_date_style .= 'background: #' . $event_start_date_color . ';'; - } + $event_start_date_css = $event_end_date_css = $event_more_class; print ''; // Action column @@ -1065,13 +1062,14 @@ while ($i < $imaxinloop) { // Start date if (!empty($arrayfields['a.datep']['checked'])) { - print ''; + print ''; if (empty($obj->fulldayevent)) { print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuserrel'); } else { $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); print dol_print_date($db->jdate($obj->dp), $formatToUse, ($tzforfullday ? $tzforfullday : 'tzuserrel')); } + print ''; $late = 0; if ($actionstatic->hasDelay() && $actionstatic->percentage >= 0 && $actionstatic->percentage < 100 ) { $late = 1; @@ -1084,13 +1082,14 @@ while ($i < $imaxinloop) { // End date if (!empty($arrayfields['a.datep2']['checked'])) { - print ''; + print ''; if (empty($obj->fulldayevent)) { print dol_print_date($db->jdate($obj->dp2), $formatToUse, 'tzuserrel'); } else { $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); print dol_print_date($db->jdate($obj->dp2), $formatToUse, ($tzforfullday ? $tzforfullday : 'tzuserrel')); } + print ''; print ''; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8920445508a..ab96f650b6f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -116,7 +116,7 @@ function getDolUserString($key, $default = '', $tmpuser = null) } // return $conf->global->$key ?? $default; - return (string) (empty($tmpuser->conf->$key) ? $default : $$tmpuser->conf->$key); + return (string) (empty($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key); } /** diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 6cc135e3b2c..db11289d299 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1272,6 +1272,7 @@ TriggerActiveAsModuleActive=Triggers in this file are active as module %s GeneratedPasswordDesc=Choose the method to be used for auto-generated passwords. DictionaryDesc=Insert all reference data. You can add your values to the default. ConstDesc=This page allows you to edit (override) parameters not available in other pages. These are mostly reserved parameters for developers/advanced troubleshooting only. +MiscellaneousOptions=Miscellaneous options MiscellaneousDesc=All other security related parameters are defined here. LimitsSetup=Limits/Precision setup LimitsDesc=You can define limits, precisions and optimizations used by Dolibarr here diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index b9e35e1e9ea..0ba59834d71 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5428,6 +5428,10 @@ td.cal_other_month { opacity: 0.8; } +td.event-past span { + opacity: 0.5; +} + /* ============================================================================== */ From 354b94abce48f77fad507376d8f6b803b2c9ac84 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Jan 2023 12:24:28 +0100 Subject: [PATCH 140/218] Merge manually #23539 --- htdocs/public/onlinesign/newonlinesign.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index f0738f0e420..c7c90b90229 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -545,6 +545,8 @@ if ($action == "dosign" && empty($cancel)) { $("#signbutton").attr("disabled",false); if(!$._data($("#signbutton")[0], "events")){ $("#signbutton").on("click",function(){ + console.log("We click on button sign"); + $("#signbutton").val(\''.dol_escape_js($langs->transnoentities('PleaseBePatient')).'\'); var signature = $("#signature").jSignature("getData", "image"); $.ajax({ type: "POST", From d823971151a1145659a9920464664d973e3b4381 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 13 Jan 2023 12:31:40 +0100 Subject: [PATCH 141/218] kanban for evaluation list --- htdocs/hrm/class/evaluation.class.php | 35 ++++++ htdocs/hrm/evaluation_list.php | 151 ++++++++++++++++---------- 2 files changed, 129 insertions(+), 57 deletions(-) diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index 4a41f1c8e0e..5a628725f95 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -1055,4 +1055,39 @@ class Evaluation extends CommonObject return $error; } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $selected, $langs; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + $return .= ''; + if (property_exists($this, 'fk_user') && !(empty($this->fk_user))) { + $return .= '
'.$langs->trans("Employee").' : '; + $return .= ''.$this->fk_user.''; + } + if (property_exists($this, 'fk_job') && !(empty($this->fk_job))) { + $return .= '
'.$langs->trans("Job").' : '; + $return .= ''.$this->fk_job.''; + } + + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= ''; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/hrm/evaluation_list.php b/htdocs/hrm/evaluation_list.php index dea398ad6a6..999d6d0d44e 100644 --- a/htdocs/hrm/evaluation_list.php +++ b/htdocs/hrm/evaluation_list.php @@ -52,6 +52,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'evaluationlist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$mode = GETPOST('mode', 'alpha'); // for mode view result $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); @@ -369,6 +370,9 @@ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', ''); $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -420,8 +424,12 @@ print ''; print ''; print ''; print ''; +print ''; -$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/evaluation_card.php', 1).'?action=create', '', $permissiontoadd); +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/evaluation_card.php', 1).'?action=create', '', $permissiontoadd); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -568,75 +576,104 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); - // Show here line of result - print ''; - foreach ($object->fields as $key => $val) { - $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } elseif ($key == 'status') { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } + // Output Kanban + $object->date_eval = $obj->date_eval; - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } + $job = new job($db); + $job->fetch($obj->fk_job); + $object->fk_job = $job->getNomUrl(); - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { - $cssforfield .= ($cssforfield ? ' ' : '').'right'; - } - //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; + $userstatic = new User($db); + $userstatic->fetch($obj->fk_user); + $object->fk_user = $userstatic->getNomUrl(1); - if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; - if ($key == 'status') { - print $object->getLibStatut(5); - } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); - } else { - print $object->showOutputField($val, $key, $object->$key, ''); + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; } - print ''; - if (!$i) { - $totalarray['nbfield']++; + print $object->getKanbanView(''); + } + if ($i == ($imaxinloop - 1)) { + print '
'; + print ''; + } + } else { + // Show here line of result + print ''; + foreach ($object->fields as $key => $val) { + $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } elseif ($key == 'status') { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; } - if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + + if (in_array($val['type'], array('timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } elseif ($key == 'ref') { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } + + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { + $cssforfield .= ($cssforfield ? ' ' : '').'right'; + } + //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; + + if (!empty($arrayfields['t.'.$key]['checked'])) { + print ''; + if ($key == 'status') { + print $object->getLibStatut(5); + } elseif ($key == 'rowid') { + print $object->showOutputField($val, $key, $object->id, ''); + } else { + print $object->showOutputField($val, $key, $object->$key, ''); + } + print ''; if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + $totalarray['nbfield']++; } - if (!isset($totalarray['val'])) { - $totalarray['val'] = array(); + if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + } + if (!isset($totalarray['val'])) { + $totalarray['val'] = array(); + } + if (!isset($totalarray['val']['t.'.$key])) { + $totalarray['val']['t.'.$key] = 0; + } + $totalarray['val']['t.'.$key] += $object->$key; } - if (!isset($totalarray['val']['t.'.$key])) { - $totalarray['val']['t.'.$key] = 0; - } - $totalarray['val']['t.'.$key] += $object->$key; } } - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Action column - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($object->id, $arrayofselected)) { - $selected = 1; + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action column + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - print ''."\n"; + print ''."\n"; + } $i++; } From 2d3f7d949e56f88896637afde42afb444aa2e4a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Jan 2023 12:53:56 +0100 Subject: [PATCH 142/218] Fix warnings --- htdocs/compta/resultat/result.php | 128 ++++++++++++++++++++++-------- 1 file changed, 97 insertions(+), 31 deletions(-) diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 8615e595200..94a957a5c40 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -335,7 +335,7 @@ if ($modecompta == 'CREANCES-DETTES') { // Previous Fiscal year (N-1) foreach ($sommes as $code => $det) { - $vars[$code] = $det['NP']; + $vars[$code] = empty($det['NP']) ? 0 : $det['NP']; } $result = strtr($formula, $vars); @@ -355,12 +355,16 @@ if ($modecompta == 'CREANCES-DETTES') { // Year N $code = $cat['code']; // code of categorie ('VTE', 'MAR', ...) - $sommes[$code]['NP'] += $r; + if (empty($sommes[$code]['NP'])) { + $sommes[$code]['NP'] = $r; + } else { + $sommes[$code]['NP'] += $r; + } // Current fiscal year (N) if (is_array($sommes) && !empty($sommes)) { foreach ($sommes as $code => $det) { - $vars[$code] = $det['N']; + $vars[$code] = empty($det['N']) ? 0 : $det['N']; } } @@ -371,13 +375,17 @@ if ($modecompta == 'CREANCES-DETTES') { $r = dol_eval($result, 1, 1, '1'); print ''.price($r).''; - $sommes[$code]['N'] += $r; + if (empty($sommes[$code]['N'])) { + $sommes[$code]['N'] = $r; + } else { + $sommes[$code]['N'] += $r; + } // Detail by month foreach ($months as $k => $v) { if (($k + 1) >= $date_startmonth) { foreach ($sommes as $code => $det) { - $vars[$code] = $det['M'][$k]; + $vars[$code] = empty($det['M'][$k]) ? 0 : $det['M'][$k]; } $result = strtr($formula, $vars); $result = str_replace('--', '+', $result); @@ -386,14 +394,18 @@ if ($modecompta == 'CREANCES-DETTES') { $r = dol_eval($result, 1, 1, '1'); print ''.price($r).''; - $sommes[$code]['M'][$k] += $r; + if (empty($sommes[$code]['M'][$k])) { + $sommes[$code]['M'][$k] = $r; + } else { + $sommes[$code]['M'][$k] += $r; + } } } foreach ($months as $k => $v) { if (($k + 1) < $date_startmonth) { foreach ($sommes as $code => $det) { - $vars[$code] = $det['M'][$k]; + $vars[$code] = empty($det['M'][$k]) ? 0 : $det['M'][$k]; } $result = strtr($formula, $vars); $result = str_replace('--', '+', $result); @@ -402,7 +414,11 @@ if ($modecompta == 'CREANCES-DETTES') { $r = dol_eval($result, 1, 1, '1'); print ''.price($r).''; - $sommes[$code]['M'][$k] += $r; + if (empty($sommes[$code]['M'][$k])) { + $sommes[$code]['M'][$k] = $r; + } else { + $sommes[$code]['M'][$k] += $r; + } } } @@ -429,14 +445,14 @@ if ($modecompta == 'CREANCES-DETTES') { $arrayofaccountforfilter = array(); foreach ($cpts as $i => $cpt) { // Loop on each account. - if (!is_null($cpt['account_number'])) { + if (isset($cpt['account_number'])) { $arrayofaccountforfilter[] = $cpt['account_number']; } } // N-1 if (!empty($arrayofaccountforfilter)) { - $return = $AccCat->getSumDebitCredit($arrayofaccountforfilter, $date_start_previous, $date_end_previous, $cat['dc'] ? $cat['dc'] : 0); + $return = $AccCat->getSumDebitCredit($arrayofaccountforfilter, $date_start_previous, $date_end_previous, empty($cat['dc']) ? 0 : $cat['dc']); if ($return < 0) { setEventMessages(null, $AccCat->errors, 'errors'); $resultNP = 0; @@ -444,8 +460,16 @@ if ($modecompta == 'CREANCES-DETTES') { foreach ($cpts as $i => $cpt) { // Loop on each account found $resultNP = empty($AccCat->sdcperaccount[$cpt['account_number']]) ? 0 : $AccCat->sdcperaccount[$cpt['account_number']]; - $totCat['NP'] += $resultNP; - $sommes[$code]['NP'] += $resultNP; + if (empty($totCat['NP'])) { + $totCat['NP'] = $resultNP; + } else { + $totCat['NP'] += $resultNP; + } + if (empty($sommes[$code]['NP'])) { + $sommes[$code]['NP'] = $resultNP; + } else { + $sommes[$code]['NP'] += $resultNP; + } $totPerAccount[$cpt['account_number']]['NP'] = $resultNP; } } @@ -467,23 +491,47 @@ if ($modecompta == 'CREANCES-DETTES') { } //var_dump($monthtoprocess.'_'.$yeartoprocess); - $return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, $cat['dc'] ? $cat['dc'] : 0, 'nofilter', $monthtoprocess, $yeartoprocess); - if ($return < 0) { - setEventMessages(null, $AccCat->errors, 'errors'); - $resultM = 0; + if (isset($cpt['account_number'])) { + $return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, empty($cat['dc']) ? 0 : $cat['dc'], 'nofilter', $monthtoprocess, $yeartoprocess); + if ($return < 0) { + setEventMessages(null, $AccCat->errors, 'errors'); + $resultM = 0; + } else { + $resultM = $AccCat->sdc; + } } else { - $resultM = $AccCat->sdc; + $resultM = 0; + } + if (empty($totCat['M'][$k])) { + $totCat['M'][$k] = $resultM; + } else { + $totCat['M'][$k] += $resultM; + } + if (empty($sommes[$code]['M'][$k])) { + $sommes[$code]['M'][$k] = $resultM; + } else { + $sommes[$code]['M'][$k] += $resultM; + } + if (isset($cpt['account_number'])) { + $totPerAccount[$cpt['account_number']]['M'][$k] = $resultM; } - $totCat['M'][$k] += $resultM; - $sommes[$code]['M'][$k] += $resultM; - $totPerAccount[$cpt['account_number']]['M'][$k] = $resultM; $resultN += $resultM; } - $totCat['N'] += $resultN; - $sommes[$code]['N'] += $resultN; - $totPerAccount[$cpt['account_number']]['N'] = $resultN; + if (empty($totCat)) { + $totCat['N'] = $resultN; + } else { + $totCat['N'] += $resultN; + } + if (empty($sommes[$code]['N'])) { + $sommes[$code]['N'] = $resultN; + } else { + $sommes[$code]['N'] += $resultN; + } + if (isset($cpt['account_number'])) { + $totPerAccount[$cpt['account_number']]['N'] = $resultN; + } } @@ -543,16 +591,26 @@ if ($modecompta == 'CREANCES-DETTES') { // Loop on detail of all accounts to output the detail if ($showaccountdetail != 'no') { foreach ($cpts as $i => $cpt) { - $resultNP = $totPerAccount[$cpt['account_number']]['NP']; - $resultN = $totPerAccount[$cpt['account_number']]['N']; + if (isset($cpt['account_number'])) { + $resultNP = $totPerAccount[$cpt['account_number']]['NP']; + $resultN = $totPerAccount[$cpt['account_number']]['N']; + } else { + $resultNP = 0; + $resultN = 0; + } if ($showaccountdetail == 'all' || $resultN != 0) { print ''; print ''; - print ''; - print '     '.length_accountg($cpt['account_number']); - print ' - '; - print $cpt['account_label']; + + if (isset($cpt['account_number'])) { + $labeldetail = '     '.length_accountg($cpt['account_number']).' - '.$cpt['account_label']; + } else { + $labeldetail = '-'; + } + + print ''; + print dol_escape_htmltag($labeldetail); print ''; print ''.price($resultNP).''; print ''.price($resultN).''; @@ -560,13 +618,21 @@ if ($modecompta == 'CREANCES-DETTES') { // Make one call for each month foreach ($months as $k => $v) { if (($k + 1) >= $date_startmonth) { - $resultM = $totPerAccount[$cpt['account_number']]['M'][$k]; + if (isset($cpt['account_number'])) { + $resultM = $totPerAccount[$cpt['account_number']]['M'][$k]; + } else { + $resultM = 0; + } print ''.price($resultM).''; } } foreach ($months as $k => $v) { if (($k + 1) < $date_startmonth) { - $resultM = $totPerAccount[$cpt['account_number']]['M'][$k]; + if (isset($cpt['account_number'])) { + $resultM = empty($totPerAccount[$cpt['account_number']]['M'][$k]) ? 0 : $totPerAccount[$cpt['account_number']]['M'][$k]; + } else { + $resultM = 0; + } print ''.price($resultM).''; } } From fdfe27b5df3c6bf729d9003084c337f2e84c0072 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Jan 2023 12:55:08 +0100 Subject: [PATCH 143/218] Doc --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index f752894b4d2..3f30b2a2f99 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ English Dolibarr ChangeLog ***** ChangeLog for 18.0.0 compared to 17.0.0 ***** +NEW: PHP 8.2 compatibility: + + WARNING: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: From 276bca95d340bc0dd3fefe8b33a5739c1122aa9a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Jan 2023 13:28:40 +0100 Subject: [PATCH 144/218] CSS --- htdocs/admin/modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index db019bd262a..714d8fc7a0a 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -847,7 +847,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { if (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1) { $codeenabledisable .= ' '; $codeenabledisable .= '
'; - $codeenabledisable .= img_picto($langs->trans("Reload"), 'refresh', 'class="fa-15"'); + $codeenabledisable .= img_picto($langs->trans("Reload"), 'refresh', 'class="opacitymedium"'); $codeenabledisable .= ''; } } else { @@ -857,7 +857,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { if (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1) { $codeenabledisable .= ' '; $codeenabledisable .= ''; - $codeenabledisable .= img_picto($langs->trans("Reload"), 'refresh', 'class="fa-15"'); + $codeenabledisable .= img_picto($langs->trans("Reload"), 'refresh', 'class="opacitymedium"'); $codeenabledisable .= ''; } } From 5fc9e093eb9a51741b80c8eec6413bc0f50171b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Jan 2023 14:09:54 +0100 Subject: [PATCH 145/218] css --- htdocs/admin/modules.php | 18 ++++++++++-------- htdocs/core/modules/DolibarrModules.class.php | 4 ++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 714d8fc7a0a..ccda604d35d 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -776,15 +776,17 @@ if ($mode == 'common' || $mode == 'commonkanban') { // Version (with picto warning or not) $version = $objMod->getVersion(0); $versiontrans = ''; + $warningstring = ''; if (preg_match('/development/i', $version)) { - $versiontrans .= img_warning($langs->trans("Development"), '', 'floatleft paddingright'); + $warningstring = $langs->trans("Development"); } if (preg_match('/experimental/i', $version)) { - $versiontrans .= img_warning($langs->trans("Experimental"), '', 'floatleft paddingright'); + $warningstring = $langs->trans("Experimental"); } if (preg_match('/deprecated/i', $version)) { - $versiontrans .= img_warning($langs->trans("Deprecated"), '', 'floatleft paddingright'); + $warningstring = $langs->trans("Deprecated"); } + if ($objMod->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) { $versiontrans .= $objMod->getVersion(1); } @@ -842,7 +844,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { } else { if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) { $codeenabledisable .= 'warnings_unactivation[$mysoc->country_code]).'&value='.$modName.'&mode='.$mode.$param.'">'; - $codeenabledisable .= img_picto($langs->trans("Activated"), 'switch_on'); + $codeenabledisable .= img_picto($langs->trans("Activated").($warningstring ? ' '.$warningstring : ''), 'switch_on'); $codeenabledisable .= ''; if (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1) { $codeenabledisable .= ' '; @@ -852,7 +854,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { } } else { $codeenabledisable .= ''; - $codeenabledisable .= img_picto($langs->trans("Activated"), 'switch_on'); + $codeenabledisable .= img_picto($langs->trans("Activated").($warningstring ? ' '.$warningstring : ''), 'switch_on'); $codeenabledisable .= ''; if (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1) { $codeenabledisable .= ' '; @@ -961,7 +963,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { // Output Kanban print $objMod->getKanbanView($codeenabledisable, $codetoconfig); } else { - print ''."\n"; + print ''."\n"; if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) { print ''.$linenum.''; } @@ -995,7 +997,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { print ''; // Version - print ''; + print ''; if ($objMod->needUpdate) { $versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion; print ''.$versiontrans.''; @@ -1005,7 +1007,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { print "\n"; // Link enable/disable - print ''; + print ''; print $codeenabledisable; print "\n"; diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 4027fb0cbf2..f4b3b3eef1f 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -792,8 +792,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it * For 'experimental' modules, gives 'experimental' translation * For 'dolibarr' modules, gives Dolibarr version * - * @param int $translated 1=Special version keys are translated, 0=Special version keys are not translated - * @return string Module version + * @param int $translated 1=Special version keys are translated, 0=Special version keys are not translated + * @return string Module version */ public function getVersion($translated = 1) { From 147e3ff945a31a5e04dab6a085fb4aa32f0a7605 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 13 Jan 2023 14:13:52 +0100 Subject: [PATCH 146/218] kanban for list of holidays --- htdocs/holiday/class/holiday.class.php | 37 ++++ htdocs/holiday/list.php | 284 ++++++++++++++----------- htdocs/theme/eldy/info-box.inc.php | 5 + 3 files changed, 200 insertions(+), 126 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 9b3f0a1ce16..e8f56659de9 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2419,4 +2419,41 @@ class Holiday extends CommonObject return -1; } } + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs, $selected; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'fk_user') && !empty($this->id)) { + $return .= '| '.$this->fk_user.''; + $return .= ''; + } + if (property_exists($this, 'fk_type')) { + $return .= '
'.$langs->trans("Type").' : '; + $return .= ''.$langs->trans($this->getTypes(1, -1)[$this->fk_type]['code']).''; + } + if (property_exists($this, 'date_debut') && property_exists($this, 'date_fin')) { + $return .= '
'.dol_print_date($this->date_debut, 'day').''; + $return .= ' '.$langs->trans("To").' '; + $return .= ''.dol_print_date($this->date_fin, 'day').''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 564fb8a2a96..b16fbaf8c16 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -52,6 +52,7 @@ $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'holidaylist'; // To manage different context of search +$mode = GETPOST('mode', 'alpha'); // for switch mode view result $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') @@ -394,6 +395,9 @@ if ($resql) { $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -476,6 +480,8 @@ if ($resql) { print ''; print ''; print ''; + print ''; + if ($id > 0) { print ''; } @@ -519,7 +525,11 @@ if ($resql) { } else { $title = $langs->trans("ListeCP"); - $newcardbutton = dolGetButtonTitle($langs->trans('MenuAddCP'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/holiday/card.php?action=create', '', $user->rights->holiday->write); + + $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('MenuAddCP'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/holiday/card.php?action=create', '', $user->rights->holiday->write); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_hrm', 0, $newcardbutton, '', $limit, 0, 0, 1); } @@ -787,7 +797,8 @@ if ($resql) { $holidaystatic->id = $obj->rowid; $holidaystatic->ref = ($obj->ref ? $obj->ref : $obj->rowid); $holidaystatic->statut = $obj->status; - $holidaystatic->date_debut = $db->jdate($obj->date_debut); + $holidaystatic->date_debut = $obj->date_debut; + $holidaystatic->date_fin = $obj->date_fin; // User $userstatic->id = $obj->fk_user; @@ -815,139 +826,160 @@ if ($resql) { $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning'; $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon'; - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + + $holidaystatic->fk_type = $holidaystatic->getTypes(1, -1)[$obj->fk_type]['rowid']; + $holidaystatic->fk_user = $userstatic->getNomUrl(1); + // Output Kanban + if ($massactionbutton || $massaction) { $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { + if (in_array($object->id, $arrayofselected)) { $selected = 1; } - print ''; + print $holidaystatic->getKanbanView(''); } - print ''; - } - if (!empty($arrayfields['cp.ref']['checked'])) { - print ''; - print $holidaystatic->getNomUrl(1, 1); - print ''; - if (!$i) { - $totalarray['nbfield']++; + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; } - } - if (!empty($arrayfields['cp.fk_user']['checked'])) { - print ''.$userstatic->getNomUrl(-1, 'leave').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.fk_validator']['checked'])) { - print ''.$approbatorstatic->getNomUrl(-1).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.fk_type']['checked'])) { - $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']); - $labeltypeleavetoshow = empty($typeleaves[$obj->fk_type]['label']) ? $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type) : $labeltypeleavetoshow; - - print ''; - print $labeltypeleavetoshow; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['duration']['checked'])) { - print ''; - $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates - $totalduration += $nbopenedday; - print $nbopenedday; - //print ' '.$langs->trans('DurationDays'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.date_debut']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_debut), 'day'); - print ' ('.$langs->trans($listhalfday[$starthalfday]).')'; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.date_fin']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_fin), 'day'); - print ' ('.$langs->trans($listhalfday[$endhalfday]).')'; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date validation - if (!empty($arrayfields['cp.date_valid']['checked'])) { // date_valid is both date_valid but also date_approval - print ''; - print dol_print_date($db->jdate($obj->date_valid), 'day'); - print ''; - if (!$i) $totalarray['nbfield']++; - } - // Date approval - if (!empty($arrayfields['cp.date_approval']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_approval), 'day'); - print ''; - if (!$i) $totalarray['nbfield']++; - } - - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - // Date creation - if (!empty($arrayfields['cp.date_create']['checked'])) { - print ''.dol_print_date($date, 'dayhour').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.tms']['checked'])) { - print ''.dol_print_date($date_modif, 'dayhour').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.statut']['checked'])) { - print ''.$holidaystatic->getLibStatut(5).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; + } else { + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; } - print ''; + print ''; } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } + if (!empty($arrayfields['cp.ref']['checked'])) { + print ''; + print $holidaystatic->getNomUrl(1, 1); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.fk_user']['checked'])) { + print ''.$userstatic->getNomUrl(-1, 'leave').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.fk_validator']['checked'])) { + print ''.$approbatorstatic->getNomUrl(-1).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.fk_type']['checked'])) { + $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']); + $labeltypeleavetoshow = empty($typeleaves[$obj->fk_type]['label']) ? $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type) : $labeltypeleavetoshow; - print ''."\n"; + print ''; + print $labeltypeleavetoshow; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['duration']['checked'])) { + print ''; + $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates + $totalduration += $nbopenedday; + print $nbopenedday; + //print ' '.$langs->trans('DurationDays'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.date_debut']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_debut), 'day'); + print ' ('.$langs->trans($listhalfday[$starthalfday]).')'; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.date_fin']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_fin), 'day'); + print ' ('.$langs->trans($listhalfday[$endhalfday]).')'; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date validation + if (!empty($arrayfields['cp.date_valid']['checked'])) { // date_valid is both date_valid but also date_approval + print ''; + print dol_print_date($db->jdate($obj->date_valid), 'day'); + print ''; + if (!$i) $totalarray['nbfield']++; + } + // Date approval + if (!empty($arrayfields['cp.date_approval']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_approval), 'day'); + print ''; + if (!$i) $totalarray['nbfield']++; + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + // Date creation + if (!empty($arrayfields['cp.date_create']['checked'])) { + print ''.dol_print_date($date, 'dayhour').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.tms']['checked'])) { + print ''.dol_print_date($date_modif, 'dayhour').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.statut']['checked'])) { + print ''.$holidaystatic->getLibStatut(5).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + + print ''."\n"; + } $i++; } diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index f35516ad58e..5c010e21e26 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -492,6 +492,11 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) { max-width: 350px; } +/**for make a checkbox in the right of the box in mode kanban */ +.fright { + float:right; +} + @media only screen and (max-width: 1740px) { .info-box-module { min-width: 315px; From ee7bcc3d129bac92a35ad37563e2cad677f7c502 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 13 Jan 2023 14:16:22 +0100 Subject: [PATCH 147/218] modify style for checkbox --- htdocs/hrm/class/evaluation.class.php | 2 +- htdocs/theme/eldy/info-box.inc.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index 5a628725f95..c410ae8bd8f 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -1072,7 +1072,7 @@ class Evaluation extends CommonObject $return .= ''; $return .= '
'; $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; - $return .= ''; + $return .= ''; if (property_exists($this, 'fk_user') && !(empty($this->fk_user))) { $return .= '
'.$langs->trans("Employee").' : '; $return .= ''.$this->fk_user.''; diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index f35516ad58e..f13bd8c6c26 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -492,6 +492,10 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) { max-width: 350px; } +/**for make a checkbox in the right of the box in mode kanban */ +.fright { + float:right; +} @media only screen and (max-width: 1740px) { .info-box-module { min-width: 315px; From 782594ba5622e46dc8092ec79661440d3e77b2a1 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 13 Jan 2023 14:27:19 +0100 Subject: [PATCH 148/218] fix problem style --- htdocs/compta/cashcontrol/cashcontrol_list.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index b4c20a824ba..a1e5dae0c91 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -344,9 +344,6 @@ $param = ''; if (!empty($mode)) { $param .= '&mode='.urlencode($mode); } -if (!empty($mode)) { - $param .= '&mode='.urlencode($mode); -} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -405,6 +402,7 @@ print ''; print ''; $permforcashfence = 1; + $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); @@ -564,8 +562,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { print ''; print '
'; } - // Output Kanban - //var_dump($obj->posmodule);exit; + $object->posmodule = $obj->posmodule; $object->cash = $obj->cash; $object->opening = $obj->opening; From fcd82c93f2dd2a5e69577048fdf48f48da4ca941 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 13 Jan 2023 16:58:55 +0100 Subject: [PATCH 149/218] fix total days for both view --- htdocs/holiday/list.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index b16fbaf8c16..cef7375a4b6 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -826,6 +826,9 @@ if ($resql) { $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning'; $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon'; + $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates + $totalduration += $nbopenedday; + if ($mode == 'kanban') { if ($i == 0) { print ''; From 97061a9a922bd9f75d67f7187943391502893105 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Jan 2023 17:17:23 +0100 Subject: [PATCH 150/218] NEW Use a cache file for external RSS in calendar --- htdocs/comm/action/class/ical.class.php | 35 ++++++++++++++++++++----- htdocs/comm/action/index.php | 16 ++++++++--- htdocs/core/lib/date.lib.php | 1 + htdocs/core/lib/functions.lib.php | 16 +++++++++++ 4 files changed, 58 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index badd5db5c98..26db2cd5e6e 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -54,8 +54,8 @@ class ICal /** * Read text file, icalender text file * - * @param string $file File - * @return string + * @param string $file File + * @return string|null Content of remote file read or null if error */ public function read_file($file) { @@ -65,7 +65,7 @@ class ICal $tmpresult = getURLContent($file, 'GET'); if ($tmpresult['http_code'] != 200) { - $file_text = ''; + $file_text = null; $this->error = 'Error: '.$tmpresult['http_code'].' '.$tmpresult['content']; } else { $file_text = preg_replace("/[\r\n]{1,} /", "", $tmpresult['content']); @@ -102,17 +102,40 @@ class ICal /** * Translate Calendar * - * @param string $uri Url + * @param string $uri Url + * @param string $usecachefile Full path of a cache file to use a cache file + * @param string $delaycache Delay in seconds for cache (by default 3600 secondes) * @return array|string */ - public function parse($uri) + public function parse($uri, $usecachefile = '', $delaycache = 3600) { $this->cal = array(); // new empty array $this->event_count = -1; + $this->file_text = null; + + // Save file into a cache + if ($usecachefile) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $datefile = dol_filemtime($usecachefile); + $now = dol_now('gmt'); + //print $datefile.' '.$now.' ...'; + if ($datefile && $datefile > ($now - $delaycache)) { + // We reuse the cache file + $this->file_text = file_get_contents($usecachefile); + } + } // read FILE text - $this->file_text = $this->read_file($uri); + if (is_null($this->file_text)) { + $this->file_text = $this->read_file($uri); + + if ($usecachefile && !is_null($this->file_text)) { + // Save the file content into cache file + file_put_contents($usecachefile, $this->file_text, LOCK_EX); + dolChmod($usecachefile); + } + } $this->file_text = preg_split("[\n]", $this->file_text); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 3460355a803..b4e11125aee 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -49,6 +49,7 @@ if (empty($conf->global->AGENDA_EXT_NB)) { $conf->global->AGENDA_EXT_NB = 5; } $MAXAGENDA = $conf->global->AGENDA_EXT_NB; +$DELAYFORCACHE = 300; // 300 seconds $disabledefaultvalues = GETPOST('disabledefaultvalues', 'int'); @@ -615,7 +616,7 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on $default = ''; } - $s .= '
 
'; + $s .= '
 
'; } } @@ -1010,9 +1011,13 @@ if ($mode == 'show_day') { // Request only leaves for the current selected day $sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin"; // date_debut and date_fin are date without time } elseif ($mode == 'show_week') { - // TODO: Add filter to reduce database request + // Restrict on current month (we get more, but we will filter later) + $sql .= " AND date_debut < '".dol_get_last_day($year, $month)."'"; + $sql .= " AND date_fin >= '".dol_get_first_day($year, $month)."'"; } elseif ($mode == 'show_month') { - // TODO: Add filter to reduce database request + // Restrict on current month + $sql .= " AND date_debut <= '".dol_get_last_day($year, $month)."'"; + $sql .= " AND date_fin >= '".dol_get_first_day($year, $month)."'"; } $resql = $db->query($sql); @@ -1083,8 +1088,11 @@ if (count($listofextcals)) { $colorcal = $extcal['color']; $buggedfile = $extcal['buggedfile']; + $pathforcachefile = dol_sanitizePathName($conf->user->dir_temp).'/'.dol_sanitizeFileName('extcal_'.$namecal.'_user'.$user->id).'.cache'; + //var_dump($pathforcachefile);exit; + $ical = new ICal(); - $ical->parse($url); + $ical->parse($url, $pathforcachefile, $DELAYFORCACHE); // After this $ical->cal['VEVENT'] contains array of events, $ical->cal['DAYLIGHT'] contains daylight info, $ical->cal['STANDARD'] contains non daylight info, ... //var_dump($ical->cal); exit; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 03223a7b65a..773cb6a1a97 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -117,6 +117,7 @@ function getServerTimeZoneInt($refgmtdate = 'now') * @param int $duration_unit Unit of added delay (d, m, y, w, h, i) * @param int $ruleforendofmonth Change the behavior of PHP over data-interval, 0 or 1 * @return int New timestamp + * @see convertSecondToTime(), convertTimeToSeconds() */ function dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth = 0) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ab96f650b6f..278f70507bb 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6844,6 +6844,22 @@ function dol_mkdir($dir, $dataroot = '', $newmask = '') } +/** + * Change mod of a file + * + * @param string $filepath Full file path + * @return void + */ +function dolChmod($filepath) +{ + global $conf; + + if (!empty($conf->global->MAIN_UMASK)) { + @chmod($filepath, octdec($conf->global->MAIN_UMASK)); + } +} + + /** * Return picto saying a field is required * From 669beb50d25f810bf410bd1311e4e499c21747aa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Jan 2023 19:07:57 +0100 Subject: [PATCH 151/218] Better navigation bar for calendars --- htdocs/comm/action/index.php | 28 ++++++++++++++-------------- htdocs/comm/action/list.php | 2 +- htdocs/comm/action/pertype.php | 7 +++++-- htdocs/comm/action/peruser.php | 7 +++++-- htdocs/theme/eldy/global.inc.php | 13 +++++++++++++ htdocs/theme/md/style.css.php | 2 ++ 6 files changed, 40 insertions(+), 19 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index b4e11125aee..8ec011f5e9d 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -429,36 +429,33 @@ if ($mode == 'show_day' || $mode == 'show_week' || $mode == 'show_month') { } // Show navigation bar +$nav = ''; +$nav .= ''; $nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0); //$nav .= ' '; @@ -497,7 +494,8 @@ print ''; //print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup, '', $resourceid); //print dol_get_fiche_end(); -$viewmode = ''; +$viewmode = ''; + $viewmode .= ''; // To add a space before the navigation tools diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 5abd2d3f101..ab2037d5f76 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -600,7 +600,7 @@ $num = $db->num_rows($resql); $arrayofselected = is_array($toselect) ? $toselect : array(); // Local calendar -$newtitle = '
'; +$newtitle = '
'; $newtitle .= ' '.$langs->trans("LocalAgenda").'   '; $newtitle .= '
'; //$newtitle=$langs->trans($title); diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index ce33d0f40b2..c13de5fb183 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -368,12 +368,15 @@ $max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year, 'gmt')); $tmpday = $first_day; $picto = 'calendarweek'; -$nav = "
".img_previous($langs->trans("Previous"))."\n"; +// Show navigation bar +$nav = ''; $nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0); $nav .= ' '; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index bd35fc16e7d..0ee3b6db4a1 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -363,13 +363,16 @@ $max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year, 'gmt')); $tmpday = $first_day; $picto = 'calendarweek'; -$nav = "trans("Previous"))."\">   \n"; +// Show navigation bar +$nav = ''; $nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0); $nav .= ' '; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 0ba59834d71..061af67d2b5 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1432,6 +1432,9 @@ select.flat.selectlimit { .tablelistofcalendars { margin-top: 25px !important; } +.navselectiondate { + width: 250px; +} /* Styles for amount on card */ table.paymenttable td.amountpaymentcomplete, table.paymenttable td.amountremaintopay, table.paymenttable td.amountremaintopayback { @@ -1604,6 +1607,7 @@ table[summary="list_of_modules"] .fa-cog { .minwidth100 { min-width: 100px; } .minwidth150 { min-width: 150px; } .minwidth200 { min-width: 200px; } + .minwidth250 { min-width: 250px; } .minwidth300 { min-width: 300px; } .minwidth400 { min-width: 400px; } .minwidth500 { min-width: 500px; } @@ -1626,6 +1630,7 @@ table[summary="list_of_modules"] .fa-cog { .width125 { width: 125px; } .width150 { width: 150px; } .width200 { width: 200px; } +.width250 { width: 250px; } .width300 { width: 300px; } .width400 { width: 400px; } .width500 { width: 500px; } @@ -7532,6 +7537,14 @@ div.clipboardCPValue.hidewithsize { { .imgopensurveywizard, .imgautosize { width:95%; height: auto; } + .fiche > .listactionsfilter .table-fiche-title .col-title .titre { + display: none; + } + + .navselectiondate { + width: 220px; + } + #tooltip { position: absolute; width: px; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 39f6858570a..afc43936695 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1824,6 +1824,7 @@ tr.nobottom td { .minwidth100 { min-width: 100px; } .minwidth150 { min-width: 150px; } .minwidth200 { min-width: 200px; } + .minwidth250 { min-width: 250px; } .minwidth300 { min-width: 300px; } .minwidth400 { min-width: 400px; } .minwidth500 { min-width: 500px; } @@ -1847,6 +1848,7 @@ tr.nobottom td { .width125 { width: 125px; } .width150 { width: 150px; } .width200 { width: 200px; } +.width250 { width: 250px; } .width300 { width: 300px; } .width400 { width: 400px; } .width500 { width: 500px; } From 8efb2e8f8867bf0aa2a207daa370667bdb4f6338 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Jan 2023 19:44:35 +0100 Subject: [PATCH 152/218] Fix placeholder of status combo --- htdocs/admin/modules.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index ccda604d35d..6e0d90499d4 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -589,6 +589,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { $moreforfilter .= '
'; $moreforfilter .= $form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), $langs->trans('Origin'), 0, 0, '', 0, 0, 0, '', 'maxwidth250', 1); $moreforfilter .= '
'; + if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) { $array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable")); if ($conf->global->MAIN_FEATURES_LEVEL < 0) { @@ -601,11 +602,12 @@ if ($mode == 'common' || $mode == 'commonkanban') { $array_version['development'] = $langs->trans("Development"); } $moreforfilter .= '
'; - $moreforfilter .= $form->selectarray('search_version', $array_version, $search_version, $langs->trans('Version'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1); + $moreforfilter .= $form->selectarray('search_version', $array_version, $search_version, $langs->transnoentitiesnoconv('Version'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1); $moreforfilter .= '
'; } + $array_status = array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")); $moreforfilter .= '
'; - $moreforfilter .= $form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, $langs->trans('Status'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1); + $moreforfilter .= $form->selectarray('search_status', $array_status, $search_status, $langs->transnoentitiesnoconv('Status'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1); $moreforfilter .= '
'; $moreforfilter .= ' '; $moreforfilter .= '
'; From 00415dfe54a9fe505ef89ebc5846aca2461aa3a9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Jan 2023 19:53:31 +0100 Subject: [PATCH 153/218] css --- htdocs/theme/eldy/global.inc.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 061af67d2b5..bef2e6e7800 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2012,11 +2012,12 @@ td.showDragHandle { z-index: 1005; } -global->THEME_DARKMODEENABLED)) { ?> -.side-nav-vert { - border-bottom: 1px solid #888; + +@media screen and (prefers-color-scheme: dark) { + .side-nav-vert { + border-bottom: 1px solid #888; + } } - .side-nav { /*display: block; From 1bd63b36d305f59a81b067e48387c003f8891022 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Jan 2023 19:57:14 +0100 Subject: [PATCH 154/218] Trans --- htdocs/langs/en_US/companies.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index e022c7cb09f..7200ffb3d70 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -312,8 +312,8 @@ CustomerRelativeDiscountShort=Relative discount CustomerAbsoluteDiscountShort=Absolute discount CompanyHasRelativeDiscount=This customer has a default discount of %s%% CompanyHasNoRelativeDiscount=This customer has no relative discount by default -HasRelativeDiscountFromSupplier=You have a default discount of %s%% from this vendor -HasNoRelativeDiscountFromSupplier=No default relative discount from this vendor +HasRelativeDiscountFromSupplier=You have a default discount of %s%% with this vendor +HasNoRelativeDiscountFromSupplier=No default relative discount with this vendor CompanyHasAbsoluteDiscount=This customer has discounts available (credits notes or down payments) for %s %s CompanyHasDownPaymentOrCommercialDiscount=This customer has discounts available (commercial, down payments) for %s %s CompanyHasCreditNote=This customer still has credit notes for %s %s From b11a6a1741b53a8283fdb25eea4fe47cf2d64d06 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Jan 2023 02:22:52 +0100 Subject: [PATCH 155/218] Fix link to download a file must contains &output=file --- htdocs/hrm/skill_tab.php | 5 ++++- htdocs/user/agenda_extsites.php | 5 ++++- htdocs/user/bank.php | 5 ++++- htdocs/user/card.php | 2 +- htdocs/user/clicktodial.php | 5 ++++- htdocs/user/document.php | 5 ++++- htdocs/user/info.php | 5 ++++- htdocs/user/note.php | 5 ++++- htdocs/user/notify/card.php | 5 ++++- htdocs/user/param_ihm.php | 5 ++++- htdocs/user/perms.php | 5 ++++- htdocs/user/virtualcard.php | 11 ++++------- 12 files changed, 45 insertions(+), 18 deletions(-) diff --git a/htdocs/hrm/skill_tab.php b/htdocs/hrm/skill_tab.php index b30484de54f..ce238b6caf4 100644 --- a/htdocs/hrm/skill_tab.php +++ b/htdocs/hrm/skill_tab.php @@ -226,10 +226,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } else { $linkback = '' . $langs->trans("BackToList") . ''; - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; + $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); + $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'rowid', $morehtmlref, '&objecttype='.$objecttype); } diff --git a/htdocs/user/agenda_extsites.php b/htdocs/user/agenda_extsites.php index 4891480cc2d..13948dc841e 100644 --- a/htdocs/user/agenda_extsites.php +++ b/htdocs/user/agenda_extsites.php @@ -170,10 +170,13 @@ if ($user->rights->user->user->lire || $user->admin) { $linkback = ''.$langs->trans("BackToList").''; } -$morehtmlref = ''; +$morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; +$urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); +$morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref); diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index fb795ecc6e4..3d94d23f682 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -350,10 +350,13 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac $linkback = ''.$langs->trans("BackToList").''; } - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; + $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); + $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref); print '
'; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index e7d001b1041..0d0c3e9f8dc 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1432,7 +1432,7 @@ if ($action == 'create' || $action == 'adduserldap') { if ($action != 'edit') { print dol_get_fiche_head($head, 'user', $title, -1, 'user'); - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard").' ('.$langs->trans("AddToContacts").')', 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index 562ab081ab8..985bf978074 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -106,10 +106,13 @@ if ($id > 0) { $linkback = ''.$langs->trans("BackToList").''; } - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; + $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); + $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref); print '
'; diff --git a/htdocs/user/document.php b/htdocs/user/document.php index b607cff7f3e..1a18cde92cc 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -152,10 +152,13 @@ if ($object->id) { $linkback = ''.$langs->trans("BackToList").''; } - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; + $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); + $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref); print '
'; diff --git a/htdocs/user/info.php b/htdocs/user/info.php index 3f5d1aea604..4a49fddf5c2 100644 --- a/htdocs/user/info.php +++ b/htdocs/user/info.php @@ -80,10 +80,13 @@ if ($user->rights->user->user->lire || $user->admin) { $linkback = ''.$langs->trans("BackToList").''; } -$morehtmlref = ''; +$morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; +$urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); +$morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref); diff --git a/htdocs/user/note.php b/htdocs/user/note.php index 4b64a15d217..d189226d575 100644 --- a/htdocs/user/note.php +++ b/htdocs/user/note.php @@ -94,10 +94,13 @@ if ($id) { $linkback = ''.$langs->trans("BackToList").''; } - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; + $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); + $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref); print '
'; diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index e20d7be3d9a..e0c01ba5d58 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -155,10 +155,13 @@ if ($result > 0) { $linkback = ''.$langs->trans("BackToList").''; - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; + $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); + $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref, '', 0, '', '', 0, ''); print '
'; diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 3d2e3240ce3..b4a03fa700e 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -343,10 +343,13 @@ if ($action == 'edit') { $linkback = ''.$langs->trans("BackToList").''; - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; + $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); + $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref); print '
'; diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index a65762b6183..22acb8ca7d9 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -255,10 +255,13 @@ if ($user->hasRight("user", "user", "read") || $user->admin) { $linkback = ''.$langs->trans("BackToList").''; } -$morehtmlref = ''; +$morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; +$urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); +$morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref); diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php index c2de7e17b06..ed3fbf7beb3 100644 --- a/htdocs/user/virtualcard.php +++ b/htdocs/user/virtualcard.php @@ -114,10 +114,13 @@ if ($user->rights->user->user->lire || $user->admin) { $linkback = ''.$langs->trans("BackToList").''; } -$morehtmlref = ''; +$morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; +$urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); +$morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + //dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref); @@ -126,12 +129,6 @@ print '
'; print '
'; /* - print ''.$langs->trans("VCard").'
'; - -print ''; -print img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); -print ''; - print '
'; //print '
'; From b4702aee2454c75e6ef442a8fa34fa71cf138717 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Jan 2023 02:31:53 +0100 Subject: [PATCH 156/218] Fix warning --- htdocs/core/class/vcard.class.php | 4 ++-- htdocs/user/card.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index 0e9372360e6..e7eb318e476 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -465,9 +465,9 @@ class vCard $this->setTitle($object->job); } - // For user, type=home + // For user, $object->url is not defined // For contact, $object->url is not defined - if ($object->url) { + if (!empty($object->url)) { $this->setURL($object->url, ""); } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 0d0c3e9f8dc..2e2534621b1 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -2464,6 +2464,7 @@ if ($action == 'create' || $action == 'adduserldap') { // Country print ''.$form->editfieldkey('Country', 'selectcounty_id', '', $object, 0).''; + print img_picto('', 'country', 'class="pictofixedwidth"'); if ($caneditfield) { print $form->select_country((GETPOST('country_id') != '' ?GETPOST('country_id') : $object->country_id), 'country_id'); if ($user->admin) { From 09a0d579cebac0d7ee231856ffc42df2a5d1d90f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Jan 2023 02:40:44 +0100 Subject: [PATCH 157/218] Fix delete group of a user --- htdocs/user/card.php | 1 + htdocs/user/class/user.class.php | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 2e2534621b1..e995fc03001 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -375,6 +375,7 @@ if (empty($reshook)) { $editgroup->oldcopy = clone $editgroup; $object->fetch($id); + if ($action == 'addgroup') { $result = $object->SetInGroup($group, $editgroup->entity); } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 65a7b7d7842..9e208ff3e37 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2651,7 +2651,11 @@ class User extends CommonObject $sql = "DELETE FROM ".$this->db->prefix()."usergroup_user"; $sql .= " WHERE fk_user = ".((int) $this->id); $sql .= " AND fk_usergroup = ".((int) $group); - $sql .= " AND entity = ".((int) $entity); + if (empty($entity)) { + $sql .= " AND entity IN (0, 1)"; // group may be in entity 0 (so $entity=0) and link with user into entity 1. + } else { + $sql .= " AND entity = ".((int) $entity); + } $result = $this->db->query($sql); if ($result) { From 0afcec9f43ddf8e196ecb7f437ba575dac4ca43e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Jan 2023 02:51:58 +0100 Subject: [PATCH 158/218] Clean code --- htdocs/main.inc.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b2c76218a5d..9fec72e2e86 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -3208,7 +3208,6 @@ function printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinpu $ret = ''; $ret .= '
'; $ret .= ''; - $ret .= ''; $ret .= ''; if ($showtitlebefore) { $ret .= '
'.$title.'
'; From 704191b4d8bd3238cc29e2ab07f84e0f5d88e128 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Jan 2023 03:06:27 +0100 Subject: [PATCH 159/218] Try to fix name of download file --- htdocs/user/card.php | 2 +- htdocs/user/vcard.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index e995fc03001..9ea05b69805 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1433,7 +1433,7 @@ if ($action == 'create' || $action == 'adduserldap') { if ($action != 'edit') { print dol_get_fiche_head($head, 'user', $title, -1, 'user'); - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard").' ('.$langs->trans("AddToContacts").')', 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; diff --git a/htdocs/user/vcard.php b/htdocs/user/vcard.php index 576d2b90a5b..695cd0e556e 100644 --- a/htdocs/user/vcard.php +++ b/htdocs/user/vcard.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2023 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2021-2022 Anthony Berton From 35eeb4a3c0e840f11f25eefb213d8f574ecafe33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Jan 2023 03:15:46 +0100 Subject: [PATCH 160/218] Fix download link --- htdocs/hrm/skill_tab.php | 2 +- htdocs/user/agenda_extsites.php | 2 +- htdocs/user/bank.php | 2 +- htdocs/user/card.php | 2 +- htdocs/user/clicktodial.php | 2 +- htdocs/user/document.php | 2 +- htdocs/user/info.php | 2 +- htdocs/user/note.php | 2 +- htdocs/user/notify/card.php | 2 +- htdocs/user/param_ihm.php | 2 +- htdocs/user/perms.php | 2 +- htdocs/user/virtualcard.php | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/hrm/skill_tab.php b/htdocs/hrm/skill_tab.php index ce238b6caf4..705b4fc200e 100644 --- a/htdocs/hrm/skill_tab.php +++ b/htdocs/hrm/skill_tab.php @@ -226,7 +226,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } else { $linkback = '' . $langs->trans("BackToList") . ''; - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; diff --git a/htdocs/user/agenda_extsites.php b/htdocs/user/agenda_extsites.php index 13948dc841e..3b9ebd007f6 100644 --- a/htdocs/user/agenda_extsites.php +++ b/htdocs/user/agenda_extsites.php @@ -170,7 +170,7 @@ if ($user->rights->user->user->lire || $user->admin) { $linkback = ''.$langs->trans("BackToList").''; } -$morehtmlref = ''; +$morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 3d94d23f682..7040add3950 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -350,7 +350,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac $linkback = ''.$langs->trans("BackToList").''; } - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 9ea05b69805..67ea2174322 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1433,7 +1433,7 @@ if ($action == 'create' || $action == 'adduserldap') { if ($action != 'edit') { print dol_get_fiche_head($head, 'user', $title, -1, 'user'); - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard").' ('.$langs->trans("AddToContacts").')', 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index 985bf978074..d2f9452bac5 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -106,7 +106,7 @@ if ($id > 0) { $linkback = ''.$langs->trans("BackToList").''; } - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; diff --git a/htdocs/user/document.php b/htdocs/user/document.php index 1a18cde92cc..f99eb9982a2 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -152,7 +152,7 @@ if ($object->id) { $linkback = ''.$langs->trans("BackToList").''; } - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; diff --git a/htdocs/user/info.php b/htdocs/user/info.php index 4a49fddf5c2..7804579edd5 100644 --- a/htdocs/user/info.php +++ b/htdocs/user/info.php @@ -80,7 +80,7 @@ if ($user->rights->user->user->lire || $user->admin) { $linkback = ''.$langs->trans("BackToList").''; } -$morehtmlref = ''; +$morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; diff --git a/htdocs/user/note.php b/htdocs/user/note.php index d189226d575..b3ee9398374 100644 --- a/htdocs/user/note.php +++ b/htdocs/user/note.php @@ -94,7 +94,7 @@ if ($id) { $linkback = ''.$langs->trans("BackToList").''; } - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index e0c01ba5d58..e63269d5fa6 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -155,7 +155,7 @@ if ($result > 0) { $linkback = ''.$langs->trans("BackToList").''; - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index b4a03fa700e..ee0f1d13914 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -343,7 +343,7 @@ if ($action == 'edit') { $linkback = ''.$langs->trans("BackToList").''; - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 22acb8ca7d9..23265513730 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -255,7 +255,7 @@ if ($user->hasRight("user", "user", "read") || $user->admin) { $linkback = ''.$langs->trans("BackToList").''; } -$morehtmlref = ''; +$morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php index ed3fbf7beb3..7e13950747c 100644 --- a/htdocs/user/virtualcard.php +++ b/htdocs/user/virtualcard.php @@ -114,7 +114,7 @@ if ($user->rights->user->user->lire || $user->admin) { $linkback = ''.$langs->trans("BackToList").''; } -$morehtmlref = ''; +$morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; From 236b3aa9e89d2049c186d16d79f0612be21a7476 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Jan 2023 12:28:44 +0100 Subject: [PATCH 161/218] Revert default type of hooks. Default is now 'addreplace' hooks (and exception become 'output' hooks, that become deprecated). --- ChangeLog | 5 +- htdocs/core/class/hookmanager.class.php | 116 ++++++------------ htdocs/document.php | 5 +- htdocs/main.inc.php | 6 +- htdocs/mrp/index.php | 3 +- .../variants/class/ProductAttribute.class.php | 2 +- .../productattributevalueline_edit.tpl.php | 2 +- htdocs/webhook/target_card.php | 4 +- 8 files changed, 54 insertions(+), 89 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3f30b2a2f99..1a3e96b18ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,8 +11,9 @@ NEW: PHP 8.2 compatibility: WARNING: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: -* The deprecated method escapeunderscore() of database handlers has been removed. You must use escapeforlike instead. -* The method nb_expedition() has been renamed into countNbOfShipments() +* The deprecated method "escapeunderscore()" of database handlers has been removed. You must use "escapeforlike()" instead. +* The method "nb_expedition()" has been renamed into "countNbOfShipments()" +* Revert default type of hooks. Default is now 'addreplace' hooks (and exception become 'output' hooks, that become deprecated). diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 0659240c8c7..7a6af7b88ec 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -162,84 +162,44 @@ class HookManager //dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']); // Define type of hook ('output' or 'addreplace'). - // TODO Remove hooks with type 'output' (exemple getNomUrl). All hooks must be converted into 'addreplace' hooks. - $hooktype = 'output'; - if (in_array( - $method, - array( - 'addCalendarChoice', - 'addCalendarView', - 'addMoreActionsButtons', - 'addMoreMassActions', - 'addSearchEntry', - 'addStatisticLine', - 'addSectionECMAuto', - 'checkSecureAccess', - 'createDictionaryFieldlist', - 'editDictionaryFieldlist', - 'getFormMail', - 'deleteFile', - 'doActions', - 'doMassActions', - 'formatEvent', - 'formConfirm', - 'formCreateThirdpartyOptions', - 'formObjectOptions', - 'formattachOptions', - 'formBuilddocLineOptions', - 'formatNotificationMessage', - 'formConfirm', - 'getAccessForbiddenMessage', - 'getDirList', - 'hookGetEntity', - 'getFormMail', - 'getFormatedCustomerRef', - 'getFormatedSupplierRef', - 'getIdProfUrl', - 'getInputIdProf', - 'isPaymentOK', - 'llxFooter', - 'menuDropdownQuickaddItems', - 'menuLeftMenuItems', - 'moveUploadedFile', - 'moreHtmlStatus', - 'pdf_build_address', - 'pdf_writelinedesc', - 'pdf_getlinenum', - 'pdf_getlineref', - 'pdf_getlineref_supplier', - 'pdf_getlinevatrate', - 'pdf_getlineupexcltax', - 'pdf_getlineupwithtax', - 'pdf_getlineqty', - 'pdf_getlineqty_asked', - 'pdf_getlineqty_shipped', - 'pdf_getlineqty_keeptoship', - 'pdf_getlineunit', - 'pdf_getlineremisepercent', - 'pdf_getlineprogress', - 'pdf_getlinetotalexcltax', - 'pdf_getlinetotalwithtax', - 'paymentsupplierinvoices', - 'printAddress', - 'printEmail', - 'printSearchForm', - 'printTabsHead', - 'printObjectLine', - 'printObjectSubLine', - 'restrictedArea', - 'sendMail', - 'sendMailAfter', - 'showOptionals', - 'showLinkToObjectBlock', - 'setContentSecurityPolicy', - 'setHtmlTitle', - 'completeTabsHead', - 'formDolBanner', - 'displayMarginInfos', - ) - )) { - $hooktype = 'addreplace'; + $hooktype = 'addreplace'; + // TODO Remove hooks with type 'output' (exemple createFrom). All hooks must be converted into 'addreplace' hooks. + if (!in_array($method, array( + 'createFrom', + 'dashboardMembers', + 'dashboardEmailings', + 'dashboardPropals', + 'dashboardPropals', + 'dashboardCommercials', + 'dashboardOrders', + 'dashboardSpecialBills', + 'dashboardAccountancy', + 'dashboardContracts', + 'dashboardDonation', + 'dashboardWarehouseSendings', + 'dashboardExpenseReport', + 'dashboardInterventions', + 'dashboardOrdersSuppliers', + 'dashboardHRM', + 'dashboardMRP', + 'dashboardOpensurvey', + 'dashboardWarehouse', + 'dashboardProductServices', + 'dashboardActivities', + 'dashboardProjects', + 'dashboardWarehouseReceptions', + 'dashboardThirdparties', + 'dashboardSupplierProposal', + 'dashboardTickets', + 'dashboardUsersGroups', + 'insertExtraHeader', + 'insertExtraFooter', + 'printLeftBlock', + 'formAddObjectLine', + 'formBuilddocOption', + 'showSocinfoOnPrint' + ))) { + $hooktype = 'output'; } // Init return properties diff --git a/htdocs/document.php b/htdocs/document.php index 4f6652fafda..eccf49de0be 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -286,9 +286,10 @@ $hookmanager->initHooks(array('document')); $parameters = array('ecmfile' => $ecmfile, 'modulepart' => $modulepart, 'original_file' => $original_file, 'entity' => $entity, 'refname' => $refname, 'fullpath_original_file' => $fullpath_original_file, 'filename' => $filename, 'fullpath_original_file_osencoded' => $fullpath_original_file_osencoded); -$reshook = $hookmanager->executeHooks('downloadDocument', $parameters); // Note that $action and $object may have been +$object = new stdClass(); +$reshook = $hookmanager->executeHooks('downloadDocument', $parameters, $object, $action); // Note that $action and $object may have been if ($reshook < 0) { - $errors = $hookmanager->error.(is_array($hookmanager->errors) ? (!empty($hookmanager->error) ? ', ' : '').join($separator, $hookmanager->errors) : ''); + $errors = $hookmanager->error.(is_array($hookmanager->errors) ? (!empty($hookmanager->error) ? ', ' : '').join(', ', $hookmanager->errors) : ''); dol_syslog("document.php - Errors when executing the hook 'downloadDocument' : ".$errors); print "ErrorDownloadDocumentHooks: ".$errors; exit; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 9fec72e2e86..549c72157a6 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2603,11 +2603,11 @@ function printDropdownQuickadd() $parameters = array(); $hook_items = $items; $reshook = $hookmanager->executeHooks('menuDropdownQuickaddItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks - if (is_numeric($reshook) && !empty($hookmanager->results) && is_array($hookmanager->results)) { + if (is_numeric($reshook) && !empty($hookmanager->resArray) && is_array($hookmanager->resArray)) { if ($reshook == 0) { - $items['items'] = array_merge($items['items'], $hookmanager->results); // add + $items['items'] = array_merge($items['items'], $hookmanager->resArray); // add } else { - $items = $hookmanager->results; // replace + $items = $hookmanager->resArray; // replace } // Sort menu items by 'position' value diff --git a/htdocs/mrp/index.php b/htdocs/mrp/index.php index d7929ce1422..835a06cc7c6 100644 --- a/htdocs/mrp/index.php +++ b/htdocs/mrp/index.php @@ -249,11 +249,12 @@ if ($resql) { print '
'; +$object = new stdClass(); $parameters = array( //'type' => $type, 'user' => $user, ); -$reshook = $hookmanager->executeHooks('dashboardMRP', $parameters); +$reshook = $hookmanager->executeHooks('dashboardMRP', $parameters, $object); // End of page llxFooter(); diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index f89adcce0f8..74ff3fe238c 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -919,7 +919,7 @@ class ProductAttribute extends CommonObject $parameters = array('rowid' => $rowid, 'position' => $position); $action = ''; $reshook = $hookmanager->executeHooks('afterPositionOfAttributeUpdate', $parameters, $this, $action); - return 1; + return ($reshook >= 0 ? 1 : -1); } } diff --git a/htdocs/variants/tpl/productattributevalueline_edit.tpl.php b/htdocs/variants/tpl/productattributevalueline_edit.tpl.php index 3b842962258..60fc81c7418 100644 --- a/htdocs/variants/tpl/productattributevalueline_edit.tpl.php +++ b/htdocs/variants/tpl/productattributevalueline_edit.tpl.php @@ -54,7 +54,7 @@ $coldisplay++; ref); ?>"> $line); + $parameters = array('line' => $line); $reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $object, $action); if (!empty($hookmanager->resPrint)) { print $hookmanager->resPrint; diff --git a/htdocs/webhook/target_card.php b/htdocs/webhook/target_card.php index 83f2008703f..a35f04d0138 100644 --- a/htdocs/webhook/target_card.php +++ b/htdocs/webhook/target_card.php @@ -430,7 +430,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } if (empty($reshook)) $object->formAddObjectLine(1, $mysoc, $soc); } From fbc74cd571aa4deebbf8cac9f9d4c695452981da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Jan 2023 15:57:12 +0100 Subject: [PATCH 162/218] Fix missing doxygen doc --- .../DataCollector/DolConfigCollector.php | 21 +++++++++++++++ .../DataCollector/DolExceptionsCollector.php | 21 +++++++++++++++ .../class/DataCollector/DolLogsCollector.php | 21 +++++++++++++++ .../DataCollector/DolMemoryCollector.php | 26 ++++++++++++++++--- .../DataCollector/DolMessagesCollector.php | 21 +++++++++++++++ .../class/DataCollector/DolPhpCollector.php | 21 +++++++++++++++ .../class/DataCollector/DolQueryCollector.php | 21 +++++++++++++++ .../DataCollector/DolRequestDataCollector.php | 21 +++++++++++++++ .../DataCollector/DolTimeDataCollector.php | 21 +++++++++++++++ .../class/DataCollector/DolibarrCollector.php | 21 +++++++++++++++ htdocs/debugbar/class/DebugBar.php | 21 +++++++++++++++ htdocs/debugbar/class/TraceableDB.php | 21 +++++++++++++++ 12 files changed, 254 insertions(+), 3 deletions(-) diff --git a/htdocs/debugbar/class/DataCollector/DolConfigCollector.php b/htdocs/debugbar/class/DataCollector/DolConfigCollector.php index 715d20abcf9..0920b140dbc 100644 --- a/htdocs/debugbar/class/DataCollector/DolConfigCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolConfigCollector.php @@ -1,4 +1,25 @@ + * + * 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 . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/DolConfigCollector.php + * \brief Class for debugbar collection + * \ingroup debugbar + */ use \DebugBar\DataCollector\ConfigCollector; diff --git a/htdocs/debugbar/class/DataCollector/DolExceptionsCollector.php b/htdocs/debugbar/class/DataCollector/DolExceptionsCollector.php index 15d433fd050..38d2b971dde 100644 --- a/htdocs/debugbar/class/DataCollector/DolExceptionsCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolExceptionsCollector.php @@ -1,4 +1,25 @@ + * + * 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 . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/DolexceptionsCollector.php + * \brief Class for debugbar collection + * \ingroup debugbar + */ use \DebugBar\DataCollector\ExceptionsCollector; diff --git a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php index d21cdd6233f..44885296bae 100644 --- a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php @@ -1,4 +1,25 @@ + * + * 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 . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/DolLogsCollector.php + * \brief Class for debugbar collection + * \ingroup debugbar + */ use DebugBar\DataCollector\MessagesCollector; use Psr\Log\LogLevel; diff --git a/htdocs/debugbar/class/DataCollector/DolMemoryCollector.php b/htdocs/debugbar/class/DataCollector/DolMemoryCollector.php index b52ac8ff8c4..3372e89c2b6 100644 --- a/htdocs/debugbar/class/DataCollector/DolMemoryCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolMemoryCollector.php @@ -1,17 +1,37 @@ + * + * 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 . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/DolMemoryCollector.php + * \brief Class for debugbar collection + * \ingroup debugbar + */ use \DebugBar\DataCollector\MemoryCollector; /** * DolMemoryCollector class */ - class DolMemoryCollector extends MemoryCollector { /** * Return value of indicator * - * @return void + * @return array */ public function collect() { @@ -28,7 +48,7 @@ class DolMemoryCollector extends MemoryCollector /** * Return widget settings * - * @return void + * @return array */ public function getWidgets() { diff --git a/htdocs/debugbar/class/DataCollector/DolMessagesCollector.php b/htdocs/debugbar/class/DataCollector/DolMessagesCollector.php index 1fcf60c8ba6..733009e77c6 100644 --- a/htdocs/debugbar/class/DataCollector/DolMessagesCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolMessagesCollector.php @@ -1,4 +1,25 @@ + * + * 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 . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/DolMessagesCollector.php + * \brief Class for debugbar collection + * \ingroup debugbar + */ use \DebugBar\DataCollector\MessagesCollector; diff --git a/htdocs/debugbar/class/DataCollector/DolPhpCollector.php b/htdocs/debugbar/class/DataCollector/DolPhpCollector.php index 3d6536bd258..bca2b2a7071 100644 --- a/htdocs/debugbar/class/DataCollector/DolPhpCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolPhpCollector.php @@ -1,4 +1,25 @@ + * + * 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 . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/DolPhpCollector.php + * \brief Class for debugbar collection + * \ingroup debugbar + */ use DebugBar\DataCollector\DataCollector; use DebugBar\DataCollector\Renderable; diff --git a/htdocs/debugbar/class/DataCollector/DolQueryCollector.php b/htdocs/debugbar/class/DataCollector/DolQueryCollector.php index ca5aa284dd2..8cc55e34df9 100644 --- a/htdocs/debugbar/class/DataCollector/DolQueryCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolQueryCollector.php @@ -1,4 +1,25 @@ + * + * 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 . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/DolQueryCollector.php + * \brief Class for debugbar collection + * \ingroup debugbar + */ use DebugBar\DataCollector\AssetProvider; use DebugBar\DataCollector\DataCollector; diff --git a/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php b/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php index 938643802d5..4ddcac9af7c 100644 --- a/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php @@ -1,4 +1,25 @@ + * + * 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 . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php + * \brief Class for debugbar collection + * \ingroup debugbar + */ use \DebugBar\DataCollector\RequestDataCollector; diff --git a/htdocs/debugbar/class/DataCollector/DolTimeDataCollector.php b/htdocs/debugbar/class/DataCollector/DolTimeDataCollector.php index ed5e979d539..d16622d329f 100644 --- a/htdocs/debugbar/class/DataCollector/DolTimeDataCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolTimeDataCollector.php @@ -1,4 +1,25 @@ + * + * 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 . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/DolTimeDataCollector.php + * \brief Class for debugbar collection + * \ingroup debugbar + */ use \DebugBar\DataCollector\TimeDataCollector; diff --git a/htdocs/debugbar/class/DataCollector/DolibarrCollector.php b/htdocs/debugbar/class/DataCollector/DolibarrCollector.php index 3193fe26176..11cedbe2b93 100644 --- a/htdocs/debugbar/class/DataCollector/DolibarrCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolibarrCollector.php @@ -1,4 +1,25 @@ + * + * 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 . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/DolibarrCollector.php + * \brief Class for debugbar collection + * \ingroup debugbar + */ use DebugBar\DataCollector\AssetProvider; use DebugBar\DataCollector\DataCollector; diff --git a/htdocs/debugbar/class/DebugBar.php b/htdocs/debugbar/class/DebugBar.php index bf797e638f7..6181ad7cd60 100644 --- a/htdocs/debugbar/class/DebugBar.php +++ b/htdocs/debugbar/class/DebugBar.php @@ -1,4 +1,25 @@ + * + * 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 . + */ + +/** + * \file htdocs/debugbar/class/DebugBar.php + * \brief Class for debugbar + * \ingroup debugbar + */ dol_include_once('/debugbar/class/autoloader.php'); diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php index 9f0a83fae3c..8e28b0c59bd 100644 --- a/htdocs/debugbar/class/TraceableDB.php +++ b/htdocs/debugbar/class/TraceableDB.php @@ -1,4 +1,25 @@ + * + * 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 . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/TraceableDB.php + * \brief Class for debugbar DB + * \ingroup debugbar + */ require_once DOL_DOCUMENT_ROOT.'/core/db/DoliDB.class.php'; From 7aba21dd3e194ef49ed7dfee466856b345717085 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 14 Jan 2023 17:05:45 +0100 Subject: [PATCH 163/218] Update list.php --- htdocs/adherents/list.php | 67 +++++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 10 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index b9cbb252144..39a4d993221 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -73,7 +73,7 @@ $search_categ = GETPOST("search_categ", 'int'); $search_filter = GETPOST("search_filter", 'alpha'); $search_status = GETPOST("search_status", 'intcomma'); $search_morphy = GETPOST("search_morphy", 'alpha'); -$search_import_key = trim(GETPOST("search_import_key", "alpha")); +$search_import_key = trim(GETPOST("search_import_key", 'alpha')); $catid = GETPOST("catid", 'int'); $optioncss = GETPOST('optioncss', 'alpha'); $socid = GETPOST('socid', 'int'); @@ -141,6 +141,7 @@ $fieldstosearchall = array( if ($db->type == 'pgsql') { unset($fieldstosearchall['d.rowid']); } + $arrayfields = array( 'd.ref'=>array('label'=>"Ref", 'checked'=>1), 'd.civility'=>array('label'=>"Civility", 'checked'=>0), @@ -169,6 +170,7 @@ $arrayfields = array( 'd.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), 'd.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100), ); + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -317,7 +319,11 @@ $formother = new FormOther($db); $membertypestatic = new AdherentType($db); $memberstatic = new Adherent($db); -$title = $langs->trans("Members"); +// Page Header +$title = $langs->trans("Members")." - ".$langs->trans("List");; +$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder'; +llxHeader('', $title, $help_url); + $now = dol_now(); @@ -335,12 +341,14 @@ $sql .= " s.nom,"; $sql .= " ".$db->ifsql("d.societe IS NULL", "s.nom", "d.societe")." as companyname,"; $sql .= " t.libelle as type, t.subscription,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; + // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key." as options_".$key.', ' : ''); } } + // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook @@ -349,13 +357,16 @@ $sql = preg_replace('/,\s*$/', '', $sql); $sqlfields = $sql; // $sql fields to remove for count total -$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; +// SQL Aliase adherent +$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; // maybe better to use ad (adh) instead od d if (!empty($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)"; } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = d.country)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = d.state_id)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on (s.rowid = d.fk_soc)"; + +// SQL Aliase adherent_type $sql .= ", ".MAIN_DB_PREFIX."adherent_type as t"; $sql .= " WHERE d.fk_adherent_type = t.rowid"; @@ -525,8 +536,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ exit; } -$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'; -llxHeader('', $title, $help_url); if ($search_type > 0) { $membertype = new AdherentType($db); @@ -534,6 +543,7 @@ if ($search_type > 0) { $title .= " (".$membertype->label.")"; } +// $parameters $param = ''; if (!empty($mode)) { $param .= '&mode='.urlencode($mode); @@ -613,6 +623,7 @@ if ($search_type > 0) { if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } + // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -705,6 +716,7 @@ print ''; + // Action column if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { print ''; } + // Line numbering if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { print ''; @@ -723,32 +736,45 @@ if (!empty($arrayfields['d.ref']['checked'])) { print ''; print ''; } + +// Civility if (!empty($arrayfields['d.civility']['checked'])) { print ''; } + +// First Name if (!empty($arrayfields['d.firstname']['checked'])) { print ''; } + +// Last Name if (!empty($arrayfields['d.lastname']['checked'])) { print ''; } + +// Gender if (!empty($arrayfields['d.gender']['checked'])) { print ''; } + +// Company if (!empty($arrayfields['d.company']['checked'])) { print ''; } + +// Login if (!empty($arrayfields['d.login']['checked'])) { print ''; } + // Nature if (!empty($arrayfields['d.morphy']['checked'])) { print ''; } + +// Member Type if (!empty($arrayfields['t.libelle']['checked'])) { print ''; } @@ -766,51 +794,62 @@ if (!empty($arrayfields['t.libelle']['checked'])) { print ''; } +// Address - Street if (!empty($arrayfields['d.address']['checked'])) { print ''; } +// ZIP if (!empty($arrayfields['d.zip']['checked'])) { print ''; } + +// Town/City if (!empty($arrayfields['d.town']['checked'])) { print ''; } -// State + +// State / County / Departement if (!empty($arrayfields['state.nom']['checked'])) { print ''; } + // Country if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; } + // Phone pro if (!empty($arrayfields['d.phone']['checked'])) { print ''; } + // Phone perso if (!empty($arrayfields['d.phone_perso']['checked'])) { print ''; + print ''; } + // Phone mobile if (!empty($arrayfields['d.phone_mobile']['checked'])) { print ''; } + // Email if (!empty($arrayfields['d.email']['checked'])) { print ''; } + // End of subscription date if (!empty($arrayfields['d.datefin']['checked'])) { print ''; } + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; @@ -826,21 +866,25 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; $parameters = array('arrayfields'=>$arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; + // Date creation if (!empty($arrayfields['d.datec']['checked'])) { print ''; } + // Birthday if (!empty($arrayfields['d.birth']['checked'])) { print ''; } + // Date modification if (!empty($arrayfields['d.tms']['checked'])) { print ''; } + // Status if (!empty($arrayfields['d.statut']['checked'])) { print ''; } + +// Import Key if (!empty($arrayfields['d.import_key']['checked'])) { print ''; } + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { // Action column print ''; } - + // Technical ID if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { print ''; if (!$i) { $totalarray['nbfield']++; } } - // Ref if (!empty($arrayfields['d.ref']['checked'])) { print "\n"; if (!$i) { From cb84d7797f2291824c4d62a835e81ac00e1cc1bd Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 14 Jan 2023 16:06:39 +0000 Subject: [PATCH 164/218] Fixing style errors. --- htdocs/adherents/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 39a4d993221..d06d91cbea6 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -358,7 +358,7 @@ $sql = preg_replace('/,\s*$/', '', $sql); $sqlfields = $sql; // $sql fields to remove for count total // SQL Aliase adherent -$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; // maybe better to use ad (adh) instead od d +$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; // maybe better to use ad (adh) instead od d if (!empty($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)"; } From bff128a061735948435045d55893a5bcc6a0fd2a Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 14 Jan 2023 17:41:29 +0100 Subject: [PATCH 165/218] Update list.php --- htdocs/contact/list.php | 100 +++++++++++++++++++++++++++++----------- 1 file changed, 74 insertions(+), 26 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index a025ef81b97..1cc2d67cf93 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -101,10 +101,10 @@ $search_type = GETPOST('search_type', 'alpha'); $search_address = GETPOST('search_address', 'alpha'); $search_zip = GETPOST('search_zip', 'alpha'); $search_town = GETPOST('search_town', 'alpha'); -$search_import_key = GETPOST("search_import_key", "alpha"); +$search_import_key = GETPOST("search_import_key", 'alpha'); $search_country = GETPOST("search_country", 'intcomma'); $search_roles = GETPOST("search_roles", 'array'); -$search_level = GETPOST("search_level", "array"); +$search_level = GETPOST("search_level", 'array'); $search_stcomm = GETPOST('search_stcomm', 'int'); if ($search_status === '') { @@ -350,9 +350,14 @@ $formother = new FormOther($db); $formcompany = new FormCompany($db); $contactstatic = new Contact($db); -$morejs=array(); +$morejs = array(); $morecss = array(); +// Page Header +$title = $langs->trans("Contacts")." - ".$langs->trans("List"); +$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas'; +llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); + if (!empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) { $contactstatic->loadCacheOfProspStatus(); } @@ -387,6 +392,7 @@ $sql .= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, $sql .= " p.import_key,"; $sql .= " st.libelle as stcomm, st.picto as stcomm_picto, p.fk_stcommcontact as stcomm_id, p.fk_prospectlevel,"; $sql .= " co.label as country, co.code as country_code"; + // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { @@ -396,13 +402,15 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { if (isModEnabled('mailing')) { $sql .= ", (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) as unsubscribed"; } -// Add fields from hooks + +// Add fields from hooks - ListSelect $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sqlfields = $sql; // $sql fields to remove for count total +// SQL Table Aliase $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)"; @@ -413,7 +421,8 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_stcommcontact as st ON st.id = p.fk_stco if (empty($user->rights->societe->client->voir) && !$socid) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; } -// Add fields from hooks + +// Add fields from hooks - ListFrom $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; @@ -443,9 +452,13 @@ if ($search_priv != '0' && $search_priv != '1') { } } + +// Search Categories + + // Search Contact Categories $searchCategoryContactList = $search_categ ? array($search_categ) : array(); $searchCategoryContactOperator = 0; -// Search for tag/category ($searchCategoryContactList is an array of ID) + // Search for tag/category ($searchCategoryContactList is an array of ID) if (!empty($searchCategoryContactList)) { $searchCategoryContactSqlList = array(); $listofcategoryid = ''; @@ -473,9 +486,11 @@ if (!empty($searchCategoryContactList)) { } } } + + // Search Customer Categories $searchCategoryCustomerList = $search_categ_thirdparty ? array($search_categ_thirdparty) : array(); $searchCategoryCustomerOperator = 0; -// Search for tag/category ($searchCategoryCustomerList is an array of ID) + // Search for tag/category ($searchCategoryCustomerList is an array of ID) if (!empty($searchCategoryCustomerList)) { $searchCategoryCustomerSqlList = array(); $listofcategoryid = ''; @@ -503,9 +518,11 @@ if (!empty($searchCategoryCustomerList)) { } } } + + // Search Supplier Categories $searchCategorySupplierList = $search_categ_supplier ? array($search_categ_supplier) : array(); $searchCategorySupplierOperator = 0; -// Search for tag/category ($searchCategorySupplierList is an array of ID) + // Search for tag/category ($searchCategorySupplierList is an array of ID) if (!empty($searchCategorySupplierList)) { $searchCategorySupplierSqlList = array(); $listofcategoryid = ''; @@ -600,6 +617,7 @@ if (isModEnabled('socialnetworks')) { } } //print $sql; + if (strlen($search_email)) { $sql .= natural_search('p.email', $search_email); } @@ -627,20 +645,22 @@ if ($search_status != '' && $search_status >= 0) { if ($search_import_key) { $sql .= natural_search("p.import_key", $search_import_key); } -if ($type == "o") { // filtre sur type +if ($type == "o") { // filter on type $sql .= " AND p.fk_soc IS NULL"; -} elseif ($type == "f") { // filtre sur type +} elseif ($type == "f") { // filter on type $sql .= " AND s.fournisseur = 1"; -} elseif ($type == "c") { // filtre sur type +} elseif ($type == "c") { // filter on type $sql .= " AND s.client IN (1, 3)"; -} elseif ($type == "p") { // filtre sur type +} elseif ($type == "p") { // filter on type $sql .= " AND s.client IN (2, 3)"; } if (!empty($socid)) { $sql .= " AND s.rowid = ".((int) $socid); } + // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; + // Add where from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -695,8 +715,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ( exit; } -$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas'; -llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); + $param = ''; if (!empty($mode)) { @@ -948,20 +967,25 @@ if (!empty($arrayfields['p.town']['checked'])) { print ''; print ''; } + +/* // State -/*if (!empty($arrayfields['state.nom']['checked'])) + if (!empty($arrayfields['state.nom']['checked'])) { print ''; } + // Region if (!empty($arrayfields['region.nom']['checked'])) { print ''; - }*/ + } +*/ + // Country if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; } -// Alias +// Alias of ThirdParty if (!empty($arrayfields['s.name_alias']['checked'])) { print ''; -// Ligne des titres +// Title line print ''; if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); @@ -1238,6 +1262,7 @@ while ($i < min($num, $limit)) { } print ''; } + // ID if (!empty($arrayfields['p.rowid']['checked'])) { print ''; @@ -1263,6 +1290,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + // Job position if (!empty($arrayfields['p.poste']['checked'])) { print ''; @@ -1270,6 +1298,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + // Address if (!empty($arrayfields['p.address']['checked'])) { print ''; @@ -1277,6 +1306,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + // Zip if (!empty($arrayfields['p.zip']['checked'])) { print ''; @@ -1284,6 +1314,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + // Town if (!empty($arrayfields['p.town']['checked'])) { print ''; @@ -1291,18 +1322,22 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + + /* // State - /*if (!empty($arrayfields['state.nom']['checked'])) + if (!empty($arrayfields['state.nom']['checked'])) { print "\n"; if (! $i) $totalarray['nbfield']++; } + // Region if (!empty($arrayfields['region.nom']['checked'])) { print "\n"; if (! $i) $totalarray['nbfield']++; }*/ + // Country if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; if (!$i) { $totalarray['nbfield']++; } } + // Phone perso if (!empty($arrayfields['p.phone_perso']['checked'])) { print ''; @@ -1327,6 +1364,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + // Phone mobile if (!empty($arrayfields['p.phone_mobile']['checked'])) { print ''; @@ -1334,6 +1372,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + // Fax if (!empty($arrayfields['p.fax']['checked'])) { print ''; @@ -1341,6 +1380,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + // EMail if (!empty($arrayfields['p.email']['checked'])) { print ''; @@ -1348,7 +1388,8 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - // No EMail + + // No EMail Subscription if (!empty($arrayfields['unsubscribed']['checked'])) { print '"; @@ -1415,8 +1459,8 @@ while ($i < min($num, $limit)) { } } + // Prospect status if (!empty($arrayfields['p.fk_stcommcontact']['checked'])) { - // Prospect status print ''; @@ -1466,6 +1513,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + // Import key if (!empty($arrayfields['p.import_key']['checked'])) { print ''; } - + // Region if (!empty($arrayfields['region.nom']['checked'])) { @@ -1262,7 +1262,7 @@ while ($i < min($num, $limit)) { } print ''; } - + // ID if (!empty($arrayfields['p.rowid']['checked'])) { print ''; @@ -1290,7 +1290,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - + // Job position if (!empty($arrayfields['p.poste']['checked'])) { print ''; @@ -1298,7 +1298,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - + // Address if (!empty($arrayfields['p.address']['checked'])) { print ''; @@ -1306,7 +1306,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - + // Zip if (!empty($arrayfields['p.zip']['checked'])) { print ''; @@ -1314,7 +1314,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - + // Town if (!empty($arrayfields['p.town']['checked'])) { print ''; @@ -1322,7 +1322,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - + /* // State if (!empty($arrayfields['state.nom']['checked'])) @@ -1330,14 +1330,14 @@ while ($i < min($num, $limit)) { print "\n"; if (! $i) $totalarray['nbfield']++; } - + // Region if (!empty($arrayfields['region.nom']['checked'])) { print "\n"; if (! $i) $totalarray['nbfield']++; }*/ - + // Country if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; @@ -1356,7 +1356,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - + // Phone perso if (!empty($arrayfields['p.phone_perso']['checked'])) { print ''; @@ -1364,7 +1364,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - + // Phone mobile if (!empty($arrayfields['p.phone_mobile']['checked'])) { print ''; @@ -1372,7 +1372,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - + // Fax if (!empty($arrayfields['p.fax']['checked'])) { print ''; @@ -1380,7 +1380,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - + // EMail if (!empty($arrayfields['p.email']['checked'])) { print ''; @@ -1388,7 +1388,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - + // No EMail Subscription if (!empty($arrayfields['unsubscribed']['checked'])) { print ''; @@ -1513,7 +1513,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - + // Import key if (!empty($arrayfields['p.import_key']['checked'])) { print '\n"; + // Address + print '\n"; + // Company name print '\n"; // Office fax print '\n"; // User mobile print '\n"; @@ -238,7 +238,7 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { // Social networks print '\n"; @@ -262,7 +262,8 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { print $langs->trans("Text"); print '\n"; From bd8a48b6ddd7b15788782a9703daa12db440ff55 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Jan 2023 01:45:54 +0100 Subject: [PATCH 175/218] css --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 278f70507bb..3e3a87c7bd0 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3170,7 +3170,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor if (!empty($type)) { $htmllink = '
'; // Use dictionary definition for picto $dictsocialnetworks[$type]['icon'] - $htmllink .= ''; + $htmllink .= ''; if ($type == 'skype') { $htmllink .= dol_escape_htmltag($value); $htmllink .= ' 
'; //print '
'; From d7e4304992b37ff13a4059ccbe0e85856f4f9de0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Jan 2023 02:09:55 +0100 Subject: [PATCH 178/218] Try to fix social network inks in vcard --- htdocs/core/class/vcard.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index a5e1cbf6814..f6c8d14979b 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -441,7 +441,7 @@ class vCard } } if ($urlsn) { - $this->properties["socialProfile;type=".$key] = $urlsn; + $this->properties["SOCIALPROFILE;TYPE=home"] = $key.':'.$urlsn; } } } From bec559aae9406eca2171cfb4b6926ad756563709 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Jan 2023 02:16:35 +0100 Subject: [PATCH 179/218] Try to fix social network inks in vcard --- htdocs/core/class/vcard.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index f6c8d14979b..c66974f939b 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -359,7 +359,8 @@ class vCard $text .= "VERSION:4.0\r\n"; // With V4, all encoding are UTF-8 //$text.= "VERSION:2.1\r\n"; foreach ($this->properties as $key => $value) { - $text .= $key.":".$value."\r\n"; + $newkey = preg_replace('/-.*$/', '', $key); // remove suffix -twitter, -facebook, ... + $text .= $newkey.":".$value."\r\n"; } $text .= "REV:".date("Ymd")."T".date("His")."Z\r\n"; //$text .= "MAILER: Dolibarr\r\n"; @@ -441,7 +442,7 @@ class vCard } } if ($urlsn) { - $this->properties["SOCIALPROFILE;TYPE=home"] = $key.':'.$urlsn; + $this->properties["SOCIALPROFILE;TYPE=home-".$key] = $key.':'.$urlsn; } } } From 6a30104beb598a545d8798e68730c6afddc0981e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Jan 2023 02:19:47 +0100 Subject: [PATCH 180/218] Try to fix social network inks in vcard --- htdocs/core/class/vcard.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index c66974f939b..7b5a320f678 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -442,7 +442,7 @@ class vCard } } if ($urlsn) { - $this->properties["SOCIALPROFILE;TYPE=home-".$key] = $key.':'.$urlsn; + $this->properties["SOCIALPROFILE;TYPE=WORK-".$key] = $key.':'.$urlsn; } } } From 24c5fcb5a7b0e6e0c2b97062bace7c5eab67a363 Mon Sep 17 00:00:00 2001 From: TuxGasy Date: Sun, 15 Jan 2023 10:24:19 +0100 Subject: [PATCH 181/218] Update to PHP 8.1 --- build/docker/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile index ead2a8af1c5..69f4d27b26f 100644 --- a/build/docker/Dockerfile +++ b/build/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM php:7.3-apache +FROM php:8.1-apache-bullseye ENV PHP_INI_DATE_TIMEZONE 'UTC' ENV PHP_INI_MEMORY_LIMIT 256M @@ -25,7 +25,7 @@ RUN apt-get update -y \ mailutils \ && apt-get autoremove -y \ && rm -rf /var/lib/apt/lists/* \ - && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \ + && docker-php-ext-configure gd --with-freetype --with-jpeg \ && docker-php-ext-install -j$(nproc) calendar intl mysqli pdo_mysql gd soap zip \ && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ && docker-php-ext-install -j$(nproc) ldap && \ From 0cb2af4ecb26b9cfdc932538e952a3918cb83a59 Mon Sep 17 00:00:00 2001 From: TuxGasy Date: Sun, 15 Jan 2023 10:42:52 +0100 Subject: [PATCH 182/218] Fix update PHP config --- build/docker/README.md | 2 +- build/docker/docker-compose.yml | 2 ++ build/docker/docker-run.sh | 8 ++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/build/docker/README.md b/build/docker/README.md index d469c7c7aae..007b5db6ace 100644 --- a/build/docker/README.md +++ b/build/docker/README.md @@ -25,7 +25,7 @@ The URL to go to the Dolibarr is : The URL to go to PhpMyAdmin is (login/password is root/root) : http://0.0.0.0:8080 - + In Dolibarr configuration Email let PHP mail function, To see all mail send by Dolibarr go to maildev http://0.0.0.0:8081 diff --git a/build/docker/docker-compose.yml b/build/docker/docker-compose.yml index 8994043cd8a..e197d5dd06e 100644 --- a/build/docker/docker-compose.yml +++ b/build/docker/docker-compose.yml @@ -34,6 +34,8 @@ services: build: . environment: HOST_USER_ID: $HOST_USER_ID + PHP_INI_DATE_TIMEZONE: $PHP_INI_DATE_TIMEZONE + PHP_INI_MEMORY_LIMIT: $PHP_INI_MEMORY_LIMIT volumes: - ../../htdocs:/var/www/html/ - ../../documents:/var/documents diff --git a/build/docker/docker-run.sh b/build/docker/docker-run.sh index 4e69ea4a3a2..fbd256ab625 100644 --- a/build/docker/docker-run.sh +++ b/build/docker/docker-run.sh @@ -15,10 +15,10 @@ fi echo "[docker-run] => Set Permission to www-data for /var/documents" chown -R www-data:www-data /var/documents -if [ ! -f /usr/local/etc/php/php.ini ]; then - cat < /usr/local/etc/php/php.ini -date.timezone = $PHP_INI_DATE_TIMEZONE +echo "[docker-run] => update ${PHP_INI_DIR}/conf.d/dolibarr-php.ini" +cat < ${PHP_INI_DIR}/conf.d/dolibarr-php.ini +date.timezone = ${PHP_INI_DATE_TIMEZONE:-UTC} +memory_limit = ${PHP_INI_MEMORY_LIMIT:-256M} EOF -fi exec apache2-foreground From 132fe6c19d9f42682a5b1f596fc5fc224ee47ba5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Jan 2023 11:13:53 +0100 Subject: [PATCH 183/218] Fix missing photo on user link --- htdocs/core/class/html.form.class.php | 5 +---- htdocs/user/card.php | 12 ++++++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 369deba4455..276f7bacd69 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2137,10 +2137,7 @@ class Form $out .= ' selected'; } $out .= ' data-html="'; - $outhtml = ''; - // if (!empty($obj->photo)) { - $outhtml .= $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' '; - // } + $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' '; if ($showstatus >= 0 && $obj->status == 0) { $outhtml .= ''; } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 0af78cc208f..ea47ba10beb 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1514,7 +1514,7 @@ if ($action == 'create' || $action == 'adduserldap') { $huser = new User($db); if ($object->fk_user > 0) { $huser->fetch($object->fk_user); - print $huser->getNomUrl(1); + print $huser->getNomUrl(-1); } else { print ''.$langs->trans("None").''; } @@ -1532,7 +1532,7 @@ if ($action == 'create' || $action == 'adduserldap') { if (!empty($object->fk_user_expense_validator)) { $evuser = new User($db); $evuser->fetch($object->fk_user_expense_validator); - print $evuser->getNomUrl(1); + print $evuser->getNomUrl(-1); } print ''; print "\n"; @@ -1548,7 +1548,7 @@ if ($action == 'create' || $action == 'adduserldap') { if (!empty($object->fk_user_holiday_validator)) { $hvuser = new User($db); $hvuser->fetch($object->fk_user_holiday_validator); - print $hvuser->getNomUrl(1); + print $hvuser->getNomUrl(-1); } print ''; print "\n"; @@ -2263,7 +2263,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; $huser = new User($db); $huser->fetch($object->fk_user); - print $huser->getNomUrl(1); + print $huser->getNomUrl(-1); } print ''; print "\n"; @@ -2281,7 +2281,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; $evuser = new User($db); $evuser->fetch($object->fk_user_expense_validator); - print $evuser->getNomUrl(1); + print $evuser->getNomUrl(-1); } print ''; print "\n"; @@ -2300,7 +2300,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; $hvuser = new User($db); $hvuser->fetch($object->fk_user_holiday_validator); - print $hvuser->getNomUrl(1); + print $hvuser->getNomUrl(-1); } print ''; print "\n"; From 3026842467387790c57cfb42f4bf3dc78f28fc08 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Jan 2023 11:39:38 +0100 Subject: [PATCH 184/218] trans --- htdocs/langs/en_US/companies.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index d31ecb077ff..38b6892dbae 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -499,5 +499,5 @@ OutOfEurope=Out of Europe (EEC) CurrentOutstandingBillLate=Current outstanding bill late BecarefullChangeThirdpartyBeforeAddProductToInvoice=Be carefull, depending on your product price settings, you should change thirdparty before adding product to POS. EmailAlreadyExistsPleaseRewriteYourCompanyName=email already exists please rewrite your company name -TwoRecordsOfCompanyName=more than one record exists for this company please contact us to complete your partnership request" +TwoRecordsOfCompanyName=more than one record exists for this company, please contact us to complete your partnership request CompanySection=Company section \ No newline at end of file From 2d2164550f2744d15ba8a757f532414868edc727 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Jan 2023 20:48:29 +0100 Subject: [PATCH 185/218] Fix warnings --- htdocs/accountancy/customer/index.php | 7 +++++-- htdocs/accountancy/expensereport/index.php | 7 +++++-- htdocs/accountancy/supplier/index.php | 7 +++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 69702d8b10e..5f603a973c2 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -121,6 +121,7 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('acc if ($action == 'validatehistory') { $error = 0; $nbbinddone = 0; + $nbbindfailed = 0; $notpossible = 0; $db->begin(); @@ -266,12 +267,14 @@ if ($action == 'validatehistory') { if (!$resqlupdate) { $error++; setEventMessages($db->lasterror(), null, 'errors'); + $nbbindfailed++; break; } else { $nbbinddone++; } } else { $notpossible++; + $nbbindfailed++; } $i++; @@ -286,8 +289,8 @@ if ($action == 'validatehistory') { } else { $db->commit(); setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs')); - if ($notpossible) { - setEventMessages($langs->trans('DoManualBindingForFailedRecord', $notpossible), null, 'warnings'); + if ($nbbindfailed) { + setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings'); } } } diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index d256d13252a..0929c9c9e24 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -101,6 +101,7 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou if ($action == 'validatehistory') { $error = 0; $nbbinddone = 0; + $nbbindfailed = 0; $notpossible = 0; $db->begin(); @@ -143,12 +144,14 @@ if ($action == 'validatehistory') { if (!$resqlupdate) { $error++; setEventMessages($db->lasterror(), null, 'errors'); + $nbbindfailed++; break; } else { $nbbinddone++; } } else { $notpossible++; + $nbbindfailed++; } $i++; @@ -163,8 +166,8 @@ if ($action == 'validatehistory') { } else { $db->commit(); setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs')); - if ($notpossible) { - setEventMessages($langs->trans('DoManualBindingForFailedRecord', $notpossible), null, 'warnings'); + if ($nbbindfailed) { + setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings'); } } } diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 3e0f4fbd784..87e67bbfcb6 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -119,6 +119,7 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou if ($action == 'validatehistory') { $error = 0; $nbbinddone = 0; + $nbbindfailed = 0; $notpossible = 0; $db->begin(); @@ -264,12 +265,14 @@ if ($action == 'validatehistory') { if (!$resqlupdate) { $error++; setEventMessages($db->lasterror(), null, 'errors'); + $nbbindfailed++; break; } else { $nbbinddone++; } } else { $notpossible++; + $nbbindfailed++; } $i++; @@ -284,8 +287,8 @@ if ($action == 'validatehistory') { } else { $db->commit(); setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs')); - if ($notpossible) { - setEventMessages($langs->trans('DoManualBindingForFailedRecord', $notpossible), null, 'warnings'); + if ($nbbindfailed) { + setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings'); } } } From 70f3a6d84701dc212a905a27d4edadf64e440e36 Mon Sep 17 00:00:00 2001 From: Christian Humpel Date: Sun, 15 Jan 2023 22:53:17 +0100 Subject: [PATCH 186/218] load bom class file. --- htdocs/mrp/mo_list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 99e91fec184..c3ae9247c9d 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -27,6 +27,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; // load mrp libraries require_once __DIR__.'/class/mo.class.php'; From 70bec953075d5f2873bd5a14f4c10f0cb8ec4d1b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2023 10:44:39 +0100 Subject: [PATCH 187/218] Fix regression test --- htdocs/core/class/hookmanager.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 7a6af7b88ec..bcd5a506946 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -164,7 +164,7 @@ class HookManager // Define type of hook ('output' or 'addreplace'). $hooktype = 'addreplace'; // TODO Remove hooks with type 'output' (exemple createFrom). All hooks must be converted into 'addreplace' hooks. - if (!in_array($method, array( + if (in_array($method, array( 'createFrom', 'dashboardMembers', 'dashboardEmailings', From acc30da1fe2c25e221d01b6f5e5876aacf30a7e9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2023 10:57:31 +0100 Subject: [PATCH 188/218] Fix do not change password if same --- .../triggers/interface_50_modAgenda_ActionsAuto.class.php | 2 +- htdocs/langs/en_US/users.lang | 3 ++- htdocs/user/card.php | 2 +- htdocs/user/class/user.class.php | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index be78b6ecc18..ae53b01e19b 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -931,7 +931,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = 0; } else { // TODO Merge all previous cases into this generic one - // $action = BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, CONTACT_SENTBYMAIL, RECRUITMENTCANDIDATURE_MODIFY, ... + // $action = PASSWORD, BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, CONTACT_SENTBYMAIL, RECRUITMENTCANDIDATURE_MODIFY, ... // Can also be a value defined by an external module like SENTBYSMS, COMPANY_SENTBYSMS, MEMBER_SENTBYSMS, ... // Note: We are here only if $conf->global->MAIN_AGENDA_ACTIONAUTO_action is on (tested at begining of this function). // Note that these key can be set in agenda setup, only if defined into llx_c_action_trigger diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 2f691153292..05c9ebb339d 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -66,7 +66,8 @@ LinkedToDolibarrUser=Link to user LinkedToDolibarrThirdParty=Link to third party CreateDolibarrLogin=Create a user CreateDolibarrThirdParty=Create a third party -LoginAccountDisableInDolibarr=Account disabled in Dolibarr. +LoginAccountDisableInDolibarr=Account disabled in Dolibarr +PASSWORDInDolibarr=Password modified in Dolibarr UsePersonalValue=Use personal value ExportDataset_user_1=Users and their properties DomainUser=Domain user %s diff --git a/htdocs/user/card.php b/htdocs/user/card.php index ea47ba10beb..b7254def46a 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -521,7 +521,7 @@ if (empty($reshook)) { } if (!$error) { - $ret = $object->update($user); + $ret = $object->update($user); // This may include call to setPassword if password has changed if ($ret < 0) { $error++; if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 7e342e64337..d7b93d323e1 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2031,9 +2031,9 @@ class User extends CommonObject // Update password if (!empty($this->pass)) { - if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted) { + if ($this->pass != $this->pass_indatabase && !dol_verifyHash($this->pass, $this->pass_indatabase_crypted)) { // If a new value for password is set and different than the one crypted into database - $result = $this->setPassword($user, $this->pass, 0, $notrigger, $nosyncmemberpass); + $result = $this->setPassword($user, $this->pass, 0, $notrigger, $nosyncmemberpass, 0, 1); if ($result < 0) { return -5; } From f2f4cdbe6ab8381efa86db1c7dd5eda37e79e554 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2023 11:48:34 +0100 Subject: [PATCH 189/218] NEW Invalidate all sessions of a user when password is modified. --- htdocs/core/login/functions_dolibarr.php | 12 ------------ htdocs/langs/en_US/errors.lang | 2 ++ htdocs/main.inc.php | 21 +++++++++++++++------ htdocs/user/card.php | 14 ++++++++++++++ htdocs/user/class/user.class.php | 3 +++ 5 files changed, 34 insertions(+), 18 deletions(-) diff --git a/htdocs/core/login/functions_dolibarr.php b/htdocs/core/login/functions_dolibarr.php index b732d2ef64b..5f4b722ea1c 100644 --- a/htdocs/core/login/functions_dolibarr.php +++ b/htdocs/core/login/functions_dolibarr.php @@ -91,18 +91,6 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes dol_syslog("functions_dolibarr::check_user_password_dolibarr bad date end validity", LOG_WARNING); return '--bad-login-validity--'; } - // If there is an invalidation date, check that the current session date is not before this date - if ($obj->flagdelsessionsbefore && !empty($_SESSION["dol_logindate"])) { - dol_syslog("functions_dolibarr::check_user_password_dolibarr user has a date for session invalidation = ".$obj->flagdelsessionsbefore." and session date = ".$_SESSION["dol_logindate"]); - $datetmp = $db->jdate($obj->flagdelsessionsbefore, 'gmt'); - if ($datetmp > $now) { - // Load translation files required by the page - $langs->loadLangs(array('main', 'errors')); - $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorSessionInvalidatedAfterPasswordChange"); - dol_syslog("functions_dolibarr::check_user_password_dolibarr session was invalidated", LOG_WARNING); - return '--bad-login-validity--'; - } - } $passclear = $obj->pass; $passcrypted = $obj->pass_crypted; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index b3eeae4606b..b779c901b54 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -303,6 +303,7 @@ ErrorValueForTooLow=Value for %s is too low ErrorValueCantBeNull=Value for %s can't be null ErrorDateOfMovementLowerThanDateOfFileTransmission=The date of the bank transaction can't be lower than the date of the file transmission ErrorTooMuchFileInForm=Too much files in form, the maximum number is %s file(s) +ErrorSessionInvalidatedAfterPasswordChange=The session was invalidated after a password change. Please relogin. # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. @@ -325,6 +326,7 @@ WarningPaymentDateLowerThanInvoiceDate=Payment date (%s) is earlier than invoice WarningTooManyDataPleaseUseMoreFilters=Too many data (more than %s lines). Please use more filters or set the constant %s to a higher limit. WarningSomeLinesWithNullHourlyRate=Some times were recorded by some users while their hourly rate was not defined. A value of 0 %s per hour was used but this may result in wrong valuation of time spent. WarningYourLoginWasModifiedPleaseLogin=Your login was modified. For security purpose you will have to login with your new login before next action. +WarningYourPasswordWasModifiedPleaseLogin=Your password was modified. For security purpose you will have to login now with your new password. WarningAnEntryAlreadyExistForTransKey=An entry already exists for the translation key for this language WarningNumberOfRecipientIsRestrictedInMassAction=Warning, number of different recipient is limited to %s when using the mass actions on lists WarningDateOfLineMustBeInExpenseReportRange=Warning, the date of line is not in the range of the expense report diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 7d764d4a105..b53688de6e7 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -943,26 +943,35 @@ if (!defined('NOLOGIN')) { dol_syslog("- This is an already logged session. _SESSION['dol_login']=".$login." _SESSION['dol_entity']=".$entity, LOG_DEBUG); $resultFetchUser = $user->fetch('', $login, '', 1, ($entity > 0 ? $entity : -1)); - if ($resultFetchUser <= 0) { - // Account has been removed after login - dol_syslog("Can't load user even if session logged. _SESSION['dol_login']=".$login, LOG_WARNING); + if ($resultFetchUser <= 0 || ($user->flagdelsessionsbefore && !empty($_SESSION["dol_logindate"]) && $user->flagdelsessionsbefore > $_SESSION["dol_logindate"])) { + if ($resultFetchUser <= 0) { + // Account has been removed after login + dol_syslog("Can't load user even if session logged. _SESSION['dol_login']=".$login, LOG_WARNING); + } else { + // Session is no more valid + dol_syslog("The user has a date for session invalidation = ".$user->flagdelsessionsbefore." and a session date = ".$_SESSION["dol_logindate"].". We must invalidate its sessions."); + } session_destroy(); session_set_cookie_params(0, '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Add tag secure and httponly on session cookie session_name($sessionname); session_start(); if ($resultFetchUser == 0) { - // Load translation files required by page $langs->loadLangs(array('main', 'errors')); $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorCantLoadUserFromDolibarrDatabase", $login); $user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login='.$login; - } - if ($resultFetchUser < 0) { + } elseif ($resultFetchUser < 0) { $_SESSION["dol_loginmesg"] = $user->error; $user->trigger_mesg = $user->error; + } else { + $langs->loadLangs(array('main', 'errors')); + + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorSessionInvalidatedAfterPasswordChange"); + + $user->trigger_mesg = 'ErrorUserSessionWasInvalidated - login='.$login; } // Call trigger diff --git a/htdocs/user/card.php b/htdocs/user/card.php index b7254def46a..602bc25eb3a 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -521,6 +521,13 @@ if (empty($reshook)) { } if (!$error) { + $passwordismodified = 0; + if (!empty($object->pass)) { + if ($object->pass != $object->pass_indatabase && !dol_verifyHash($object->pass, $object->pass_indatabase_crypted)) { + $passwordismodified = 1; + } + } + $ret = $object->update($user); // This may include call to setPassword if password has changed if ($ret < 0) { $error++; @@ -615,6 +622,13 @@ if (empty($reshook)) { $langs->load("errors"); setEventMessages($langs->transnoentitiesnoconv("WarningYourLoginWasModifiedPleaseLogin"), null, 'warnings'); } + if ($passwordismodified && $object->login == $user->login) { // Current user has changed its password + $error++; + $langs->load("errors"); + setEventMessages($langs->transnoentitiesnoconv("WarningYourPasswordWasModifiedPleaseLogin"), null, 'warnings'); + header("Location: ".DOL_URL_ROOT.'/user/card.php?id='.$object->id); + exit; + } } else { $db->rollback(); } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index d7b93d323e1..22556d3e1c2 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -276,6 +276,7 @@ class User extends CommonObject public $datelastlogin; public $datepreviouslogin; + public $flagdelsessionsbefore; public $iplastlogin; public $ippreviouslogin; public $datestartvalidity; @@ -441,6 +442,7 @@ class User extends CommonObject $sql .= " u.tms as datem,"; $sql .= " u.datelastlogin as datel,"; $sql .= " u.datepreviouslogin as datep,"; + $sql .= " u.flagdelsessionsbefore,"; $sql .= " u.iplastlogin,"; $sql .= " u.ippreviouslogin,"; $sql .= " u.datelastpassvalidation,"; @@ -575,6 +577,7 @@ class User extends CommonObject $this->datem = $this->db->jdate($obj->datem); $this->datelastlogin = $this->db->jdate($obj->datel); $this->datepreviouslogin = $this->db->jdate($obj->datep); + $this->flagdelsessionsbefore = $this->db->jdate($obj->flagdelsessionsbefore, 'gmt'); $this->iplastlogin = $obj->iplastlogin; $this->ippreviouslogin = $obj->ippreviouslogin; $this->datestartvalidity = $this->db->jdate($obj->datestartvalidity); From 6af49ff2165712d4789d2265c2b6927d803f46fd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2023 12:33:54 +0100 Subject: [PATCH 190/218] Fix warning php8 --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b53688de6e7..2904f576bf7 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -984,7 +984,7 @@ if (!defined('NOLOGIN')) { // Hooks on failed login $action = ''; $hookmanager->initHooks(array('login')); - $parameters = array('dol_authmode'=>$dol_authmode, 'dol_loginmesg'=>$_SESSION["dol_loginmesg"]); + $parameters = array('dol_authmode' => (isset($dol_authmode) ? $dol_authmode : ''), 'dol_loginmesg' => $_SESSION["dol_loginmesg"]); $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { $error++; From 902351cbaa2d15b4f050509e506ec8e2288f3738 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2023 15:45:17 +0100 Subject: [PATCH 191/218] Fix phpunit --- test/phpunit/UserTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index f318ae4cbac..9963007af15 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -204,7 +204,7 @@ class UserTest extends PHPUnit\Framework\TestCase $newlocalobject=new User($this->savdb); $newlocalobject->initAsSpecimen(); $this->changeProperties($newlocalobject); - $this->assertEquals($this->objCompare($localobject, $newlocalobject, true, array('id','socid','societe_id','specimen','note','ref','pass','pass_indatabase','pass_indatabase_crypted','pass_temp','datec','datem','datelastlogin','datepreviouslogin','iplastlogin','ippreviouslogin','trackid')), array()); // Actual, Expected + $this->assertEquals($this->objCompare($localobject, $newlocalobject, true, array('id','socid','societe_id','specimen','note','ref','pass','pass_indatabase','pass_indatabase_crypted','pass_temp','datec','datem','datelastlogin','datepreviouslogin','flagdelsessionsbefore','iplastlogin','ippreviouslogin','trackid')), array()); // Actual, Expected return $localobject; } From 9b164b907c1a9e9b641ff7bd9d4c308e9e36ba83 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 16 Jan 2023 19:25:54 +0100 Subject: [PATCH 192/218] Add warehouse modify and create triggers. Clean and remove deprecated vars. --- htdocs/product/stock/class/entrepot.class.php | 52 ++++++++++++------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 065883e7a2c..ce5bef9c939 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -182,16 +182,17 @@ class Entrepot extends CommonObject /** * Creation d'un entrepot en base * - * @param User $user Object user that create the warehouse + * @param User $user Object user that create the warehouse + * @param bool $notrigger false=launch triggers after, true=disable triggers * @return int >0 if OK, =<0 if KO */ - public function create($user) + public function create($user, $notrigger = false) { global $conf; $error = 0; - $this->label = trim(!empty($this->label) ? $this->label : $this->libelle); + $this->label = trim($this->label); // Error if label not defined if ($this->label == '') { @@ -222,14 +223,21 @@ class Entrepot extends CommonObject // Actions on extra fields if (!$error) { - if (!$error) { - $result = $this->insertExtraFields(); - if ($result < 0) { - $error++; - } + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; } } + if (!$error && !$notrigger) { + // Call triggers + $result = $this->call_trigger('WAREHOUSE_CREATE', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } + if (!$error) { $this->db->commit(); return $id; @@ -254,11 +262,12 @@ class Entrepot extends CommonObject /** * Update properties of a warehouse * - * @param int $id id of warehouse to modify - * @param User $user User object + * @param int $id id of warehouse to modify + * @param User $user User object + * @param bool $notrigger false=launch triggers after, true=disable trigge * @return int >0 if OK, <0 if KO */ - public function update($id, $user) + public function update($id, $user, $notrigger = false) { global $conf; @@ -267,9 +276,6 @@ class Entrepot extends CommonObject if (empty($id)) { $id = $this->id; } - if (empty($this->label)) { - $this->label = $this->libelle; // For backward compatibility - } // Check if new parent is already a child of current warehouse if (!empty($this->fk_parent)) { @@ -281,7 +287,7 @@ class Entrepot extends CommonObject } } - $this->label = trim(!empty($this->label) ? $this->label : $this->libelle); + $this->label = trim($this->label); $this->description = trim($this->description); @@ -324,6 +330,15 @@ class Entrepot extends CommonObject } } + if (!$error && !$notrigger) { + // Call triggers + $result = $this->call_trigger('WAREHOUSE_MODIFY', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } + if (!$error) { $this->db->commit(); return 1; @@ -461,7 +476,6 @@ class Entrepot extends CommonObject $this->fk_project = $obj->fk_project; $this->ref = $obj->label; $this->label = $obj->label; - $this->libelle = $obj->label; // deprecated $this->description = $obj->description; $this->statut = $obj->statut; $this->lieu = $obj->lieu; @@ -705,7 +719,7 @@ class Entrepot extends CommonObject if (isset($this->statut)) { $label .= ' '.$this->getLibStatut(5); } - $label .= '
'.$langs->trans('Ref').': '.(empty($this->ref) ? (empty($this->label) ? $this->libelle : $this->label) : $this->ref); + $label .= '
'.$langs->trans('Ref').': '.(empty($this->ref) ? $this->label : $this->ref); if (!empty($this->lieu)) { $label .= '
'.$langs->trans('LocationSummary').': '.$this->lieu; } @@ -742,7 +756,7 @@ class Entrepot extends CommonObject $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { - $result .= (($showfullpath || !empty($conf->global->STOCK_ALWAYS_SHOW_FULL_ARBO)) ? $this->get_full_arbo() : (empty($this->label) ? $this->libelle : $this->label)); + $result .= (($showfullpath || !empty($conf->global->STOCK_ALWAYS_SHOW_FULL_ARBO)) ? $this->get_full_arbo() : $this->label); } $result .= $linkend; @@ -798,7 +812,7 @@ class Entrepot extends CommonObject // phpcs:enable global $user, $langs, $conf; - $TArbo = array(empty($this->label) ? $this->libelle : $this->label); + $TArbo = array($this->label); $protection = 100; // We limit depth of warehouses to 100 From 73f4b80a0588a787f55e786dbc6b8f8062519d7c Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 16 Jan 2023 19:47:32 +0100 Subject: [PATCH 193/218] Update changelog for removed libelle --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 1a3e96b18ce..fe39e1c1497 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,7 @@ Following changes may create regressions for some external modules, but were nec * The deprecated method "escapeunderscore()" of database handlers has been removed. You must use "escapeforlike()" instead. * The method "nb_expedition()" has been renamed into "countNbOfShipments()" * Revert default type of hooks. Default is now 'addreplace' hooks (and exception become 'output' hooks, that become deprecated). +* Deprecated property libelle removed from entrepot class. From 4cf4da973cac0cda9ca70558f8020c683fcf32f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2023 20:38:03 +0100 Subject: [PATCH 194/218] Add a method for test/dev purpose --- htdocs/core/login/functions_http.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/htdocs/core/login/functions_http.php b/htdocs/core/login/functions_http.php index a23047c8f1c..73f5824c3cd 100644 --- a/htdocs/core/login/functions_http.php +++ b/htdocs/core/login/functions_http.php @@ -63,3 +63,25 @@ function check_user_password_http($usertotest, $passwordtotest, $entitytotest) return $login; } + + +/** + * Decode the value found into the Authorization HTTP header. + * Ex: "Authorization: Basic bG9naW46cGFzcw==", $value is "Basic bG9naW46cGFzcw==" and after base64decode is "login:pass" + * Note: the $_SERVER["REMOTE_USER"] contains only the login used in the HTTP Basic form + * Method not used yet, but we keep it for some dev/test purposes. + * + * @param string $value Ex: $_SERVER["REMOTE_USER"] + * @return Object object.login & object.password + */ +function decodeHttpBasicAuth($value) +{ + $encoded_basic_auth = substr($value, 6); // Remove the "Basic " string + $decoded_basic_auth = base64_decode($encoded_basic_auth); + $credentials_basic_auth = explode(':', $decoded_basic_auth); + + return (object) [ + 'username'=> $credentials_basic_auth[0], + 'password' => $credentials_basic_auth[1] + ]; +} From ce0c69ae96d589d91b3eef113ccc15d6ad65d231 Mon Sep 17 00:00:00 2001 From: Randall Mora <50120822+randallmoraes@users.noreply.github.com> Date: Mon, 16 Jan 2023 23:15:51 -0600 Subject: [PATCH 195/218] Restrict by supplier instead of customer restrict permissions if user does not have access to view providers --- htdocs/core/menus/standard/eldy.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index a671ea31756..d354bc2445c 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1273,7 +1273,7 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le $newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->hasRight('societe', 'contact', 'lire')); } if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) { - $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->hasRight('societe', 'contact', 'lire')); + $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->hasRight('fournisseur', 'lire') ); } $newmenu->add("/contact/list.php?leftmenu=contacts&type=o", $langs->trans("ContactOthers"), 2, $user->hasRight('societe', 'contact', 'lire')); //$newmenu->add("/contact/list.php?userid=$user->id", $langs->trans("MyContacts"), 1, $user->hasRight('societe', 'contact', 'lire')); From 95b391ae0a944e83b4f3d393a54a803c35e485da Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Tue, 17 Jan 2023 10:21:00 +0100 Subject: [PATCH 196/218] Fix - pos total qty --- htdocs/commande/list_det.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index fd36f229e5c..a763394b15b 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -1509,10 +1509,7 @@ if ($resql) { } // Product QtyOrdered if (!empty($arrayfields['cdet.qty']['checked'])) { - print '
'; - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'cdet.qty'; - } + print ''; if (isset($totalarray['val']['cdet.qty'])) { $totalarray['val']['cdet.qty'] += $obj->qty; } else { @@ -1521,6 +1518,9 @@ if ($resql) { if (!$i) { $totalarray['nbfield']++; } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'cdet.qty'; + } } // Ref From 7668233d0ce6b0cee0984c266e432d48b3f28603 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Jan 2023 10:22:23 +0100 Subject: [PATCH 197/218] NEW Tooltip to explain how to add a photo on product --- htdocs/core/class/commonobject.class.php | 36 +++++++++++++----------- htdocs/core/lib/functions.lib.php | 4 +-- htdocs/langs/en_US/main.lang | 3 +- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 93a3e1b5536..d6be7c463a1 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8583,21 +8583,21 @@ abstract class CommonObject /** * Show photos of an object (nbmax maximum), into several columns * - * @param string $modulepart 'product', 'ticket', ... - * @param string $sdir Directory to scan (full absolute path) - * @param int $size 0=original size, 1='small' use thumbnail if possible - * @param int $nbmax Nombre maximum de photos (0=pas de max) - * @param int $nbbyrow Number of image per line or -1 to use div separator or 0 to use no separator. Used only if size=1 or 'small'. - * @param int $showfilename 1=Show filename - * @param int $showaction 1=Show icon with action links (resize, delete) - * @param int $maxHeight Max height of original image when size='small' (so we can use original even if small requested). If 0, always use 'small' thumb image. - * @param int $maxWidth Max width of original image when size='small' - * @param int $nolink Do not add a href link to view enlarged imaged into a new tab - * @param int $notitle Do not add title tag on image - * @param int $usesharelink Use the public shared link of image (if not available, the 'nophoto' image will be shown instead) - * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto + * @param string $modulepart 'product', 'ticket', ... + * @param string $sdir Directory to scan (full absolute path) + * @param int $size 0=original size, 1='small' use thumbnail if possible + * @param int $nbmax Nombre maximum de photos (0=pas de max) + * @param int $nbbyrow Number of image per line or -1 to use div separator or 0 to use no separator. Used only if size=1 or 'small'. + * @param int $showfilename 1=Show filename + * @param int $showaction 1=Show icon with action links (resize, delete) + * @param int $maxHeight Max height of original image when size='small' (so we can use original even if small requested). If 0, always use 'small' thumb image. + * @param int $maxWidth Max width of original image when size='small' + * @param int $nolink Do not add a href link to view enlarged imaged into a new tab + * @param int|string $overwritetitle Do not add title tag on image + * @param int $usesharelink Use the public shared link of image (if not available, the 'nophoto' image will be shown instead) + * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto */ - public function show_photos($modulepart, $sdir, $size = 0, $nbmax = 0, $nbbyrow = 5, $showfilename = 0, $showaction = 0, $maxHeight = 120, $maxWidth = 160, $nolink = 0, $notitle = 0, $usesharelink = 0) + public function show_photos($modulepart, $sdir, $size = 0, $nbmax = 0, $nbbyrow = 5, $showfilename = 0, $showaction = 0, $maxHeight = 120, $maxWidth = 160, $nolink = 0, $overwritetitle = 0, $usesharelink = 0) { // phpcs:enable global $conf, $user, $langs; @@ -8700,8 +8700,12 @@ abstract class CommonObject // Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine $alt = $langs->transnoentitiesnoconv('File').': '.$relativefile; $alt .= ' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height']; - if ($notitle) { - $alt = ''; + if ($overwritetitle) { + if (is_numeric($overwritetitle)) { + $alt = ''; + } else { + $alt = $overwritetitle; + } } $addphotorefcss = 1; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3e3a87c7bd0..a25d083c251 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2122,14 +2122,14 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi $maxvisiblephotos = 1; } if ($showimage) { - $morehtmlleft .= '
'.$object->show_photos('product', $conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0).'
'; + $morehtmlleft .= '
'.$object->show_photos('product', $conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, 0, $width, 0, '').'
'; } else { if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) { $nophoto = ''; $morehtmlleft .= '
'; } else { // Show no photo link $nophoto = '/public/theme/common/nophoto.png'; - $morehtmlleft .= '
No photo
'; + $morehtmlleft .= '
transnoentitiesnoconv("Documents"))).'" alt="No photo"'.($width ? ' style="width: '.$width.'px"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">
'; } } } elseif ($object->element == 'ticket') { diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index e7c7e010266..f65a05ce455 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1219,4 +1219,5 @@ NoSpecificContactAddress=No specific contact or address NoSpecificContactAddressBis=This tab is dedicated to force specific contacts or addresses for the current object. Use it only if you want to define one or several specific contacts or addresses for the object when the information on the thirdparty is not enough or not accurate. HideOnVCard=Hide %s AddToContacts=Add address to my contacts -LastAccess=Last access \ No newline at end of file +LastAccess=Last access +UploadAnImageToSeeAPhotoHere=Upload an image from the tab %s to see a photo here \ No newline at end of file From 756a971dadf049ded467dc4e5fca14747331e32c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Jan 2023 11:23:19 +0100 Subject: [PATCH 198/218] NEW Bank name no more mandatory on creation. Can be generated if empty. --- htdocs/societe/paymentmodes.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 0166a3a5635..bf4e1135f96 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -257,13 +257,8 @@ if (empty($reshook)) { if ($action == 'add') { $error = 0; - if (!GETPOST('label', 'alpha') || !GETPOST('bank', 'alpha')) { - if (!GETPOST('label', 'alpha')) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); - } - if (!GETPOST('bank', 'alpha')) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankName")), null, 'errors'); - } + if (!GETPOST('label', 'alpha')) { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); $action = 'create'; $error++; } @@ -274,6 +269,8 @@ if (empty($reshook)) { $companybankaccount->socid = $object->id; + $companybankaccount->fetch_thirdparty(); + $companybankaccount->bank = GETPOST('bank', 'alpha'); $companybankaccount->label = GETPOST('label', 'alpha'); $companybankaccount->courant = GETPOST('courant', 'alpha'); @@ -293,6 +290,12 @@ if (empty($reshook)) { $companybankaccount->datec = dol_now(); $companybankaccount->status = 1; + $companybankaccount->bank = trim($companybankaccount->bank); + if (empty($companybankaccount->bank) && !empty($companybankaccount->thirdparty)) { + $companybankaccount->bank = $langs->trans("Bank").' '.$companybankaccount->thirdparty->name; + } + $companybankaccount->bic = str_replace(' ', '', $companybankaccount->bic); + $db->begin(); // This test can be done only once properties were set @@ -1980,7 +1983,7 @@ if ($socid && $action == 'create' && $permissiontoaddupdatepaymentinformation) { print '
'; print ''; - print ''; + print ''; print ''; // Show fields of bank account From eb6b42d1e34f8f177f58f62e473b26a59bb6b017 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Tue, 17 Jan 2023 11:25:16 +0100 Subject: [PATCH 199/218] NEW - Add sub total in order list det --- htdocs/commande/list_det.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index fd36f229e5c..e638e56ff9a 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -1402,6 +1402,7 @@ if ($resql) { $total_ht = 0; $total_margin = 0; + // Détail commande $totalqty = 0; @@ -1419,6 +1420,15 @@ if ($resql) { $text_warning = ''; $nbprod = 0; + // Print SubTotal + if (empty($i)) { + $oldref = $obj->product_ref; + } + if ($oldref != $obj->product_ref) { + include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + $oldref = $obj->product_ref; + } + $companystatic->id = $obj->socid; $companystatic->name = $obj->name; $companystatic->name_alias = $obj->alias; From 9c082d5df26e89494225b96aec026162b700cc0b Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 17 Jan 2023 11:31:40 +0100 Subject: [PATCH 200/218] kanban mode for liste of expensereport --- .../class/expensereport.class.php | 37 ++ htdocs/expensereport/list.php | 373 ++++++++++-------- 2 files changed, 237 insertions(+), 173 deletions(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 63cbeaad67b..e0b10319b45 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2675,6 +2675,43 @@ class ExpenseReport extends CommonObject return -1; } } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs, $selected,$arrayofselected; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (in_array($this->id, $arrayofselected)) { + $selected = 1; + } + $return .= ''; + if (property_exists($this, 'fk_user_author') && !empty($this->id)) { + $return .= '
'.$this->fk_user_author.''; + } + if (property_exists($this, 'date_debut') && property_exists($this, 'date_fin')) { + $return .= '
'.dol_print_date($this->date_debut, 'day').''; + $return .= ' '.$langs->trans("To").' '; + $return .= ''.dol_print_date($this->date_fin, 'day').''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index ad16d5fb09f..918c916a52c 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -50,6 +50,7 @@ $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'expensereportlist'; +$mode = GETPOST('mode', 'alpha'); $childids = $user->getAllChildIds(1); @@ -378,6 +379,9 @@ if ($resql) { $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -471,6 +475,7 @@ if ($resql) { print ''; print ''; print ''; + print ''; if ($id > 0) { print ''; } @@ -512,7 +517,10 @@ if ($resql) { if (!empty($socid)) { $url .= '&socid='.$socid; } - $newcardbutton = dolGetButtonTitle($langs->trans('NewTrip'), '', 'fa fa-plus-circle', $url, '', $user->rights->expensereport->creer); + $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('NewTrip'), '', 'fa fa-plus-circle', $url, '', $user->rights->expensereport->creer); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'trip', 0, $newcardbutton, '', $limit, 0, 0, 1); } @@ -739,185 +747,204 @@ if ($resql) { $expensereportstatic->note_private = $obj->note_private; $expensereportstatic->note_public = $obj->note_public; + if ($mode == 'kanban') { + if ($i == 0) { + print '
'; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - // Ref - if (!empty($arrayfields['d.ref']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // User - if (!empty($arrayfields['user']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Start date - if (!empty($arrayfields['d.date_debut']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // End date - if (!empty($arrayfields['d.date_fin']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date validation - if (!empty($arrayfields['d.date_valid']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date approval - if (!empty($arrayfields['d.date_approve']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount HT - if (!empty($arrayfields['d.total_ht']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'd.total_ht'; - } - $totalarray['val']['d.total_ht'] += $obj->total_ht; - } - // Amount VAT - if (!empty($arrayfields['d.total_vat']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'd.total_tva'; - } - $totalarray['val']['d.total_tva'] += $obj->total_tva; - } - // Amount TTC - if (!empty($arrayfields['d.total_ttc']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'd.total_ttc'; - } - $totalarray['val']['d.total_ttc'] += $obj->total_ttc; - } - - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - // Date creation - if (!empty($arrayfields['d.date_create']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['d.tms']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - if (!empty($arrayfields['d.fk_statut']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; } - print ''; + // Ref + if (!empty($arrayfields['d.ref']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // User + if (!empty($arrayfields['user']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Start date + if (!empty($arrayfields['d.date_debut']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // End date + if (!empty($arrayfields['d.date_fin']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date validation + if (!empty($arrayfields['d.date_valid']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date approval + if (!empty($arrayfields['d.date_approve']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount HT + if (!empty($arrayfields['d.total_ht']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'd.total_ht'; + } + $totalarray['val']['d.total_ht'] += $obj->total_ht; + } + // Amount VAT + if (!empty($arrayfields['d.total_vat']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'd.total_tva'; + } + $totalarray['val']['d.total_tva'] += $obj->total_tva; + } + // Amount TTC + if (!empty($arrayfields['d.total_ttc']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'd.total_ttc'; + } + $totalarray['val']['d.total_ttc'] += $obj->total_ttc; + } + + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + // Date creation + if (!empty($arrayfields['d.date_create']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date modification + if (!empty($arrayfields['d.tms']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['d.fk_statut']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + + print "\n"; } - if (!$i) { - $totalarray['nbfield']++; - } - - print "\n"; - - $total_total_ht = $total_total_ht + $obj->total_ht; - $total_total_tva = $total_total_tva + $obj->total_tva; - $total_total_ttc = $total_total_ttc + $obj->total_ttc; - + $total_total_ht = $total_total_ht + $obj->total_ht; + $total_total_tva = $total_total_tva + $obj->total_tva; + $total_total_ttc = $total_total_ttc + $obj->total_ttc; $i++; } } else { From a165489237b8dc5da4b8213b247d33365d779e74 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Tue, 17 Jan 2023 11:46:39 +0100 Subject: [PATCH 201/218] Move checkbox --- htdocs/commande/list_det.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index fd36f229e5c..385408663fd 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -830,10 +830,6 @@ if ($resql) { print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'order', 0, $newcardbutton, '', $limit, 0, 0, 1); - print ''; - print ''; - print ''; - $topicmail = "SendOrderRef"; $modelmail = "order_send"; $objecttmp = new Commande($db); @@ -849,6 +845,11 @@ if ($resql) { $moreforfilter = ''; + $moreforfilter .= ''; + $moreforfilter .= ''; + $moreforfilter .= ''; + $moreforfilter .= '
'; + // If the user can view prospects other than his' if ($user->rights->user->user->lire) { $langs->load("commercial"); @@ -888,6 +889,8 @@ if ($resql) { $moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', 1, 0, 0, $tmptitle, 0, 0, array(), 'maxwidth250 widthcentpercentminusx'); $moreforfilter .= ''; } + + $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook if (empty($reshook)) { From 8ced6d52e745f0ee6ae95f093e24298f2d01df55 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Jan 2023 11:47:16 +0100 Subject: [PATCH 202/218] FIX Component js to generate password --- htdocs/core/ajax/security.php | 9 +++++---- htdocs/core/lib/security2.lib.php | 7 ++++--- htdocs/user/card.php | 14 ++++++++------ 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/htdocs/core/ajax/security.php b/htdocs/core/ajax/security.php index e5dc91c05d1..b01c952662e 100644 --- a/htdocs/core/ajax/security.php +++ b/htdocs/core/ajax/security.php @@ -36,9 +36,10 @@ if (!defined('NOREQUIREAJAX')) { if (!defined('NOREQUIRESOC')) { define('NOREQUIRESOC', '1'); } -if (!defined('NOREQUIRETRAN')) { +// We need langs because the getRandomPassword may use user language to define some rules of pass generation +/*if (!defined('NOREQUIRETRAN')) { define('NOREQUIRETRAN', '1'); -} +}*/ // Load Dolibarr environment require '../../main.inc.php'; @@ -55,9 +56,9 @@ top_httphead(); //print ''."\n"; -// Registering the location of boxes +// Return a new generated password if ($action) { - if ($action == 'getrandompassword' && ($user->admin || $user->rights->api->apikey->generate)) { + if ($action == 'getrandompassword') { require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; $generic = GETPOST('generic') ? true : false; echo getRandomPassword($generic); diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 5e4d58103d8..f450d390dff 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -560,10 +560,11 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len * * @param string $htmlname HTML name of element to insert key into * @param string $htmlnameofbutton HTML name of button + * @param int $generic 1=Return a generic pass, 0=Return a pass following setup rules * @return string HTML javascript code to set a password * @see getRandomPassword() */ -function dolJSToSetRandomPassword($htmlname, $htmlnameofbutton = 'generate_token') +function dolJSToSetRandomPassword($htmlname, $htmlnameofbutton = 'generate_token', $generic = 1) { global $conf; @@ -571,10 +572,10 @@ function dolJSToSetRandomPassword($htmlname, $htmlnameofbutton = 'generate_token print "\n".'
'; @@ -712,6 +724,7 @@ if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { print $searchpicto; print ' '; print ''; print ''; print ''; $arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"), 'other'=>$langs->trans("Genderother")); print $form->selectarray('search_gender', $arraygender, $search_gender, 1); print ''; print ''; print ''; @@ -756,6 +782,8 @@ if (!empty($arrayfields['d.morphy']['checked'])) { print $form->selectarray('search_morphy', $arraymorphy, $search_morphy, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100'); print ''; print ''; print ''; print ''; print ''; print ''; print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100'); print ''; print ''; - print ''; print ''; print ''; @@ -819,6 +858,7 @@ if (!empty($arrayfields['d.datefin']['checked'])) { print $form->selectarray('search_filter', $selectarray, $search_filter); print ''; print ''; print ''; print ''; @@ -853,11 +897,14 @@ if (!empty($arrayfields['d.statut']['checked'])) { print $form->selectarray('search_status', $liststatus, $search_status, -3, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage'); print ''; print ''; print ''; @@ -938,6 +985,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; + if (!empty($arrayfields['d.datec']['checked'])) { print_liste_field_titre($arrayfields['d.datec']['label'], $_SERVER["PHP_SELF"], "d.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); } @@ -1025,14 +1073,13 @@ while ($i < min($num, $limit)) { } print ''.$obj->rowid.'"; @@ -1142,7 +1189,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - // State + // State / County / Departement if (!empty($arrayfields['state.nom']['checked'])) { print "".$obj->state_name."'; print ''; print ''; print ''; print ''; @@ -1014,7 +1038,7 @@ if (!empty($arrayfields['p.fk_soc']['checked']) || !empty($arrayfields['s.nom'][ print ''; print ''; print ''; @@ -1079,7 +1103,7 @@ if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { } print '
'; @@ -1247,7 +1272,8 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - // Name + + // (Last) Name if (!empty($arrayfields['p.lastname']['checked'])) { print ''; print $contactstatic->getNomUrl(1); @@ -1256,6 +1282,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + // Firstname if (!empty($arrayfields['p.firstname']['checked'])) { print ''.dol_escape_htmltag($obj->firstname).''.dol_escape_htmltag($obj->poste).''.dol_escape_htmltag($obj->address).''.dol_escape_htmltag($obj->zip).''.dol_escape_htmltag($obj->town).'".$obj->state_name."".$obj->region_name."'; @@ -1313,13 +1348,15 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - // Phone + + // Phone pro if (!empty($arrayfields['p.phone']['checked'])) { print ''.dol_print_phone($obj->phone_pro, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').''.dol_print_phone($obj->phone_perso, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').''.dol_print_phone($obj->phone_mobile, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'mobile').''.dol_print_phone($obj->fax, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'fax').''.dol_print_email($obj->email, $obj->rowid, $obj->socid, 'AC_EMAIL', 18, 0, 1).''; if (empty($obj->email)) { @@ -1361,6 +1402,8 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + + // Social Networks if (isModEnabled('socialnetworks')) { foreach ($socialnetworks as $key => $value) { if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) { @@ -1371,7 +1414,8 @@ while ($i < min($num, $limit)) { } } } - // Company + + // Company / Third Party if (!empty($arrayfields['p.fk_soc']['checked']) || !empty($arrayfields['s.nom']['checked'])) { print ''; if ($obj->socid) { @@ -1404,9 +1448,9 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - + + // Prospect Level if (!empty($arrayfields['p.fk_prospectlevel']['checked'])) { - // Prospect level print ''; print $contactstatic->getLibProspLevel(); print "
'; print '
'.$contactstatic->libProspCommStatut($obj->stcomm_id, 2, $contactstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto); print '
-
'; @@ -1437,6 +1481,7 @@ while ($i < min($num, $limit)) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -1450,6 +1495,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + // Date modification if (!empty($arrayfields['p.tms']['checked'])) { print '
'; @@ -1459,6 +1505,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + // Status if (!empty($arrayfields['p.statut']['checked'])) { print ''.$contactstatic->getLibStatut(5).''; From 35300b3dfc0b84910959113e74b2555f14804ca7 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 14 Jan 2023 16:42:30 +0000 Subject: [PATCH 166/218] Fixing style errors. --- htdocs/contact/list.php | 50 ++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 1cc2d67cf93..f34c477ff71 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -455,7 +455,7 @@ if ($search_priv != '0' && $search_priv != '1') { // Search Categories - // Search Contact Categories + // Search Contact Categories $searchCategoryContactList = $search_categ ? array($search_categ) : array(); $searchCategoryContactOperator = 0; // Search for tag/category ($searchCategoryContactList is an array of ID) @@ -487,7 +487,7 @@ if (!empty($searchCategoryContactList)) { } } - // Search Customer Categories + // Search Customer Categories $searchCategoryCustomerList = $search_categ_thirdparty ? array($search_categ_thirdparty) : array(); $searchCategoryCustomerOperator = 0; // Search for tag/category ($searchCategoryCustomerList is an array of ID) @@ -976,7 +976,7 @@ if (!empty($arrayfields['p.town']['checked'])) { print ''; print ''; @@ -1272,7 +1272,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - + // (Last) Name if (!empty($arrayfields['p.lastname']['checked'])) { print ''; @@ -1282,7 +1282,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - + // Firstname if (!empty($arrayfields['p.firstname']['checked'])) { print ''.dol_escape_htmltag($obj->firstname).''.dol_escape_htmltag($obj->poste).''.dol_escape_htmltag($obj->address).''.dol_escape_htmltag($obj->zip).''.dol_escape_htmltag($obj->town).'".$obj->state_name."".$obj->region_name."'; @@ -1348,7 +1348,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - + // Phone pro if (!empty($arrayfields['p.phone']['checked'])) { print ''.dol_print_phone($obj->phone_pro, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').''.dol_print_phone($obj->phone_perso, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').''.dol_print_phone($obj->phone_mobile, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'mobile').''.dol_print_phone($obj->fax, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'fax').''.dol_print_email($obj->email, $obj->rowid, $obj->socid, 'AC_EMAIL', 18, 0, 1).''; @@ -1402,7 +1402,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - + // Social Networks if (isModEnabled('socialnetworks')) { foreach ($socialnetworks as $key => $value) { @@ -1448,7 +1448,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - + // Prospect Level if (!empty($arrayfields['p.fk_prospectlevel']['checked'])) { print ''; @@ -1481,7 +1481,7 @@ while ($i < min($num, $limit)) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - + // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -1495,7 +1495,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - + // Date modification if (!empty($arrayfields['p.tms']['checked'])) { print ''; @@ -1505,7 +1505,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - + // Status if (!empty($arrayfields['p.statut']['checked'])) { print ''.$contactstatic->getLibStatut(5).''; From 64ecdd0632f4ef18518abcedf7ba117635e99362 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 14 Jan 2023 18:35:09 +0100 Subject: [PATCH 167/218] Update subaccount.php --- htdocs/accountancy/admin/subaccount.php | 32 ++++++++++++++++--------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index 4f2274269d8..2f6a731ca48 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -19,17 +19,18 @@ /** * \file htdocs/accountancy/admin/subaccount.php - * \ingroup Accountancy (Double entries) - * \brief List of accounting sub-account (auxiliary accounts) + * \ingroup Accountancy (Double entries) + * \brief List of accounting sub-account (auxiliary accounts) */ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; + // Load translation files required by the page -$langs->loadLangs(array("compta", "bills", "admin", "accountancy", "salaries", "hrm", "errors")); +$langs->loadLangs(array("accountancy", "admin", "bills", "compta", "errors", "hrm", "salaries")); $mesg = ''; $action = GETPOST('action', 'aZ09'); @@ -81,6 +82,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL < 2) { unset($arrayfields['reconcilable']); } + /* * Actions */ @@ -120,11 +122,13 @@ if (empty($reshook)) { $form = new Form($db); -$help_url = ''; -$title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger'); +// Page Header +$help_url = 'EN:Module_Double_Entry_Accounting#Setup'; +$title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger'); llxHeader('', $title, $help_url); + // Customer $sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '1' as type, sa.entity"; $sql .= " FROM ".MAIN_DB_PREFIX."societe sa"; @@ -219,7 +223,7 @@ if (!empty($search_type) && $search_type >= 0) { $sql .= " HAVING type LIKE '".$db->escape($search_type)."'"; } -// User +// User - Employee $sql .= " UNION "; $sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '3' as type, u.entity FROM ".MAIN_DB_PREFIX."user u"; $sql .= " WHERE u.entity IN (".getEntity('user').")"; @@ -400,14 +404,17 @@ if ($resql) { if (!empty($arrayfields['type']['checked'])) { print ''; $s = ''; + // Customer if ($obj->type == 1) { $s .= ''.$langs->trans("Customer").''; } elseif ($obj->type == 2) { - // Supplier + + // Supplier $s .= ''.$langs->trans("Supplier").''; } elseif ($obj->type == 3) { - // User + + // User - Employee $s .= ''.$langs->trans("Employee").''; } print $s; @@ -440,14 +447,17 @@ if ($resql) { // Action print ''; $e = ''; + // Customer if ($obj->type == 1) { $e .= ''.img_edit().''; } elseif ($obj->type == 2) { - // Supplier + + // Supplier $e .= ''.img_edit().''; } elseif ($obj->type == 3) { - // User + + // User - Employee $e .= ''.img_edit().''; } print $e; From 5fef3398fd2e70a17ff9d3c8ce9b4185e1deb356 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 14 Jan 2023 17:36:09 +0000 Subject: [PATCH 168/218] Fixing style errors. --- htdocs/accountancy/admin/subaccount.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index 2f6a731ca48..40055a4b75f 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -404,17 +404,15 @@ if ($resql) { if (!empty($arrayfields['type']['checked'])) { print ''; $s = ''; - + // Customer if ($obj->type == 1) { $s .= ''.$langs->trans("Customer").''; } elseif ($obj->type == 2) { - - // Supplier + // Supplier $s .= ''.$langs->trans("Supplier").''; } elseif ($obj->type == 3) { - - // User - Employee + // User - Employee $s .= ''.$langs->trans("Employee").''; } print $s; @@ -447,17 +445,15 @@ if ($resql) { // Action print ''; $e = ''; - + // Customer if ($obj->type == 1) { $e .= ''.img_edit().''; } elseif ($obj->type == 2) { - - // Supplier + // Supplier $e .= ''.img_edit().''; } elseif ($obj->type == 3) { - - // User - Employee + // User - Employee $e .= ''.img_edit().''; } print $e; From 982ee6259fa649b233b98e0e5e9f88a5127cc54e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Jan 2023 21:21:48 +0100 Subject: [PATCH 169/218] NEW Session invalidation after a password change --- htdocs/api/class/api_login.class.php | 3 +++ htdocs/core/lib/security2.lib.php | 7 +++---- htdocs/core/lib/ws.lib.php | 4 ++++ htdocs/core/login/functions_dolibarr.php | 19 ++++++++++++++++++- htdocs/main.inc.php | 1 + htdocs/user/card.php | 4 ++++ htdocs/user/class/user.class.php | 2 +- 7 files changed, 34 insertions(+), 6 deletions(-) diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index d5362f4ac56..0b8d3e64828 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -121,6 +121,9 @@ class Login include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; $login = checkLoginPassEntity($login, $password, $entity, $authmode, 'api'); // Check credentials. + if ($login === '--bad-login-validity--') { + $login = ''; + } if (empty($login)) { throw new RestException(403, 'Access denied'); } diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index b33ad1333ef..5e4d58103d8 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -52,12 +52,11 @@ function dol_getwebuser($mode) * @param string $entitytotest Instance of data we must check * @param array $authmode Array list of selected authentication mode array('http', 'dolibarr', 'xxx'...) * @param string $context Context checkLoginPassEntity was created for ('api', 'dav', 'ws', '') - * @return string Login or '' + * @return string Login or '' or '--bad-login-validity--' */ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode, $context = '') { global $conf, $langs; - //global $dolauthmode; // To return authentication finally used // Check parameters if ($entitytotest == '') { @@ -100,10 +99,10 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth if ($login && $login != '--bad-login-validity--') { // Login is successfull $test = false; // To stop once at first login success $conf->authmode = $mode; // This properties is defined only when logged to say what mode was successfully used - $dol_tz = GETPOST('tz'); + /*$dol_tz = GETPOST('tz'); $dol_dst = GETPOST('dst'); $dol_screenwidth = GETPOST('screenwidth'); - $dol_screenheight = GETPOST('screenheight'); + $dol_screenheight = GETPOST('screenheight');*/ } } else { dol_syslog("Authentication KO - failed to load file '".$authfile."'", LOG_ERR); diff --git a/htdocs/core/lib/ws.lib.php b/htdocs/core/lib/ws.lib.php index ad4688f9134..a26604b18bc 100644 --- a/htdocs/core/lib/ws.lib.php +++ b/htdocs/core/lib/ws.lib.php @@ -86,6 +86,10 @@ function check_authentication($authentication, &$error, &$errorcode, &$errorlabe include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; $login = checkLoginPassEntity($authentication['login'], $authentication['password'], $authentication['entity'], $authmode, 'ws'); + if ($login === '--bad-login-validity--') { + $login = ''; + } + if (empty($login)) { $error++; $errorcode = 'BAD_CREDENTIALS'; diff --git a/htdocs/core/login/functions_dolibarr.php b/htdocs/core/login/functions_dolibarr.php index e8c3ab38e46..b732d2ef64b 100644 --- a/htdocs/core/login/functions_dolibarr.php +++ b/htdocs/core/login/functions_dolibarr.php @@ -28,6 +28,7 @@ /** * Check validity of user/password/entity * If test is ko, reason must be filled into $_SESSION["dol_loginmesg"] + * Note: On critical error (hack attempt), we put a log "functions_dolibarr::check_user_password_dolibarr authentication KO" * * @param string $usertotest Login * @param string $passwordtotest Password @@ -56,7 +57,7 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes $usernamecol2 = 'email'; $entitycol = 'entity'; - $sql = "SELECT rowid, login, entity, pass, pass_crypted, datestartvalidity, dateendvalidity"; + $sql = "SELECT rowid, login, entity, pass, pass_crypted, datestartvalidity, dateendvalidity, flagdelsessionsbefore"; $sql .= " FROM ".$table; $sql .= " WHERE (".$usernamecol1." = '".$db->escape($usertotest)."'"; if (preg_match('/@/', $usertotest)) { @@ -74,18 +75,34 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes $obj = $db->fetch_object($resql); if ($obj) { $now = dol_now(); + // Check date start validity if ($obj->datestartvalidity && $db->jdate($obj->datestartvalidity) > $now) { // Load translation files required by the page $langs->loadLangs(array('main', 'errors')); $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity"); + dol_syslog("functions_dolibarr::check_user_password_dolibarr bad datestart validity", LOG_WARNING); return '--bad-login-validity--'; } + // Check date end validity if ($obj->dateendvalidity && $db->jdate($obj->dateendvalidity) < dol_get_first_hour($now)) { // Load translation files required by the page $langs->loadLangs(array('main', 'errors')); $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity"); + dol_syslog("functions_dolibarr::check_user_password_dolibarr bad date end validity", LOG_WARNING); return '--bad-login-validity--'; } + // If there is an invalidation date, check that the current session date is not before this date + if ($obj->flagdelsessionsbefore && !empty($_SESSION["dol_logindate"])) { + dol_syslog("functions_dolibarr::check_user_password_dolibarr user has a date for session invalidation = ".$obj->flagdelsessionsbefore." and session date = ".$_SESSION["dol_logindate"]); + $datetmp = $db->jdate($obj->flagdelsessionsbefore, 'gmt'); + if ($datetmp > $now) { + // Load translation files required by the page + $langs->loadLangs(array('main', 'errors')); + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorSessionInvalidatedAfterPasswordChange"); + dol_syslog("functions_dolibarr::check_user_password_dolibarr session was invalidated", LOG_WARNING); + return '--bad-login-validity--'; + } + } $passclear = $obj->pass; $passcrypted = $obj->pass_crypted; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 549c72157a6..7d764d4a105 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1048,6 +1048,7 @@ if (!defined('NOLOGIN')) { // Store value into session (values always stored) $_SESSION["dol_login"] = $user->login; + $_SESSION["dol_logindate"] = dol_now('gmt'); $_SESSION["dol_authmode"] = isset($dol_authmode) ? $dol_authmode : ''; $_SESSION["dol_tz"] = isset($dol_tz) ? $dol_tz : ''; $_SESSION["dol_tz_string"] = isset($dol_tz_string) ? $dol_tz_string : ''; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 67ea2174322..0af78cc208f 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -71,6 +71,10 @@ $group = GETPOST("group", "int", 3); $cancel = GETPOST('cancel', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'useracard'; // To manage different context of search +if (empty($id)) { + $id = $user->id; +} + $dateemployment = dol_mktime(0, 0, 0, GETPOST('dateemploymentmonth', 'int'), GETPOST('dateemploymentday', 'int'), GETPOST('dateemploymentyear', 'int')); $dateemploymentend = dol_mktime(0, 0, 0, GETPOST('dateemploymentendmonth', 'int'), GETPOST('dateemploymentendday', 'int'), GETPOST('dateemploymentendyear', 'int')); $datestartvalidity = dol_mktime(0, 0, 0, GETPOST('datestartvaliditymonth', 'int'), GETPOST('datestartvalidityday', 'int'), GETPOST('datestartvalidityyear', 'int')); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 9e208ff3e37..7e342e64337 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2298,7 +2298,7 @@ class User extends CommonObject $sql = "UPDATE ".$this->db->prefix()."user"; $sql .= " SET pass_crypted = '".$this->db->escape($password_crypted)."',"; $sql .= " pass_temp = null"; - if (empty($flagdelsessionsbefore)) { + if (!empty($flagdelsessionsbefore)) { $sql .= ", flagdelsessionsbefore = '".$this->db->idate(dol_now() - 5, 'gmt')."'"; } if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) { From 39a224d7a1eaf637c369a199a8971b5c5874a019 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sun, 15 Jan 2023 01:18:32 +0100 Subject: [PATCH 170/218] Update bookmarks.lang --- htdocs/langs/en_US/bookmarks.lang | 47 ++++++++++++++++--------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/htdocs/langs/en_US/bookmarks.lang b/htdocs/langs/en_US/bookmarks.lang index 26551eee4f0..bfbab1ef520 100644 --- a/htdocs/langs/en_US/bookmarks.lang +++ b/htdocs/langs/en_US/bookmarks.lang @@ -1,23 +1,24 @@ -# Dolibarr language file - Source file is en_US - marque pages -AddThisPageToBookmarks=Add current page to bookmarks -Bookmark=Bookmark -Bookmarks=Bookmarks -ListOfBookmarks=List of bookmarks -EditBookmarks=List/edit bookmarks -NewBookmark=New bookmark -ShowBookmark=Show bookmark -OpenANewWindow=Open a new tab -ReplaceWindow=Replace current tab -BookmarkTargetNewWindowShort=New tab -BookmarkTargetReplaceWindowShort=Current tab -BookmarkTitle=Bookmark name -UrlOrLink=URL -BehaviourOnClick=Behaviour when a bookmark URL is selected -CreateBookmark=Create bookmark -SetHereATitleForLink=Set a name for the bookmark -UseAnExternalHttpLinkOrRelativeDolibarrLink=Use an external/absolute link (https://externalurl.com) or an internal/relative link (/mypage.php). You can also use phone like tel:0123456. -ChooseIfANewWindowMustBeOpenedOnClickOnBookmark=Choose if the linked page should open in the current tab or a new tab -BookmarksManagement=Bookmarks management -BookmarksMenuShortCut=Ctrl + shift + m -NoBookmarks=No bookmarks defined -NoBookmarkFound=No bookmark found \ No newline at end of file +# Dolibarr language file - Source file is en_US - marque pages / bookmarks + +AddThisPageToBookmarks = Add current page to bookmarks +BehaviourOnClick = Behaviour when a bookmark URL is selected +Bookmark = Bookmark +Bookmarks = Bookmarks +BookmarkTargetNewWindowShort = New tab +BookmarkTargetReplaceWindowShort = Current tab +BookmarkTitle = Bookmark name +BookmarksManagement = Bookmarks management +BookmarksMenuShortCut = Ctrl + shift + m +ChooseIfANewWindowMustBeOpenedOnClickOnBookmark = Choose if the linked page should open in the current tab or a new tab +CreateBookmark = Create bookmark +EditBookmarks = List/edit bookmarks +ListOfBookmarks = List of bookmarks +NewBookmark = New bookmark +NoBookmarkFound = No bookmark found +NoBookmarks = No bookmarks defined +OpenANewWindow = Open a new tab +ReplaceWindow = Replace current tab +SetHereATitleForLink = Set a name for the bookmark +ShowBookmark = Show bookmark +UrlOrLink = URL +UseAnExternalHttpLinkOrRelativeDolibarrLink = Use an external/absolute link (https://externalurl.com) or an internal/relative link (/mypage.php). You can also use phone like tel:0123456. From b754b7a99fb530c4f7eee006ae7dc9b0ef0ee51f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Jan 2023 01:25:07 +0100 Subject: [PATCH 171/218] Enhance vcard --- htdocs/core/class/vcard.class.php | 10 ++++++---- htdocs/public/users/view.php | 27 +++++++++++++++------------ htdocs/user/virtualcard.php | 8 ++++++++ 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index e7eb318e476..4404736f5e0 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -183,7 +183,7 @@ class vCard } /** - * mise en forme de l'adresse + * Address * * @param string $postoffice Postoffice * @param string $extended Extended @@ -196,7 +196,7 @@ class vCard * @param string $label Label * @return void */ - public function setAddress($postoffice = "", $extended = "", $street = "", $city = "", $region = "", $zip = "", $country = "", $type = "HOME", $label = '') + public function setAddress($postoffice = "", $extended = "", $street = "", $city = "", $region = "", $zip = "", $country = "", $type = "", $label = "") { // $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL" $key = "ADR"; @@ -207,7 +207,7 @@ class vCard $key .= ';LABEL="'.encode($label).'"'; } $key .= ";".$this->encoding; - $this->properties[$key] = ";".encode($extended).";".encode($street).";".encode($city).";".encode($region).";".encode($zip).";".encode($country); + $this->properties[$key] = encode($postoffice).";".encode($extended).";".encode($street).";".encode($city).";".encode($region).";".encode($zip).";".encode($country); //if ($this->properties["LABEL;".$type.";".$this->encoding] == '') { //$this->setLabel($postoffice, $extended, $street, $city, $region, $zip, $country, $type); @@ -215,7 +215,7 @@ class vCard } /** - * mise en forme du label + * Address (old standard) * * @param string $postoffice Postoffice * @param string $extended Extended @@ -226,6 +226,7 @@ class vCard * @param string $country Country * @param string $type Type * @return void + * @deprecated */ public function setLabel($postoffice = "", $extended = "", $street = "", $city = "", $region = "", $zip = "", $country = "", $type = "HOME") { @@ -378,6 +379,7 @@ class vCard /** * Return a VCARD string + * See RFC https://datatracker.ietf.org/doc/html/rfc6350 * * @param Object $object Object (User or Contact) * @param Societe|null $company Company. May be null diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php index ec5f53377c2..a5d3ac5b1e6 100644 --- a/htdocs/public/users/view.php +++ b/htdocs/public/users/view.php @@ -114,11 +114,11 @@ if (!empty($object->photo)) { $urllogo = ''; $urllogofull = ''; if (!empty($logosmall) && is_readable($dir.'/'.$logosmall)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&securekey='.urlencode($securekey).'&file='.urlencode($logosmall); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&securekey='.urlencode($securekey).'&file='.urlencode($logosmall); + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&securekey='.urlencode($securekey).'&file='.urlencode($logosmall); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&securekey='.urlencode($securekey).'&file='.urlencode($logosmall); } elseif (!empty($logo) && is_readable($dir.'/'.$logo)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&securekey='.urlencode($securekey).'&file='.urlencode($logo); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&securekey='.urlencode($securekey).'&file='.urlencode($logo); + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&securekey='.urlencode($securekey).'&file='.urlencode($logo); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&securekey='.urlencode($securekey).'&file='.urlencode($logo); } // Clean data we don't want on public page @@ -152,6 +152,12 @@ if (getDolUserInt('USER_PUBLIC_HIDE_BIRTH', 0, $object)) { if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object)) { $object->socialnetworks = ''; } +if (getDolUserInt('USER_PUBLIC_HIDE_ADDRESS', 0, $object)) { + $object->address = ''; + $object->zip = ''; + $object->state = ''; + $object->country = ''; +} if (getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) { $company = null; } @@ -159,9 +165,6 @@ if (getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) { // Output vcard if ($mode == 'vcard') { - // Reset data no selected for public VCard - - // We create VCard $output = $v->buildVCardString($object, $company, $langs, $urllogofull); @@ -169,7 +172,7 @@ if ($mode == 'vcard') { $filenameurlencoded = dol_sanitizeFileName(urlencode($filename)); //$filename = dol_sanitizeFileName($filename); - top_httphead('text/x-vcard; name="'.$filename.'"'); + top_httphead('text/vcard; name="'.$filename.'"'); header("Content-Disposition: attachment; filename=\"".$filename."\""); header("Content-Length: ".dol_strlen($output)); @@ -387,11 +390,11 @@ if (!getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) { $urllogo = ''; $urllogofull = ''; if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany'.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&file='.urlencode('logos/thumbs/'.$logosmall); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany'.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&file='.urlencode('logos/thumbs/'.$logosmall); } elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany'.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&file='.urlencode('logos/'.$logo); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany'.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&file='.urlencode('logos/'.$logo); } // Output html code for logo if ($urllogo) { diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php index 7e13950747c..4685c6e9b16 100644 --- a/htdocs/user/virtualcard.php +++ b/htdocs/user/virtualcard.php @@ -75,6 +75,7 @@ if ($action == 'update') { $tmparray['USER_PUBLIC_HIDE_USER_MOBILE'] = (GETPOST('USER_PUBLIC_HIDE_USER_MOBILE') ? 1 : 0); $tmparray['USER_PUBLIC_HIDE_BIRTH'] = (GETPOST('USER_PUBLIC_HIDE_BIRTH') ? 1 : 0); $tmparray['USER_PUBLIC_HIDE_SOCIALNETWORKS'] = (GETPOST('USER_PUBLIC_HIDE_SOCIALNETWORKS') ? 1 : 0); + $tmparray['USER_PUBLIC_HIDE_ADDRESS'] = (GETPOST('USER_PUBLIC_HIDE_ADDRESS') ? 1 : 0); $tmparray['USER_PUBLIC_HIDE_COMPANY'] = (GETPOST('USER_PUBLIC_HIDE_COMPANY') ? 1 : 0); $tmparray['USER_PUBLIC_MORE'] = (GETPOST('USER_PUBLIC_MORE') ? GETPOST('USER_PUBLIC_MORE') : ''); @@ -242,6 +243,13 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { print $form->selectyesno("USER_PUBLIC_HIDE_SOCIALNETWORKS", (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object) : 0), 1); print "
'; + print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Address")); + print ''; + print $form->selectyesno("USER_PUBLIC_HIDE_ADDRESS", (getDolUserInt('USER_PUBLIC_HIDE_ADDRESS', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_ADDRESS', 0, $object) : 0), 1); + print "
'; print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("CompanySection")); From 35a7f3c0ff759ee89ac1f4fdc45db37a26bd209e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Jan 2023 01:28:02 +0100 Subject: [PATCH 172/218] Enhance vcard --- htdocs/core/class/vcard.class.php | 2 +- htdocs/public/users/view.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index 4404736f5e0..8d586648f80 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -449,7 +449,7 @@ class vCard $country = $object->country_code ? $object->country : ''; if ($object->address || $object->town || $object->state || $object->zip || $object->country) { - $this->setAddress("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK"); + $this->setAddress("", "", $object->address, $object->town, $object->state, $object->zip, $country, ""); //$this->setLabel("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=HOME"); } diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php index a5d3ac5b1e6..03d153dedd0 100644 --- a/htdocs/public/users/view.php +++ b/htdocs/public/users/view.php @@ -154,6 +154,7 @@ if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object)) { } if (getDolUserInt('USER_PUBLIC_HIDE_ADDRESS', 0, $object)) { $object->address = ''; + $object->town = ''; $object->zip = ''; $object->state = ''; $object->country = ''; From e41098c5273838f1ac3d7991eaec8a4c84061f52 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Jan 2023 01:31:23 +0100 Subject: [PATCH 173/218] Enhance vcard --- htdocs/core/class/vcard.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index 8d586648f80..7625954690b 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -31,7 +31,7 @@ */ function encode($string) { - return str_replace(";", "\;", (dol_quoted_printable_encode(utf8_decode($string)))); + return str_replace(";", "\;", (dol_quoted_printable_encode($string))); } @@ -488,7 +488,7 @@ class vCard $this->setPhoneNumber($company->fax, "TYPE=WORK,FAX"); } if ($company->address || $company->town || $company->state || $company->zip || $company->country) { - $this->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK"); + $this->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, ""); } if ($company->email && $company->email != $object->email) { From f8e5889ba7777d056a297c0c882a71c1841f5cd0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Jan 2023 01:42:11 +0100 Subject: [PATCH 174/218] Enhance vcard --- htdocs/core/class/vcard.class.php | 2 +- htdocs/langs/en_US/companies.lang | 3 ++- htdocs/user/virtualcard.php | 11 ++++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index 7625954690b..a5e1cbf6814 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -488,7 +488,7 @@ class vCard $this->setPhoneNumber($company->fax, "TYPE=WORK,FAX"); } if ($company->address || $company->town || $company->state || $company->zip || $company->country) { - $this->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, ""); + $this->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK"); } if ($company->email && $company->email != $object->email) { diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 7200ffb3d70..d31ecb077ff 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -499,4 +499,5 @@ OutOfEurope=Out of Europe (EEC) CurrentOutstandingBillLate=Current outstanding bill late BecarefullChangeThirdpartyBeforeAddProductToInvoice=Be carefull, depending on your product price settings, you should change thirdparty before adding product to POS. EmailAlreadyExistsPleaseRewriteYourCompanyName=email already exists please rewrite your company name -TwoRecordsOfCompanyName=more than one record exists for this company please contact us to complete your partnership request" \ No newline at end of file +TwoRecordsOfCompanyName=more than one record exists for this company please contact us to complete your partnership request" +CompanySection=Company section \ No newline at end of file diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php index 4685c6e9b16..04f8fb42030 100644 --- a/htdocs/user/virtualcard.php +++ b/htdocs/user/virtualcard.php @@ -210,21 +210,21 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { // Office phone print '
'; - print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("OfficePhone")); + print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("PhonePro")); print ''; print $form->selectyesno("USER_PUBLIC_HIDE_OFFICE_PHONE", (getDolUserInt('USER_PUBLIC_HIDE_OFFICE_PHONE', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_OFFICE_PHONE', 0, $object) : 0), 1); print "
'; - print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("OfficeFax")); + print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Fax")); print ''; print $form->selectyesno("USER_PUBLIC_HIDE_OFFICE_FAX", (getDolUserInt('USER_PUBLIC_HIDE_OFFICE_FAX', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_OFFICE_FAX', 0, $object) : 0), 1); print "
'; - print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("UserMobile")); + print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("PhoneMobile")); print ''; print $form->selectyesno("USER_PUBLIC_HIDE_USER_MOBILE", (getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object) : 0), 1); print "
'; - print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("SocialNetworks")); + print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("SocialNetworksInformation")); print ''; print $form->selectyesno("USER_PUBLIC_HIDE_SOCIALNETWORKS", (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object) : 0), 1); print "
'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('USER_PUBLIC_MORE', getDolUserString('USER_PUBLIC_MORE', '', $object), '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%'); + $extendededitor = 0; // We force no WYSIWYG editor + $doleditor = new DolEditor('USER_PUBLIC_MORE', getDolUserString('USER_PUBLIC_MORE', '', $object), '', 160, 'dolibarr_notes', '', false, false, $extendededitor, ROWS_5, '90%'); $doleditor->Create(); print "
'.$obj->qty.''.$obj->qty.'
'.$langs->trans("Label").'
'.$langs->trans("Bank").'
'.$langs->trans("Bank").'
'; + print '
'; + } + $usertmp->fetch($obj->id_user); + $expensereportstatic->fk_user_author = $usertmp->getNomUrl(1); - print '
'; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; + // Output Kanban + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if ($massactionbutton || $massaction) { + $selected = 0; + + print $expensereportstatic->getKanbanView(''); } - print ''; } - print ''; - print ''; - print ''; - // Warning late icon and note - print ''; } - if ($expensereportstatic->status == 5 && $expensereportstatic->hasDelay('topay')) { - print img_warning($langs->trans("Late")); - } - if (!empty($obj->note_private) || !empty($obj->note_public)) { - print ' '; - print ''.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').''; - print ''; - } - print ''; - print ''; - print '
'; - print $expensereportstatic->getNomUrl(1); - print ''; - if ($expensereportstatic->status == 2 && $expensereportstatic->hasDelay('toappove')) { - print img_warning($langs->trans("Late")); + if ($i == (min($num, $limit) - 1)) { + print ''; + print '
'; - $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($obj->ref); - $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; - print $formfile->getDocumentsLink($expensereportstatic->element, $filename, $filedir); - print '
'; - print '
'; - $usertmp->id = $obj->id_user; - $usertmp->lastname = $obj->lastname; - $usertmp->firstname = $obj->firstname; - $usertmp->login = $obj->login; - $usertmp->statut = $obj->statut; - $usertmp->photo = $obj->photo; - $usertmp->email = $obj->email; - print $usertmp->getNomUrl(-1); - print ''.($obj->date_debut > 0 ? dol_print_date($db->jdate($obj->date_debut), 'day') : '').''.($obj->date_fin > 0 ? dol_print_date($db->jdate($obj->date_fin), 'day') : '').''.($obj->date_valid > 0 ? dol_print_date($db->jdate($obj->date_valid), 'day') : '').''.($obj->date_approve > 0 ? dol_print_date($db->jdate($obj->date_approve), 'day') : '').''.price($obj->total_ht)."'.price($obj->total_tva)."'.price($obj->total_ttc)."'; - print dol_print_date($db->jdate($obj->date_create), 'dayhour'); - print ''; - print dol_print_date($db->jdate($obj->date_modif), 'dayhour'); - print ''.$expensereportstatic->getLibStatut(5).''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; + } else { + print '
'; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; } - print ''; + print ''; + print ''; + print ''; + // Warning late icon and note + print ''; + print ''; + print '
'; + print $expensereportstatic->getNomUrl(1); + print ''; + if ($expensereportstatic->status == 2 && $expensereportstatic->hasDelay('toappove')) { + print img_warning($langs->trans("Late")); + } + if ($expensereportstatic->status == 5 && $expensereportstatic->hasDelay('topay')) { + print img_warning($langs->trans("Late")); + } + if (!empty($obj->note_private) || !empty($obj->note_public)) { + print ' '; + print ''.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').''; + print ''; + } + print ''; + $filename = dol_sanitizeFileName($obj->ref); + $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($obj->ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; + print $formfile->getDocumentsLink($expensereportstatic->element, $filename, $filedir); + print '
'; + print '
'; + $usertmp->id = $obj->id_user; + $usertmp->lastname = $obj->lastname; + $usertmp->firstname = $obj->firstname; + $usertmp->login = $obj->login; + $usertmp->statut = $obj->statut; + $usertmp->photo = $obj->photo; + $usertmp->email = $obj->email; + print $usertmp->getNomUrl(-1); + print ''.($obj->date_debut > 0 ? dol_print_date($db->jdate($obj->date_debut), 'day') : '').''.($obj->date_fin > 0 ? dol_print_date($db->jdate($obj->date_fin), 'day') : '').''.($obj->date_valid > 0 ? dol_print_date($db->jdate($obj->date_valid), 'day') : '').''.($obj->date_approve > 0 ? dol_print_date($db->jdate($obj->date_approve), 'day') : '').''.price($obj->total_ht)."'.price($obj->total_tva)."'.price($obj->total_ttc)."'; + print dol_print_date($db->jdate($obj->date_create), 'dayhour'); + print ''; + print dol_print_date($db->jdate($obj->date_modif), 'dayhour'); + print ''.$expensereportstatic->getLibStatut(5).''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print '