From 3a8fbd3aa8dfbb8847abbe5e162a29ddbcb633ab Mon Sep 17 00:00:00 2001 From: Guenter Lukas Date: Mon, 6 Feb 2023 10:32:54 +0100 Subject: [PATCH 01/16] update --- htdocs/comm/action/card.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 545088e47e9..1412890b3d8 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -142,9 +142,6 @@ if (!empty($conf->global->AGENDA_REMINDER_EMAIL)) { $TDurationTypes = array('y'=>$langs->trans('Years'), 'm'=>$langs->trans('Month'), 'w'=>$langs->trans('Weeks'), 'd'=>$langs->trans('Days'), 'h'=>$langs->trans('Hours'), 'i'=>$langs->trans('Minutes')); $result = restrictedArea($user, 'agenda', $object->id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id'); -if ($user->socid && $socid) { - $result = restrictedArea($user, 'societe', $socid); -} /* From 6163f84d258df4cf87e01cebdf7b11a549bbe9b1 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Wed, 15 Feb 2023 22:10:03 +0100 Subject: [PATCH 02/16] move log after variable updates to get good informations in logs --- htdocs/core/class/CMailFile.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 94fb05d5346..47f8fd900cb 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -184,9 +184,6 @@ class CMailFile // On defini alternative_boundary $this->alternative_boundary = 'mul_'.dol_hash(uniqid("dolibarr3"), 3); // Force md5 hash (does not contains special chars) - dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); - dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG); - if (empty($subject)) { dol_syslog("CMailFile::CMailfile: Try to send an email with empty subject"); $this->error = 'ErrorSubjectIsRequired'; @@ -314,6 +311,9 @@ class CMailFile } } + dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); + dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG); + // We set all data according to choosed sending method. // We also set a value for ->msgid if ($this->sendmode == 'mail') { From 3a58e025badea87a7758d149d7d435b017032fc8 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Thu, 16 Feb 2023 21:44:38 +0100 Subject: [PATCH 03/16] better logs --- htdocs/core/class/CMailFile.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 47f8fd900cb..0269b25fd6c 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -142,6 +142,9 @@ class CMailFile { global $conf, $dolibarr_main_data_root, $user; + dol_syslog("CMailFile::CMailfile: charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); + dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG); + // Clean values of $mimefilename_list if (is_array($mimefilename_list)) { foreach ($mimefilename_list as $key => $val) { @@ -311,8 +314,7 @@ class CMailFile } } - dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); - dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG); + dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." addr_bcc=$addr_bcc, replyto=$replyto", LOG_DEBUG); // We set all data according to choosed sending method. // We also set a value for ->msgid From 86e2f46fe7a4cebc24de3039c23e4e07891ac82b Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Thu, 16 Feb 2023 21:46:27 +0100 Subject: [PATCH 04/16] addr_bcc could be set --- htdocs/core/class/CMailFile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 0269b25fd6c..90c16dc589f 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -142,7 +142,7 @@ class CMailFile { global $conf, $dolibarr_main_data_root, $user; - dol_syslog("CMailFile::CMailfile: charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); + dol_syslog("CMailFile::CMailfile: charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG); // Clean values of $mimefilename_list From 36e73280bf50d85e5503131d5fc3ba81bb0f91aa Mon Sep 17 00:00:00 2001 From: Guenter Lukas Date: Mon, 20 Feb 2023 12:51:15 +0100 Subject: [PATCH 05/16] FIX:#23966 Error "Param dbt_keyfield is required but not defined" --- htdocs/core/lib/security.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 798ba265643..264ed290f58 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -682,7 +682,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl // Array to define rules of checks to do $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment'); // Test on entity only (Objects with no link to company) $checksoc = array('societe'); // Test for societe object - $checkother = array('contact', 'agenda'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...). + $checkother = array('contact', 'agenda', 'contrat'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...). $checkproject = array('projet', 'project'); // Test for project object $checktask = array('projet_task'); // Test for task object $checkhierarchy = array('expensereport', 'holiday'); From 353d451e5ac5d10a63912758b63c5bebea20c8d5 Mon Sep 17 00:00:00 2001 From: noec764 <58433943+noec764@users.noreply.github.com> Date: Fri, 10 Mar 2023 15:48:26 +0100 Subject: [PATCH 06/16] Correct dolForgeCriteriaCallback --- 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 c275e4fd310..06990a3dbd4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10757,7 +10757,7 @@ function dolForgeCriteriaCallback($matches) $operand = preg_replace('/[^a-z0-9\._]/i', '', trim($tmp[0])); - $operator = strtoupper(preg_replace('/[^a-z<>=]/i', '', trim($tmp[1]))); + $operator = strtoupper(preg_replace('/[^a-z<>!=]/i', '', trim($tmp[1]))); if ($operator == 'NOTLIKE') { $operator = 'NOT LIKE'; } From d6e0d745a8369816fa93fe1ecbd8bd9ecf59e877 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Mar 2023 22:11:58 +0100 Subject: [PATCH 07/16] FIX token error when closing ticket from public interface --- htdocs/public/ticket/view.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index edf2504fb0c..9f2eee2a6ea 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -376,7 +376,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a // Close ticket if ($object->dao->fk_statut >= Ticket::STATUS_NOT_READ && $object->dao->fk_statut < Ticket::STATUS_CLOSED) { - print ''; + print ''; } } From 800c2b477979999533603ab80110d0b2a07aabad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Mar 2023 09:33:31 +0100 Subject: [PATCH 08/16] Look and feel v18 --- htdocs/holiday/class/holiday.class.php | 6 +- htdocs/holiday/list.php | 1231 ++++++++++++------------ 2 files changed, 646 insertions(+), 591 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 341b0c700e1..93e443bad69 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1497,9 +1497,11 @@ class Holiday extends CommonObject } $out .= ''."\n"; - $out .= ajax_combobox($htmlname); - print $out; + $showempty= 0; + $out .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($showempty < 0 ? (string) $showempty : '-1'), $morecss); + + return $out; } /** diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 3f8f9d69131..ed5c222f7c8 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -143,7 +143,13 @@ if ($user->socid > 0) { // Protection if external user accessforbidden(); } -if (empty($conf->holiday->enabled)) accessforbidden('Module not enabled'); +$permissiontoread = $user->hasRight('holiday', 'read'); +$permissiontodelete = $user->hasRight('holiday', 'delete'); +$permissiontoapprove = $user->hasRight('holiday', 'approve'); + +if (!ismodEnabled('holiday')) { + accessforbidden('Module holiday not enabled'); +} $result = restrictedArea($user, 'holiday', '', ''); // If we are on the view of a specific user @@ -152,10 +158,10 @@ if ($id > 0) { if ($id == $user->id) { $canread = 1; } - if (!empty($user->rights->holiday->readall)) { + if ($user->hasRight('holiday', 'readall')) { $canread = 1; } - if (!empty($user->rights->holiday->read) && in_array($id, $childids)) { + if ($user->hasRight('holiday', 'read') && in_array($id, $childids)) { $canread = 1; } if (!$canread) { @@ -165,13 +171,13 @@ if ($id > 0) { - /* * Actions */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -211,9 +217,6 @@ if (empty($reshook)) { // Mass actions $objectclass = 'Holiday'; $objectlabel = 'Holiday'; - $permissiontoread = $user->hasRight('holiday', 'read'); - $permissiontodelete = $user->hasRight('holiday', 'delete'); - $permissiontoapprove = $user->hasRight('holiday', 'approve'); $uploaddir = $conf->holiday->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -236,6 +239,8 @@ $holidaystatic = new Holiday($db); $result = $object->updateBalance(); $title = $langs->trans('CPTitreMenu'); +$help_url = ''; + llxHeader('', $title); $max_year = 5; @@ -304,7 +309,8 @@ 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 -$sql .= $hookmanager->resPrint; +$sql .= preg_replace('/^,/', '', $hookmanager->resPrint); +$sql = preg_replace('/,\s*$/', '', $sql); $sqlfields = $sql; // $sql fields to remove for count total @@ -357,7 +363,7 @@ if ($id > 0) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; // Count total nb of records @@ -374,7 +380,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { dol_print_error($db); } - if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } @@ -389,656 +395,703 @@ if ($limit) { //print $sql; $resql = $db->query($sql); -if ($resql) { - $num = $db->num_rows($resql); +if (!$resql) { + dol_print_error($db); + exit; +} - $arrayofselected = is_array($toselect) ? $toselect : array(); +$num = $db->num_rows($resql); - $param = ''; - if (!empty($mode)) { - $param .= '&mode='.urlencode($mode); - } - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { - $param .= '&contextpage='.urlencode($contextpage); - } - if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); - } - if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); - } - if ($search_ref) { - $param .= '&search_ref='.urlencode($search_ref); - } - if ($search_day_create) { - $param .= '&search_day_create='.urlencode($search_day_create); - } - if ($search_month_create) { - $param .= '&search_month_create='.urlencode($search_month_create); - } - if ($search_year_create) { - $param .= '&search_year_create='.urlencode($search_year_create); - } - if ($search_day_start) { - $param .= '&search_day_start='.urlencode($search_day_start); - } - if ($search_month_start) { - $param .= '&search_month_start='.urlencode($search_month_start); - } - if ($search_year_start) { - $param .= '&search_year_start='.urlencode($search_year_start); - } - if ($search_day_end) { - $param .= '&search_day_end='.urlencode($search_day_end); - } - if ($search_month_end) { - $param .= '&search_month_end='.urlencode($search_month_end); - } - if ($search_year_end) { - $param .= '&search_year_end='.urlencode($search_year_end); - } - if ($search_employee > 0) { - $param .= '&search_employee='.urlencode($search_employee); - } - if ($search_valideur > 0) { - $param .= '&search_valideur='.urlencode($search_valideur); - } - if ($search_type > 0) { - $param .= '&search_type='.urlencode($search_type); - } - if ($search_status > 0) { - $param .= '&search_status='.urlencode($search_status); - } - // Add $param from extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; +$arrayofselected = is_array($toselect) ? $toselect : array(); - // List of mass actions available - $arrayofmassactions = array( - //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), - //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), - //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), - ); - if (!empty($user->rights->holiday->delete)) { - $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); - } - if (!empty($user->rights->holiday->approve)) { - $arrayofmassactions['preapproveleave'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Approve"); - } - if (in_array($massaction, array('presend', 'predelete'))) { - $arrayofmassactions = array(); - } - $massactionbutton = $form->selectMassAction('', $arrayofmassactions); +$param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { + $param .= '&contextpage='.urlencode($contextpage); +} +if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.((int) $limit); +} +if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); +} +if ($search_ref) { + $param .= '&search_ref='.urlencode($search_ref); +} +if ($search_day_create) { + $param .= '&search_day_create='.urlencode($search_day_create); +} +if ($search_month_create) { + $param .= '&search_month_create='.urlencode($search_month_create); +} +if ($search_year_create) { + $param .= '&search_year_create='.urlencode($search_year_create); +} +if ($search_day_start) { + $param .= '&search_day_start='.urlencode($search_day_start); +} +if ($search_month_start) { + $param .= '&search_month_start='.urlencode($search_month_start); +} +if ($search_year_start) { + $param .= '&search_year_start='.urlencode($search_year_start); +} +if ($search_day_end) { + $param .= '&search_day_end='.urlencode($search_day_end); +} +if ($search_month_end) { + $param .= '&search_month_end='.urlencode($search_month_end); +} +if ($search_year_end) { + $param .= '&search_year_end='.urlencode($search_year_end); +} +if ($search_employee > 0) { + $param .= '&search_employee='.urlencode($search_employee); +} +if ($search_valideur > 0) { + $param .= '&search_valideur='.urlencode($search_valideur); +} +if ($search_type > 0) { + $param .= '&search_type='.urlencode($search_type); +} +if ($search_status > 0) { + $param .= '&search_status='.urlencode($search_status); +} +// Add $param from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; - // Lines of title fields - print '
'."\n"; - if ($optioncss != '') { - print ''; - } - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; +// List of mass actions available +$arrayofmassactions = array( + //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), + //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), + //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), +); +if (!empty($permissiontodelete)) { + $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); +} +if (!empty($permissiontoapprove)) { + $arrayofmassactions['preapproveleave'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Approve"); +} +if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { + $arrayofmassactions = array(); +} +$massactionbutton = $form->selectMassAction('', $arrayofmassactions); - if ($id > 0) { - print ''; +print ''."\n"; +if ($optioncss != '') { + print ''; +} +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +if ($id > 0) { + print ''; +} + +if ($id > 0) { // For user tab + $title = $langs->trans("User"); + $linkback = ''.$langs->trans("BackToList").''; + $head = user_prepare_head($fuser); + + print dol_get_fiche_head($head, 'paidholidays', $title, -1, 'user'); + + dol_banner_tab($fuser, 'id', $linkback, $user->rights->user->user->lire || $user->admin); + + if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) { + print '
'; + + print '
'; + + showMyBalance($object, $user_id); } - if ($id > 0) { // For user tab - $title = $langs->trans("User"); - $linkback = ''.$langs->trans("BackToList").''; - $head = user_prepare_head($fuser); + print dol_get_fiche_end(); - print dol_get_fiche_head($head, 'paidholidays', $title, -1, 'user'); + // Buttons for actions - dol_banner_tab($fuser, 'id', $linkback, $user->rights->user->user->lire || $user->admin); + print '
'; - if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) { - print '
'; - - print '
'; - - showMyBalance($object, $user_id); - } - - print dol_get_fiche_end(); - - // Buttons for actions - - print '
'; - - $cancreate = 0; - if (!empty($user->rights->holiday->writeall)) { - $cancreate = 1; - } - if (!empty($user->rights->holiday->write) && in_array($user_id, $childids)) { - $cancreate = 1; - } - - if ($cancreate) { - print ''.$langs->trans("AddCP").''; - } - - print '
'; - } else { - $title = $langs->trans("ListeCP"); - - - $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); + $cancreate = 0; + if (!empty($user->rights->holiday->writeall)) { + $cancreate = 1; + } + if (!empty($user->rights->holiday->write) && in_array($user_id, $childids)) { + $cancreate = 1; } - $topicmail = "Information"; - $modelmail = "leaverequest"; - $objecttmp = new Holiday($db); - $trackid = 'leav'.$object->id; - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; - - if ($sall) { - foreach ($fieldstosearchall as $key => $val) { - $fieldstosearchall[$key] = $langs->trans($val); - } - print '
'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'
'; + if ($cancreate) { + print ''.$langs->trans("AddCP").''; } - $moreforfilter = ''; + print '
'; +} else { + $title = $langs->trans("ListeCP"); - $parameters = array(); - $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook - if (empty($reshook)) { - $moreforfilter .= $hookmanager->resPrint; - } else { - $moreforfilter = $hookmanager->resPrint; + + $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 .= dolGetButtonTitleSeparator(); + $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); +} + +$topicmail = "Information"; +$modelmail = "leaverequest"; +$objecttmp = new Holiday($db); +$trackid = 'leav'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + +if ($sall) { + $setupstring = ''; + foreach ($fieldstosearchall as $key => $val) { + $fieldstosearchall[$key] = $langs->trans($val); + $setupstring .= $key."=".$val.";"; + } + print ''."\n"; + print '
'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'
'; +} + +$moreforfilter = ''; + +$parameters = array(); +$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 { + $moreforfilter = $hookmanager->resPrint; +} + +if (!empty($moreforfilter)) { + print '
'; + print $moreforfilter; + $parameters = array('type'=>$type); + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print '
'; +} + +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields +$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); + +$include = ''; +if (empty($user->rights->holiday->readall)) { + $include = 'hierarchyme'; // Can see only its hierarchyl +} + +print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table +print ''."\n"; + +// Fields title search +// -------------------------------------------------------------------- +print ''; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} +if (!empty($arrayfields['cp.ref']['checked'])) { + print ''; +} + +if (!empty($arrayfields['cp.fk_user']['checked'])) { + $morefilter = ''; + if (!empty($conf->global->HOLIDAY_HIDE_FOR_NON_SALARIES)) { + $morefilter = 'AND employee = 1'; } - if (!empty($moreforfilter)) { - print '
'; - print $moreforfilter; - print '
'; + // User + $disabled = 0; + // If into the tab holiday of a user ($id is set in such a case) + if ($id && !GETPOSTISSET('search_employee')) { + $search_employee = $id; + $disabled = 1; } - $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields - $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); - - - $include = ''; - if (empty($user->rights->holiday->readall)) { - $include = 'hierarchyme'; // Can see only its hierarchyl - } - - print '
'; - print '
'; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; + print ''; + print '
'."\n"; - - - // Filters - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - if (!empty($arrayfields['cp.ref']['checked'])) { - print ''; - } - - if (!empty($arrayfields['cp.fk_user']['checked'])) { - $morefilter = ''; - if (!empty($conf->global->HOLIDAY_HIDE_FOR_NON_SALARIES)) { - $morefilter = 'AND employee = 1'; - } - - // User - $disabled = 0; - // If into the tab holiday of a user ($id is set in such a case) - if ($id && !GETPOSTISSET('search_employee')) { - $search_employee = $id; - $disabled = 1; - } + print ''; +} +// Approver +if (!empty($arrayfields['cp.fk_validator']['checked'])) { + if ($user->hasRight('holiday', 'readall')) { print ''; - } - - // Approver - if (!empty($arrayfields['cp.fk_validator']['checked'])) { - if ($user->hasRight('holiday', 'readall')) { - print ''; - } else { - print ''; - } - } - - // Type - if (!empty($arrayfields['cp.fk_type']['checked'])) { - print ''; - } - - // Duration - if (!empty($arrayfields['duration']['checked'])) { + } else { print ''; } +} - // Start date - if (!empty($arrayfields['cp.date_debut']['checked'])) { - print ''; +// Type +if (!empty($arrayfields['cp.fk_type']['checked'])) { + print ''; +} - // End date - if (!empty($arrayfields['cp.date_fin']['checked'])) { - print ''; - } +// Duration +if (!empty($arrayfields['duration']['checked'])) { + print ''; +} - // Date validation - if (!empty($arrayfields['cp.date_valid']['checked'])) { - print ''; - } +// Start date +if (!empty($arrayfields['cp.date_debut']['checked'])) { + print ''; +} - // Date appoval - if (!empty($arrayfields['cp.date_approval']['checked'])) { - print ''; - } +// End date +if (!empty($arrayfields['cp.date_fin']['checked'])) { + print ''; +} - // Extra fields - 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 - print $hookmanager->resPrint; +// Date validation +if (!empty($arrayfields['cp.date_valid']['checked'])) { + print ''; +} - // Create date - if (!empty($arrayfields['cp.date_create']['checked'])) { - print ''; - } +// Date appoval +if (!empty($arrayfields['cp.date_approval']['checked'])) { + print ''; +} - // Create date - if (!empty($arrayfields['cp.tms']['checked'])) { - print ''; - } +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; - // Status - if (!empty($arrayfields['cp.statut']['checked'])) { - print ''; - } +// Fields from hook +$parameters = array('arrayfields'=>$arrayfields); +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } +// Create date +if (!empty($arrayfields['cp.date_create']['checked'])) { + print ''; +} - print "\n"; +// Create date +if (!empty($arrayfields['cp.tms']['checked'])) { + print ''; +} - print ''; - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); - } - if (!empty($arrayfields['cp.ref']['checked'])) { - print_liste_field_titre($arrayfields['cp.ref']['label'], $_SERVER["PHP_SELF"], "cp.ref", "", $param, '', $sortfield, $sortorder); - } - if (!empty($arrayfields['cp.fk_user']['checked'])) { - print_liste_field_titre($arrayfields['cp.fk_user']['label'], $_SERVER["PHP_SELF"], "cp.fk_user", "", $param, '', $sortfield, $sortorder); - } - if (!empty($arrayfields['cp.fk_validator']['checked'])) { - print_liste_field_titre($arrayfields['cp.fk_validator']['label'], $_SERVER["PHP_SELF"], "cp.fk_validator", "", $param, '', $sortfield, $sortorder); - } - if (!empty($arrayfields['cp.fk_type']['checked'])) { - print_liste_field_titre($arrayfields['cp.fk_type']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); - } - if (!empty($arrayfields['duration']['checked'])) { - print_liste_field_titre($arrayfields['duration']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right maxwidth100'); - } - if (!empty($arrayfields['cp.date_debut']['checked'])) { - print_liste_field_titre($arrayfields['cp.date_debut']['label'], $_SERVER["PHP_SELF"], "cp.date_debut", "", $param, '', $sortfield, $sortorder, 'center '); - } - if (!empty($arrayfields['cp.date_fin']['checked'])) { - print_liste_field_titre($arrayfields['cp.date_fin']['label'], $_SERVER["PHP_SELF"], "cp.date_fin", "", $param, '', $sortfield, $sortorder, 'center '); - } - if (!empty($arrayfields['cp.date_valid']['checked'])) { - print_liste_field_titre($arrayfields['cp.date_valid']['label'], $_SERVER["PHP_SELF"], "cp.date_valid", "", $param, '', $sortfield, $sortorder, 'center '); - } - if (!empty($arrayfields['cp.date_approval']['checked'])) { - print_liste_field_titre($arrayfields['cp.date_approval']['label'], $_SERVER["PHP_SELF"], "cp.date_approval", "", $param, '', $sortfield, $sortorder, 'center '); - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; - // Hook fields - $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['cp.date_create']['checked'])) { - print_liste_field_titre($arrayfields['cp.date_create']['label'], $_SERVER["PHP_SELF"], "cp.date_create", "", $param, '', $sortfield, $sortorder, 'center '); - } - if (!empty($arrayfields['cp.tms']['checked'])) { - print_liste_field_titre($arrayfields['cp.tms']['label'], $_SERVER["PHP_SELF"], "cp.tms", "", $param, '', $sortfield, $sortorder, 'center '); - } - if (!empty($arrayfields['cp.statut']['checked'])) { - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "cp.statut", "", $param, '', $sortfield, $sortorder, 'right '); - } - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); - } - print "\n"; +// Status +if (!empty($arrayfields['cp.statut']['checked'])) { + print ''; +} - $listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->trans("Afternoon")); +// Action column +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} + +print ''."\n"; + +$totalarray = array(); +$totalarray['nbfield'] = 0; + +// Fields title label +// -------------------------------------------------------------------- +print ''; +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.ref']['checked'])) { + print_liste_field_titre($arrayfields['cp.ref']['label'], $_SERVER["PHP_SELF"], "cp.ref", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.fk_user']['checked'])) { + print_liste_field_titre($arrayfields['cp.fk_user']['label'], $_SERVER["PHP_SELF"], "cp.fk_user", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.fk_validator']['checked'])) { + print_liste_field_titre($arrayfields['cp.fk_validator']['label'], $_SERVER["PHP_SELF"], "cp.fk_validator", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.fk_type']['checked'])) { + print_liste_field_titre($arrayfields['cp.fk_type']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['duration']['checked'])) { + print_liste_field_titre($arrayfields['duration']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right maxwidth100'); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.date_debut']['checked'])) { + print_liste_field_titre($arrayfields['cp.date_debut']['label'], $_SERVER["PHP_SELF"], "cp.date_debut", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.date_fin']['checked'])) { + print_liste_field_titre($arrayfields['cp.date_fin']['label'], $_SERVER["PHP_SELF"], "cp.date_fin", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.date_valid']['checked'])) { + print_liste_field_titre($arrayfields['cp.date_valid']['label'], $_SERVER["PHP_SELF"], "cp.date_valid", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.date_approval']['checked'])) { + print_liste_field_titre($arrayfields['cp.date_approval']['label'], $_SERVER["PHP_SELF"], "cp.date_approval", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; +// Hook fields +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +if (!empty($arrayfields['cp.date_create']['checked'])) { + print_liste_field_titre($arrayfields['cp.date_create']['label'], $_SERVER["PHP_SELF"], "cp.date_create", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.tms']['checked'])) { + print_liste_field_titre($arrayfields['cp.tms']['label'], $_SERVER["PHP_SELF"], "cp.tms", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.statut']['checked'])) { + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "cp.statut", "", $param, '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; +} +// Action column +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; +} +print ''."\n"; + +$listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->trans("Afternoon")); - // If we ask a dedicated card and not allow to see it, we force on user. - if ($id && empty($user->rights->holiday->readall) && !in_array($id, $childids)) { - $langs->load("errors"); - print ''; - $result = 0; - } elseif ($num > 0 && !empty($mysoc->country_id)) { - // Lines - $userstatic = new User($db); - $approbatorstatic = new User($db); +// Loop on record +// -------------------------------------------------------------------- - $typeleaves = $object->getTypes(1, -1); +// If we ask a dedicated card and not allow to see it, we force on user. +if ($id && empty($user->rights->holiday->readall) && !in_array($id, $childids)) { + $langs->load("errors"); + print ''; + $result = 0; +} elseif ($num > 0 && !empty($mysoc->country_id)) { + // Lines + $userstatic = new User($db); + $approbatorstatic = new User($db); - $i = 0; - $totalarray = array(); - $totalarray['nbfield'] = 0; - $totalduration = 0; - $imaxinloop = ($limit ? min($num, $limit) : $num); - while ($i < $imaxinloop) { - $obj = $db->fetch_object($resql); + $typeleaves = $object->getTypes(1, -1); - // Leave request - $holidaystatic->id = $obj->rowid; - $holidaystatic->ref = ($obj->ref ? $obj->ref : $obj->rowid); - $holidaystatic->statut = $obj->status; - $holidaystatic->date_debut = $obj->date_debut; - $holidaystatic->date_fin = $obj->date_fin; + $i = 0; + $savnbfield = $totalarray['nbfield']; + $totalarray = array(); + $totalarray['nbfield'] = 0; + $totalduration = 0; + $imaxinloop = ($limit ? min($num, $limit) : $num); + while ($i < $imaxinloop) { + $obj = $db->fetch_object($resql); + if (empty($obj)) { + break; // Should not happen + } - // User - $userstatic->id = $obj->fk_user; - $userstatic->lastname = $obj->user_lastname; - $userstatic->firstname = $obj->user_firstname; - $userstatic->admin = $obj->user_admin; - $userstatic->email = $obj->user_email; - $userstatic->login = $obj->user_login; - $userstatic->statut = $obj->user_status; - $userstatic->photo = $obj->user_photo; + // Leave request + $holidaystatic->id = $obj->rowid; + $holidaystatic->ref = ($obj->ref ? $obj->ref : $obj->rowid); + $holidaystatic->statut = $obj->status; + $holidaystatic->date_debut = $obj->date_debut; + $holidaystatic->date_fin = $obj->date_fin; - // Validator - $approbatorstatic->id = $obj->fk_validator; - $approbatorstatic->lastname = $obj->validator_lastname; - $approbatorstatic->firstname = $obj->validator_firstname; - $approbatorstatic->admin = $obj->validator_admin; - $approbatorstatic->email = $obj->validator_email; - $approbatorstatic->login = $obj->validator_login; - $approbatorstatic->statut = $obj->validator_status; - $approbatorstatic->photo = $obj->validator_photo; + // User + $userstatic->id = $obj->fk_user; + $userstatic->lastname = $obj->user_lastname; + $userstatic->firstname = $obj->user_firstname; + $userstatic->admin = $obj->user_admin; + $userstatic->email = $obj->user_email; + $userstatic->login = $obj->user_login; + $userstatic->statut = $obj->user_status; + $userstatic->photo = $obj->user_photo; - $date = $obj->date_create; - $date_modif = $obj->date_update; + // Validator + $approbatorstatic->id = $obj->fk_validator; + $approbatorstatic->lastname = $obj->validator_lastname; + $approbatorstatic->firstname = $obj->validator_firstname; + $approbatorstatic->admin = $obj->validator_admin; + $approbatorstatic->email = $obj->validator_email; + $approbatorstatic->login = $obj->validator_login; + $approbatorstatic->statut = $obj->validator_status; + $approbatorstatic->photo = $obj->validator_photo; - $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning'; - $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon'; + $date = $obj->date_create; + $date_modif = $obj->date_update; - $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; + $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning'; + $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon'; - if ($mode == 'kanban') { - if ($i == 0) { - print ''; + } + } else { + // Show here line of result + $j = 0; + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; - } - } else { - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - if (!empty($arrayfields['cp.ref']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.fk_user']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.fk_validator']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.fk_type']['checked'])) { - if (empty($typeleaves[$obj->fk_type])) { - $labeltypeleavetoshow = $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type); - } else { - $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']); - } - - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['duration']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.date_debut']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.date_fin']['checked'])) { - 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 ''; - if (!$i) $totalarray['nbfield']++; - } - // Date approval - if (!empty($arrayfields['cp.date_approval']['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['cp.date_create']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.tms']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.statut']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + print ''; } + print ''; if (!$i) { $totalarray['nbfield']++; } - - print ''."\n"; } - $i++; - } - - // Add a line for total if there is a total to show - if (!empty($arrayfields['duration']['checked'])) { - print ''; - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - foreach ($arrayfields as $key => $val) { - if (!empty($val['checked'])) { - if ($key == 'duration') { - print ''; - } else { - print ''; - } + if (!empty($arrayfields['cp.ref']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; } } - // status - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + if (!empty($arrayfields['cp.fk_user']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - print ''; + if (!empty($arrayfields['cp.fk_validator']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.fk_type']['checked'])) { + if (empty($typeleaves[$obj->fk_type])) { + $labeltypeleavetoshow = $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type); + } else { + $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']); + } + + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['duration']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.date_debut']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.date_fin']['checked'])) { + 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 ''; + if (!$i) $totalarray['nbfield']++; + } + // Date approval + if (!empty($arrayfields['cp.date_approval']['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, 'object'=>$object, '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['cp.date_create']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.tms']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.statut']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + print ''."\n"; } + $i++; } - // Si il n'y a pas d'enregistrement suite à une recherche - if ($num == 0) { - $colspan = 1; + // Add a line for total if there is a total to show + if (!empty($arrayfields['duration']['checked'])) { + print ''; + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) { - $colspan++; + if ($key == 'duration') { + print ''; + } else { + print ''; + } } } - print ''; + // status + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + print ''; } - - print '
'; - $searchpicto = $form->showFilterButtons('left'); - print $searchpicto; - print ''; - print ''; - print ''; + print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, $include, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125'); + print ''; - print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, $include, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125'); - print ''; - $validator = new UserGroup($db); - $excludefilter = $user->admin ? '' : 'u.rowid <> '.$user->id; - $valideurobjects = $validator->listUsersForGroup($excludefilter, 1); - $valideurarray = array(); - foreach ($valideurobjects as $val) { - $valideurarray[$val] = $val; - } - print $form->select_dolusers($search_valideur, "search_valideur", 1, "", 0, $valideurarray, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125'); - print ' '; - if (empty($mysoc->country_id)) { - setEventMessages(null, array($langs->trans("ErrorSetACountryFirst"), $langs->trans("CompanyFoundation")), 'errors'); - } else { - $typeleaves = $holidaystatic->getTypes(1, -1); - $arraytypeleaves = array(); - foreach ($typeleaves as $key => $val) { - $labeltoshow = ($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']); - //$labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':''); - $arraytypeleaves[$val['rowid']] = $labeltoshow; - } - print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1); + $validator = new UserGroup($db); + $excludefilter = $user->admin ? '' : 'u.rowid <> '.$user->id; + $valideurobjects = $validator->listUsersForGroup($excludefilter, 1); + $valideurarray = array(); + foreach ($valideurobjects as $val) { + $valideurarray[$val] = $val; } + print $form->select_dolusers($search_valideur, "search_valideur", 1, "", 0, $valideurarray, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125'); print ' '; - print ''; - print $formother->selectyear($search_year_start, 'search_year_start', 1, $min_year, $max_year); - print ''; + if (empty($mysoc->country_id)) { + setEventMessages(null, array($langs->trans("ErrorSetACountryFirst"), $langs->trans("CompanyFoundation")), 'errors'); + } else { + $typeleaves = $holidaystatic->getTypes(1, -1); + $arraytypeleaves = array(); + foreach ($typeleaves as $key => $val) { + $labeltoshow = ($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']); + //$labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':''); + $arraytypeleaves[$val['rowid']] = $labeltoshow; + } + print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1); } + print ''; - print ''; - print $formother->selectyear($search_year_end, 'search_year_end', 1, $min_year, $max_year); - print ' '; - print ''; + print ''; + print $formother->selectyear($search_year_start, 'search_year_start', 1, $min_year, $max_year); + print ''; - print ''; + print ''; + print $formother->selectyear($search_year_end, 'search_year_end', 1, $min_year, $max_year); + print ''; + print ''; - print ''; - print $formother->selectyear($search_year_create, 'search_year_create', 1, $min_year, 0); - print ''; + print ''; - print ''; - print $formother->selectyear($search_year_update, 'search_year_update', 1, $min_year, 0); - print ''; - $object->selectStatutCP($search_status, 'search_status', 'minwidth125'); - print ''; - $searchpicto = $form->showFilterButtons(); - print $searchpicto; - print ''; + print ''; + print $formother->selectyear($search_year_create, 'search_year_create', 1, $min_year, 0); + print '
'; + print ''; + print $formother->selectyear($search_year_update, 'search_year_update', 1, $min_year, 0); + print '
'; + print $object->selectStatutCP($search_status, 'search_status', 'search_status width100 onrightofpage'); + print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print '
'.$langs->trans("NotEnoughPermissions").'
'.$langs->trans("NotEnoughPermissions").'
'; - 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; + + if ($mode == 'kanban') { + if ($i == 0) { + print '
'; + print '
'; + } + + $holidaystatic->fk_type = $typeleaves[$obj->fk_type]['rowid']; + + // Output Kanban + if ($massactionbutton || $massaction) { + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + if (empty($typeleaves[$obj->fk_type])) { + $labeltypeleavetoshow = $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type); + } else { + $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']); } - $holidaystatic->fk_type = $typeleaves[$obj->fk_type]['rowid']; - - // Output Kanban - if ($massactionbutton || $massaction) { + $arraydata = array('user'=>$userstatic, 'labeltype'=>$labeltypeleavetoshow); + } + print $holidaystatic->getKanbanView('', $arraydata); + if ($i == ($imaxinloop - 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)) { + if (in_array($obj->rowid, $arrayofselected)) { $selected = 1; } - if (empty($typeleaves[$obj->fk_type])) { - $labeltypeleavetoshow = $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type); - } else { - $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']); - } - - $arraydata = array('user'=>$userstatic, 'labeltype'=>$labeltypeleavetoshow); - print $holidaystatic->getKanbanView('', $arraydata); - } - if ($i == ($imaxinloop - 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 $holidaystatic->getNomUrl(1, 1); - print ''.$userstatic->getNomUrl(-1, 'leave').''.$approbatorstatic->getNomUrl(-1).''; - print $labeltypeleavetoshow; - 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 ''; - print dol_print_date($db->jdate($obj->date_debut), 'day'); - print ' ('.$langs->trans($listhalfday[$starthalfday]).')'; - print ''; - print dol_print_date($db->jdate($obj->date_fin), 'day'); - print ' ('.$langs->trans($listhalfday[$endhalfday]).')'; - print ''; - print dol_print_date($db->jdate($obj->date_valid), 'day'); - print ''; - print dol_print_date($db->jdate($obj->date_approval), 'day'); - print ''.dol_print_date($date, 'dayhour').''.dol_print_date($date_modif, 'dayhour').''.$holidaystatic->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 '
'.$totalduration.' '.$langs->trans('DurationDays').''; + print $holidaystatic->getNomUrl(1, 1); + print ''.$userstatic->getNomUrl(-1, 'leave').'
'.$approbatorstatic->getNomUrl(-1).''; + print $labeltypeleavetoshow; + 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 ''; + print dol_print_date($db->jdate($obj->date_debut), 'day'); + print ' ('.$langs->trans($listhalfday[$starthalfday]).')'; + print ''; + print dol_print_date($db->jdate($obj->date_fin), 'day'); + print ' ('.$langs->trans($listhalfday[$endhalfday]).')'; + print ''; + print dol_print_date($db->jdate($obj->date_valid), 'day'); + print ''; + print dol_print_date($db->jdate($obj->date_approval), 'day'); + print ''.dol_print_date($date, 'dayhour').''.dol_print_date($date_modif, 'dayhour').''.$holidaystatic->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 '
'.$totalduration.' '.$langs->trans('DurationDays').'
'.$langs->trans("NoRecordFound").'
'; - print '
'; - - print '
'; -} else { - dol_print_error($db); } +// If no record found +if ($num == 0) { + $colspan = 1; + foreach ($arrayfields as $key => $val) { + if (!empty($val['checked'])) { + $colspan++; + } + } + print ''.$langs->trans("NoRecordFound").''; +} + +$db->free($resql); + +$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print ''."\n"; +print ''."\n"; + +print ''."\n"; + // End of page llxFooter(); $db->close(); From 8208884af4bffa25e7b79e332a1e4cf7085c0c11 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Mar 2023 09:45:47 +0100 Subject: [PATCH 09/16] Work on kanban views --- htdocs/holiday/class/holiday.class.php | 2 +- htdocs/holiday/list.php | 8 ++++---- htdocs/modulebuilder/template/myobject_list.php | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 93e443bad69..f3c7130e7f8 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2490,7 +2490,7 @@ class Holiday extends CommonObject $return .= ''; if (property_exists($this, 'fk_type')) { $return .= '
'.$langs->trans("Type").' : '; - $return .= ''.arraydata['labeltype'].''; + $return .= ''.$arraydata['labeltype'].''; } if (property_exists($this, 'date_debut') && property_exists($this, 'date_fin')) { $return .= '
'.dol_print_date($this->date_debut, 'day').''; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index ed5c222f7c8..42556f8704c 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -582,7 +582,7 @@ if (!empty($moreforfilter)) { } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields +$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); $include = ''; @@ -745,7 +745,7 @@ $totalarray['nbfield'] = 0; // -------------------------------------------------------------------- print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; } if (!empty($arrayfields['cp.ref']['checked'])) { @@ -804,7 +804,7 @@ if (!empty($arrayfields['cp.statut']['checked'])) { } // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; } print ''."\n"; @@ -1048,7 +1048,7 @@ if ($id && empty($user->rights->holiday->readall) && !in_array($id, $childids)) } // Add a line for total if there is a total to show - if (!empty($arrayfields['duration']['checked'])) { + if ($mode != 'kanban' && !empty($arrayfields['duration']['checked'])) { print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index ec5d8c979ed..7a3aae33d9c 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -554,7 +554,7 @@ if (!empty($moreforfilter)) { } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields +$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table @@ -631,7 +631,7 @@ $totalarray['nbfield'] = 0; // -------------------------------------------------------------------- print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; } foreach ($object->fields as $key => $val) { @@ -663,7 +663,7 @@ print $hookmanager->resPrint; }*/ // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; } print ''."\n"; From f84a8361bc27004b78fb394462a1f62e37f5c74b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Mar 2023 10:05:00 +0100 Subject: [PATCH 10/16] Look and feel v18 --- htdocs/core/lib/payments.lib.php | 10 ++++++---- htdocs/holiday/list.php | 2 +- htdocs/public/users/view.php | 2 -- htdocs/ticket/card.php | 6 ++++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index db1d0a13db6..93c7a17de2f 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -146,7 +146,7 @@ function payment_supplier_prepare_head(Paiement $object) */ function getValidOnlinePaymentMethods($paymentmethod = '') { - global $conf, $langs, $hookmanager, $action; + global $langs, $hookmanager, $action; $validpaymentmethod = array(); @@ -434,6 +434,8 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, { global $conf; + $reg = array(); + // Juridical status $line1 = ""; if ($fromcompany->forme_juridique_code) { @@ -485,9 +487,8 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, print ''."\n"; + print '
'."\n"; print '
'; - - print '
'."\n"; if ($addformmessage) { print ''; print '
'; @@ -519,5 +520,6 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, print ' - '; } print $line2; - print '
'."\n"; + print ''; + print '
'."\n"; } diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 42556f8704c..0be113d8205 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -881,7 +881,7 @@ if ($id && empty($user->rights->holiday->readall) && !in_array($id, $childids)) print '
'; } - $holidaystatic->fk_type = $typeleaves[$obj->fk_type]['rowid']; + $holidaystatic->fk_type = empty($typeleaves[$obj->fk_type]['rowid']) ? 0 : $typeleaves[$obj->fk_type]['rowid']; // Output Kanban if ($massactionbutton || $massaction) { diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php index 0eaeb1b6c8f..30b76404472 100644 --- a/htdocs/public/users/view.php +++ b/htdocs/public/users/view.php @@ -451,8 +451,6 @@ print '
'."\n"; print '
'; -//htmlPrintOnlinePaymentFooter($mysoc, $langs); - print '
'; print '
'; print ''; diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 42afd27304b..8e2114f9bae 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1248,10 +1248,12 @@ if ($action == 'create' || $action == 'presend') { } print ''; // Group - print ''.$langs->trans("TicketCategory").''; + $s = ''; if (!empty($object->category_code)) { - print $langs->getLabelFromKey($db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code); + $s = $langs->getLabelFromKey($db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code); } + print ''.$langs->trans("TicketCategory").''; + print dol_escape_htmltag($s); print ''; // Severity print ''.$langs->trans("TicketSeverity").''; From 2ef0f08c97df0263b3198b69f4a73df10900bfe1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Mar 2023 10:20:03 +0100 Subject: [PATCH 11/16] PHPunit --- test/phpunit/FunctionsLibTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 11eff71d4c6..7508c539208 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -180,7 +180,7 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase // An attempt for SQL injection $filter='if(now()=sysdate()%2Csleep(6)%2C0)'; $sql = forgeSQLFromUniversalSearchCriteria($filter); - $this->assertEquals($sql, '1 = 3'); + $this->assertEquals($sql, 'Filter syntax error'); // A real search string $filter='(((statut:=:1) or (entity:in:__AAA__)) and (abc:<:2.0) and (abc:!=:1.23))'; From 04c6cb22a15e545f99c190da8a9211c8ac62999c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Mar 2023 10:22:40 +0100 Subject: [PATCH 12/16] Fix universal filter for != --- htdocs/core/lib/functions.lib.php | 2 +- test/phpunit/FunctionsLibTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 74947d9dd71..4eeb5994334 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11685,7 +11685,7 @@ function dolForgeCriteriaCallback($matches) return ''; } - $operator = strtoupper(preg_replace('/[^a-z<>=]/i', '', trim($tmp[1]))); + $operator = strtoupper(preg_replace('/[^a-z<>=!]/i', '', trim($tmp[1]))); if ($operator == 'NOTLIKE') { $operator = 'NOT LIKE'; } diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 7508c539208..f398aef1050 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -185,7 +185,7 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase // A real search string $filter='(((statut:=:1) or (entity:in:__AAA__)) and (abc:<:2.0) and (abc:!=:1.23))'; $sql = forgeSQLFromUniversalSearchCriteria($filter); - $this->assertEquals($sql, ' AND (((statut = 1 or entity IN (__AAA__)) and abc < 2 and abc = 1.23))'); + $this->assertEquals($sql, ' AND (((statut = 1 or entity IN (__AAA__)) and abc < 2 and abc <> 1.23))'); $filter="(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.date_creation:<:'2016-01-01 12:30:00') or (t.nature:is:NULL)"; $sql = forgeSQLFromUniversalSearchCriteria($filter); From d369a640de4752fce27091bf0685b5fcfb6df2b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Mar 2023 12:48:25 +0100 Subject: [PATCH 13/16] Fix encryption of api_key --- htdocs/api/class/api_access.class.php | 10 ++++++---- htdocs/api/class/api_login.class.php | 3 ++- htdocs/core/lib/security.lib.php | 12 ++++++++++-- htdocs/user/class/user.class.php | 6 ++++-- htdocs/user/list.php | 9 ++++++--- 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index 7839cf14efc..d54b5771514 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -113,15 +113,15 @@ class DolibarrApiAccess implements iAuthenticate $sql = "SELECT u.login, u.datec, u.api_key, "; $sql .= " u.tms as date_modification, u.entity"; $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; - $sql .= " WHERE u.api_key = '".$this->db->escape($api_key)."'"; - // TODO Check if 2 users has same API key. + $sql .= " WHERE u.api_key = '".$this->db->escape($api_key)."' OR u.api_key = '".$this->db->escape(dolEncrypt($api_key, '', '', 'dolibarr'))."'"; $result = $this->db->query($sql); if ($result) { - if ($this->db->num_rows($result)) { + $nbrows = $this->db->num_rows($result); + if ($nbrows == 1) { $obj = $this->db->fetch_object($result); $login = $obj->login; - $stored_key = $obj->api_key; + $stored_key = dolDecrypt($obj->api_key); $userentity = $obj->entity; if (!defined("DOLENTITY") && $conf->entity != ($obj->entity ? $obj->entity : 1)) { // If API was not forced with HTTP_DOLENTITY, and user is on another entity, so we reset entity to entity of user @@ -130,6 +130,8 @@ class DolibarrApiAccess implements iAuthenticate dol_syslog("Entity was not set on http header with HTTP_DOLAPIENTITY (recommanded for performance purpose), so we switch now on entity of user (".$conf->entity.") and we have to reload configuration.", LOG_WARNING); $conf->setValues($this->db); } + } elseif ($nbrows > 1) { + throw new RestException(503, 'Error when fetching user api_key : More than 1 user with this apikey'); } } else { throw new RestException(503, 'Error when fetching user api_key :'.$this->db->error_msg); diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index d5362f4ac56..bf4f7ffd318 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -18,6 +18,7 @@ use Luracast\Restler\RestException; +require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; /** @@ -149,7 +150,7 @@ class Login // We store API token into database $sql = "UPDATE ".MAIN_DB_PREFIX."user"; - $sql .= " SET api_key = '".$this->db->escape($token)."'"; + $sql .= " SET api_key = '".$this->db->escape(dolEncrypt($token, '', '', 'dolibarr'))."'"; $sql .= " WHERE login = '".$this->db->escape($login)."'"; dol_syslog(get_class($this)."::login", LOG_DEBUG); // No log diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 5a610090be2..7ee9f7ce9b5 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -113,10 +113,11 @@ function dolGetRandomBytes($length) * @param string $chain string to encode * @param string $key If '', we use $dolibarr_main_instance_unique_id * @param string $ciphering Default ciphering algorithm + * @param string $forceseed To force the seed * @return string encoded string * @see dolDecrypt(), dol_hash() */ -function dolEncrypt($chain, $key = '', $ciphering = "AES-256-CTR") +function dolEncrypt($chain, $key = '', $ciphering = 'AES-256-CTR', $forceseed = '') { global $dolibarr_main_instance_unique_id; global $dolibarr_disable_dolcrypt_for_debug; @@ -134,6 +135,9 @@ function dolEncrypt($chain, $key = '', $ciphering = "AES-256-CTR") if (empty($key)) { $key = $dolibarr_main_instance_unique_id; } + if (empty($ciphering)) { + $ciphering = 'AES-256-CTR'; + } $newchain = $chain; @@ -145,7 +149,11 @@ function dolEncrypt($chain, $key = '', $ciphering = "AES-256-CTR") if ($ivlen === false || $ivlen < 1 || $ivlen > 32) { $ivlen = 16; } - $ivseed = dolGetRandomBytes($ivlen); + if (empty($forceseed)) { + $ivseed = dolGetRandomBytes($ivlen); + } else { + $ivseed = dol_trunc(md5($forceseed), $ivlen, 'right', 'UTF-8', 1); + } $newchain = openssl_encrypt($chain, $ciphering, $key, 0, $ivseed); return 'dolcrypt:'.$ciphering.':'.$ivseed.':'.$newchain; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 46b4b12a25e..5bea5b9f754 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -35,9 +35,11 @@ * \ingroup core */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; + /** * Class to manage Dolibarr users */ @@ -526,7 +528,7 @@ class User extends CommonObject $this->pass_indatabase_crypted = $obj->pass_crypted; $this->pass = $obj->pass; $this->pass_temp = $obj->pass_temp; - $this->api_key = $obj->api_key; + $this->api_key = dolDecrypt($obj->api_key); $this->address = $obj->address; $this->zip = $obj->zip; @@ -1977,7 +1979,7 @@ class User extends CommonObject $sql .= ", national_registration_number = '".$this->db->escape($this->national_registration_number)."'"; $sql .= ", employee = ".(int) $this->employee; $sql .= ", login = '".$this->db->escape($this->login)."'"; - $sql .= ", api_key = ".($this->api_key ? "'".$this->db->escape($this->api_key)."'" : "null"); + $sql .= ", api_key = ".($this->api_key ? "'".$this->db->escape(dolEncrypt($this->api_key, '', '', 'dolibarr'))."'" : "null"); $sql .= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman' $sql .= ", birth=".(strval($this->birth) != '' ? "'".$this->db->idate($this->birth, 'tzserver')."'" : 'null'); if (!empty($user->admin)) { diff --git a/htdocs/user/list.php b/htdocs/user/list.php index a269a93fb7b..19022cceccf 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -1127,10 +1127,13 @@ while ($i < $imaxinloop) { } } if (!empty($arrayfields['u.api_key']['checked'])) { - print ''; - if ($obj->api_key) { + $api_key = dolDecrypt($obj->api_key); + print ''; + if ($api_key) { if ($canreadsecretapi) { - print dol_escape_htmltag($obj->api_key); + print ''; + print showValueWithClipboardCPButton($object->api_key, 1, dol_trunc($api_key, 3)); // TODO Add an option to also reveal the hash, not only copy paste + print ''; } else { print ''.$langs->trans("Hidden").''; } From f29d5c784401f0adef68c9de4a4cadd659edae38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Mar 2023 13:17:49 +0100 Subject: [PATCH 14/16] Bettr order for mass action --- htdocs/commande/list.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 177f68a1fbb..c665166b0af 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -223,6 +223,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); +$error = 0; /* @@ -1284,24 +1285,24 @@ if ($resql) { if ($permissiontovalidate) { $arrayofmassactions['prevalidate'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"); } - if ($permissiontosendbymail) { - $arrayofmassactions['presend'] = img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"); - } if ($permissiontoclose) { $arrayofmassactions['preshipped'] = img_picto('', 'dollyrevert', 'class="pictofixedwidth"').$langs->trans("ClassifyShipped"); } - if ($permissiontocancel) { - $arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"); - } - if (isModEnabled('facture') && $user->hasRight("facture", "creer")) { - $arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer"); - } if ($permissiontoclose) { $arrayofmassactions['setbilled'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("ClassifyBilled"); } + if ($permissiontocancel) { + $arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"); + } if ($permissiontodelete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } + if (isModEnabled('facture') && $user->hasRight("facture", "creer")) { + $arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer"); + } + if ($permissiontosendbymail) { + $arrayofmassactions['presend'] = img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"); + } if (in_array($massaction, array('presend', 'predelete', 'createbills'))) { $arrayofmassactions = array(); } From dc1ba8f447b8ceb02f14042e04c25fa7c0be0e3b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Mar 2023 13:19:24 +0100 Subject: [PATCH 15/16] Fix phpunit --- test/phpunit/FunctionsLibTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index d910a9f9d57..92b75c5aa97 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -185,7 +185,7 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase // A real search string $filter='(((statut:=:1) or (entity:in:__AAA__)) and (abc:<:2.0) and (abc:!=:1.23))'; $sql = forgeSQLFromUniversalSearchCriteria($filter); - $this->assertEquals($sql, ' AND (((statut = 1 or entity IN (__AAA__)) and abc < 2 and abc = 1.23))'); + $this->assertEquals($sql, ' AND (((statut = 1 or entity IN (__AAA__)) and abc < 2 and abc <> 1.23))'); $filter="(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.date_creation:<:'2016-01-01 12:30:00') or (t.nature:is:NULL)"; $sql = forgeSQLFromUniversalSearchCriteria($filter); From 7a1404c4430cbda3a65f4486672239865d03dd83 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Mar 2023 13:21:48 +0100 Subject: [PATCH 16/16] Fix sql --- .../install/mysql/data/llx_00_c_country.sql | 498 +++++++++--------- 1 file changed, 249 insertions(+), 249 deletions(-) diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql index bbc0be55335..829d6ffe8cb 100644 --- a/htdocs/install/mysql/data/llx_00_c_country.sql +++ b/htdocs/install/mysql/data/llx_00_c_country.sql @@ -279,255 +279,255 @@ INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUE -UPDATE llx_c_country SET numeric_code = '004' WHERE code_iso = "AFG"; -UPDATE llx_c_country SET numeric_code = '248' WHERE code_iso = "ALA"; -UPDATE llx_c_country SET numeric_code = '008' WHERE code_iso = "ALB"; -UPDATE llx_c_country SET numeric_code = '276' WHERE code_iso = "DEU"; -UPDATE llx_c_country SET numeric_code = '020' WHERE code_iso = "AND"; -UPDATE llx_c_country SET numeric_code = '024' WHERE code_iso = "AGO"; -UPDATE llx_c_country SET numeric_code = '660' WHERE code_iso = "AIA"; -UPDATE llx_c_country SET numeric_code = '010' WHERE code_iso = "ATA"; -UPDATE llx_c_country SET numeric_code = '028' WHERE code_iso = "ATG"; -UPDATE llx_c_country SET numeric_code = '682' WHERE code_iso = "SAU"; -UPDATE llx_c_country SET numeric_code = '012' WHERE code_iso = "DZA"; -UPDATE llx_c_country SET numeric_code = '032' WHERE code_iso = "ARG"; -UPDATE llx_c_country SET numeric_code = '051' WHERE code_iso = "ARM"; -UPDATE llx_c_country SET numeric_code = '533' WHERE code_iso = "ABW"; -UPDATE llx_c_country SET numeric_code = '036' WHERE code_iso = "AUS"; -UPDATE llx_c_country SET numeric_code = '040' WHERE code_iso = "AUT"; -UPDATE llx_c_country SET numeric_code = '031' WHERE code_iso = "AZE"; -UPDATE llx_c_country SET numeric_code = '044' WHERE code_iso = "BHS"; -UPDATE llx_c_country SET numeric_code = '050' WHERE code_iso = "BGD"; -UPDATE llx_c_country SET numeric_code = '052' WHERE code_iso = "BRB"; -UPDATE llx_c_country SET numeric_code = '048' WHERE code_iso = "BHR"; -UPDATE llx_c_country SET numeric_code = '056' WHERE code_iso = "BEL"; -UPDATE llx_c_country SET numeric_code = '084' WHERE code_iso = "BLZ"; -UPDATE llx_c_country SET numeric_code = '204' WHERE code_iso = "BEN"; -UPDATE llx_c_country SET numeric_code = '060' WHERE code_iso = "BMU"; -UPDATE llx_c_country SET numeric_code = '112' WHERE code_iso = "BLR"; -UPDATE llx_c_country SET numeric_code = '068' WHERE code_iso = "BOL"; -UPDATE llx_c_country SET numeric_code = '535' WHERE code_iso = "BES"; -UPDATE llx_c_country SET numeric_code = '070' WHERE code_iso = "BIH"; -UPDATE llx_c_country SET numeric_code = '072' WHERE code_iso = "BWA"; -UPDATE llx_c_country SET numeric_code = '076' WHERE code_iso = "BRA"; -UPDATE llx_c_country SET numeric_code = '096' WHERE code_iso = "BRN"; -UPDATE llx_c_country SET numeric_code = '100' WHERE code_iso = "BGR"; -UPDATE llx_c_country SET numeric_code = '854' WHERE code_iso = "BFA"; -UPDATE llx_c_country SET numeric_code = '108' WHERE code_iso = "BDI"; -UPDATE llx_c_country SET numeric_code = '064' WHERE code_iso = "BTN"; -UPDATE llx_c_country SET numeric_code = '132' WHERE code_iso = "CPV"; -UPDATE llx_c_country SET numeric_code = '116' WHERE code_iso = "KHM"; -UPDATE llx_c_country SET numeric_code = '120' WHERE code_iso = "CMR"; -UPDATE llx_c_country SET numeric_code = '124' WHERE code_iso = "CAN"; -UPDATE llx_c_country SET numeric_code = '634' WHERE code_iso = "QAT"; -UPDATE llx_c_country SET numeric_code = '148' WHERE code_iso = "TCD"; -UPDATE llx_c_country SET numeric_code = '152' WHERE code_iso = "CHL"; -UPDATE llx_c_country SET numeric_code = '156' WHERE code_iso = "CHN"; -UPDATE llx_c_country SET numeric_code = '196' WHERE code_iso = "CYP"; -UPDATE llx_c_country SET numeric_code = '170' WHERE code_iso = "COL"; -UPDATE llx_c_country SET numeric_code = '174' WHERE code_iso = "COM"; -UPDATE llx_c_country SET numeric_code = '408' WHERE code_iso = "PRK"; -UPDATE llx_c_country SET numeric_code = '410' WHERE code_iso = "KOR"; -UPDATE llx_c_country SET numeric_code = '384' WHERE code_iso = "CIV"; -UPDATE llx_c_country SET numeric_code = '188' WHERE code_iso = "CRI"; -UPDATE llx_c_country SET numeric_code = '191' WHERE code_iso = "HRV"; -UPDATE llx_c_country SET numeric_code = '192' WHERE code_iso = "CUB"; -UPDATE llx_c_country SET numeric_code = '531' WHERE code_iso = "CUW"; -UPDATE llx_c_country SET numeric_code = '208' WHERE code_iso = "DNK"; -UPDATE llx_c_country SET numeric_code = '212' WHERE code_iso = "DMA"; -UPDATE llx_c_country SET numeric_code = '218' WHERE code_iso = "ECU"; -UPDATE llx_c_country SET numeric_code = '818' WHERE code_iso = "EGY"; -UPDATE llx_c_country SET numeric_code = '222' WHERE code_iso = "SLV"; -UPDATE llx_c_country SET numeric_code = '784' WHERE code_iso = "ARE"; -UPDATE llx_c_country SET numeric_code = '232' WHERE code_iso = "ERI"; -UPDATE llx_c_country SET numeric_code = '703' WHERE code_iso = "SVK"; -UPDATE llx_c_country SET numeric_code = '705' WHERE code_iso = "SVN"; -UPDATE llx_c_country SET numeric_code = '724' WHERE code_iso = "ESP"; -UPDATE llx_c_country SET numeric_code = '840' WHERE code_iso = "USA"; -UPDATE llx_c_country SET numeric_code = '233' WHERE code_iso = "EST"; -UPDATE llx_c_country SET numeric_code = '231' WHERE code_iso = "ETH"; -UPDATE llx_c_country SET numeric_code = '608' WHERE code_iso = "PHL"; -UPDATE llx_c_country SET numeric_code = '246' WHERE code_iso = "FIN"; -UPDATE llx_c_country SET numeric_code = '242' WHERE code_iso = "FJI"; -UPDATE llx_c_country SET numeric_code = '250' WHERE code_iso = "FRA"; -UPDATE llx_c_country SET numeric_code = '266' WHERE code_iso = "GAB"; -UPDATE llx_c_country SET numeric_code = '270' WHERE code_iso = "GMB"; -UPDATE llx_c_country SET numeric_code = '268' WHERE code_iso = "GEO"; -UPDATE llx_c_country SET numeric_code = '288' WHERE code_iso = "GHA"; -UPDATE llx_c_country SET numeric_code = '292' WHERE code_iso = "GIB"; -UPDATE llx_c_country SET numeric_code = '308' WHERE code_iso = "GRD"; -UPDATE llx_c_country SET numeric_code = '300' WHERE code_iso = "GRC"; -UPDATE llx_c_country SET numeric_code = '304' WHERE code_iso = "GRL"; -UPDATE llx_c_country SET numeric_code = '312' WHERE code_iso = "GLP"; -UPDATE llx_c_country SET numeric_code = '316' WHERE code_iso = "GUM"; -UPDATE llx_c_country SET numeric_code = '320' WHERE code_iso = "GTM"; -UPDATE llx_c_country SET numeric_code = '254' WHERE code_iso = "GUF"; -UPDATE llx_c_country SET numeric_code = '831' WHERE code_iso = "GGY"; -UPDATE llx_c_country SET numeric_code = '324' WHERE code_iso = "GIN"; -UPDATE llx_c_country SET numeric_code = '624' WHERE code_iso = "GNB"; -UPDATE llx_c_country SET numeric_code = '226' WHERE code_iso = "GNQ"; -UPDATE llx_c_country SET numeric_code = '328' WHERE code_iso = "GUY"; -UPDATE llx_c_country SET numeric_code = '332' WHERE code_iso = "HTI"; -UPDATE llx_c_country SET numeric_code = '340' WHERE code_iso = "HND"; -UPDATE llx_c_country SET numeric_code = '344' WHERE code_iso = "HKG"; -UPDATE llx_c_country SET numeric_code = '348' WHERE code_iso = "HUN"; -UPDATE llx_c_country SET numeric_code = '356' WHERE code_iso = "IND"; -UPDATE llx_c_country SET numeric_code = '360' WHERE code_iso = "IDN"; -UPDATE llx_c_country SET numeric_code = '368' WHERE code_iso = "IRQ"; -UPDATE llx_c_country SET numeric_code = '364' WHERE code_iso = "IRN"; -UPDATE llx_c_country SET numeric_code = '372' WHERE code_iso = "IRL"; -UPDATE llx_c_country SET numeric_code = '074' WHERE code_iso = "BVT"; -UPDATE llx_c_country SET numeric_code = '833' WHERE code_iso = "IMN"; -UPDATE llx_c_country SET numeric_code = '162' WHERE code_iso = "CXR"; -UPDATE llx_c_country SET numeric_code = '352' WHERE code_iso = "ISL"; -UPDATE llx_c_country SET numeric_code = '136' WHERE code_iso = "CYM"; -UPDATE llx_c_country SET numeric_code = '166' WHERE code_iso = "CCK"; -UPDATE llx_c_country SET numeric_code = '184' WHERE code_iso = "COK"; -UPDATE llx_c_country SET numeric_code = '234' WHERE code_iso = "FRO"; -UPDATE llx_c_country SET numeric_code = '239' WHERE code_iso = "SGS"; -UPDATE llx_c_country SET numeric_code = '334' WHERE code_iso = "HMD"; -UPDATE llx_c_country SET numeric_code = '238' WHERE code_iso = "FLK"; -UPDATE llx_c_country SET numeric_code = '580' WHERE code_iso = "MNP"; -UPDATE llx_c_country SET numeric_code = '584' WHERE code_iso = "MHL"; -UPDATE llx_c_country SET numeric_code = '612' WHERE code_iso = "PCN"; -UPDATE llx_c_country SET numeric_code = '090' WHERE code_iso = "SLB"; -UPDATE llx_c_country SET numeric_code = '796' WHERE code_iso = "TCA"; -UPDATE llx_c_country SET numeric_code = '581' WHERE code_iso = "UMI"; -UPDATE llx_c_country SET numeric_code = '092' WHERE code_iso = "VGB"; -UPDATE llx_c_country SET numeric_code = '850' WHERE code_iso = "VIR"; -UPDATE llx_c_country SET numeric_code = '376' WHERE code_iso = "ISR"; -UPDATE llx_c_country SET numeric_code = '380' WHERE code_iso = "ITA"; -UPDATE llx_c_country SET numeric_code = '388' WHERE code_iso = "JAM"; -UPDATE llx_c_country SET numeric_code = '392' WHERE code_iso = "JPN"; -UPDATE llx_c_country SET numeric_code = '832' WHERE code_iso = "JEY"; -UPDATE llx_c_country SET numeric_code = '400' WHERE code_iso = "JOR"; -UPDATE llx_c_country SET numeric_code = '398' WHERE code_iso = "KAZ"; -UPDATE llx_c_country SET numeric_code = '404' WHERE code_iso = "KEN"; -UPDATE llx_c_country SET numeric_code = '417' WHERE code_iso = "KGZ"; -UPDATE llx_c_country SET numeric_code = '296' WHERE code_iso = "KIR"; -UPDATE llx_c_country SET numeric_code = '414' WHERE code_iso = "KWT"; -UPDATE llx_c_country SET numeric_code = '418' WHERE code_iso = "LAO"; -UPDATE llx_c_country SET numeric_code = '426' WHERE code_iso = "LSO"; -UPDATE llx_c_country SET numeric_code = '428' WHERE code_iso = "LVA"; -UPDATE llx_c_country SET numeric_code = '422' WHERE code_iso = "LBN"; -UPDATE llx_c_country SET numeric_code = '430' WHERE code_iso = "LBR"; -UPDATE llx_c_country SET numeric_code = '434' WHERE code_iso = "LBY"; -UPDATE llx_c_country SET numeric_code = '438' WHERE code_iso = "LIE"; -UPDATE llx_c_country SET numeric_code = '440' WHERE code_iso = "LTU"; -UPDATE llx_c_country SET numeric_code = '442' WHERE code_iso = "LUX"; -UPDATE llx_c_country SET numeric_code = '446' WHERE code_iso = "MAC"; -UPDATE llx_c_country SET numeric_code = '807' WHERE code_iso = "MKD"; -UPDATE llx_c_country SET numeric_code = '450' WHERE code_iso = "MDG"; -UPDATE llx_c_country SET numeric_code = '458' WHERE code_iso = "MYS"; -UPDATE llx_c_country SET numeric_code = '454' WHERE code_iso = "MWI"; -UPDATE llx_c_country SET numeric_code = '462' WHERE code_iso = "MDV"; -UPDATE llx_c_country SET numeric_code = '466' WHERE code_iso = "MLI"; -UPDATE llx_c_country SET numeric_code = '470' WHERE code_iso = "MLT"; -UPDATE llx_c_country SET numeric_code = '504' WHERE code_iso = "MAR"; -UPDATE llx_c_country SET numeric_code = '474' WHERE code_iso = "MTQ"; -UPDATE llx_c_country SET numeric_code = '480' WHERE code_iso = "MUS"; -UPDATE llx_c_country SET numeric_code = '478' WHERE code_iso = "MRT"; -UPDATE llx_c_country SET numeric_code = '175' WHERE code_iso = "MYT"; -UPDATE llx_c_country SET numeric_code = '484' WHERE code_iso = "MEX"; -UPDATE llx_c_country SET numeric_code = '583' WHERE code_iso = "FSM"; -UPDATE llx_c_country SET numeric_code = '498' WHERE code_iso = "MDA"; -UPDATE llx_c_country SET numeric_code = '492' WHERE code_iso = "MCO"; -UPDATE llx_c_country SET numeric_code = '496' WHERE code_iso = "MNG"; -UPDATE llx_c_country SET numeric_code = '499' WHERE code_iso = "MNE"; -UPDATE llx_c_country SET numeric_code = '500' WHERE code_iso = "MSR"; -UPDATE llx_c_country SET numeric_code = '508' WHERE code_iso = "MOZ"; -UPDATE llx_c_country SET numeric_code = '104' WHERE code_iso = "MMR"; -UPDATE llx_c_country SET numeric_code = '516' WHERE code_iso = "NAM"; -UPDATE llx_c_country SET numeric_code = '520' WHERE code_iso = "NRU"; -UPDATE llx_c_country SET numeric_code = '524' WHERE code_iso = "NPL"; -UPDATE llx_c_country SET numeric_code = '558' WHERE code_iso = "NIC"; -UPDATE llx_c_country SET numeric_code = '562' WHERE code_iso = "NER"; -UPDATE llx_c_country SET numeric_code = '566' WHERE code_iso = "NGA"; -UPDATE llx_c_country SET numeric_code = '570' WHERE code_iso = "NIU"; -UPDATE llx_c_country SET numeric_code = '574' WHERE code_iso = "NFK"; -UPDATE llx_c_country SET numeric_code = '578' WHERE code_iso = "NOR"; -UPDATE llx_c_country SET numeric_code = '540' WHERE code_iso = "NCL"; -UPDATE llx_c_country SET numeric_code = '554' WHERE code_iso = "NZL"; -UPDATE llx_c_country SET numeric_code = '512' WHERE code_iso = "OMN"; -UPDATE llx_c_country SET numeric_code = '528' WHERE code_iso = "NLD"; -UPDATE llx_c_country SET numeric_code = '586' WHERE code_iso = "PAK"; -UPDATE llx_c_country SET numeric_code = '585' WHERE code_iso = "PLW"; -UPDATE llx_c_country SET numeric_code = '275' WHERE code_iso = "PSE"; -UPDATE llx_c_country SET numeric_code = '591' WHERE code_iso = "PAN"; -UPDATE llx_c_country SET numeric_code = '598' WHERE code_iso = "PNG"; -UPDATE llx_c_country SET numeric_code = '600' WHERE code_iso = "PRY"; -UPDATE llx_c_country SET numeric_code = '604' WHERE code_iso = "PER"; -UPDATE llx_c_country SET numeric_code = '258' WHERE code_iso = "PYF"; -UPDATE llx_c_country SET numeric_code = '616' WHERE code_iso = "POL"; -UPDATE llx_c_country SET numeric_code = '620' WHERE code_iso = "PRT"; -UPDATE llx_c_country SET numeric_code = '630' WHERE code_iso = "PRI"; -UPDATE llx_c_country SET numeric_code = '826' WHERE code_iso = "GBR"; -UPDATE llx_c_country SET numeric_code = '732' WHERE code_iso = "ESH"; -UPDATE llx_c_country SET numeric_code = '140' WHERE code_iso = "CAF"; -UPDATE llx_c_country SET numeric_code = '203' WHERE code_iso = "CZE"; -UPDATE llx_c_country SET numeric_code = '178' WHERE code_iso = "COG"; -UPDATE llx_c_country SET numeric_code = '180' WHERE code_iso = "COD"; -UPDATE llx_c_country SET numeric_code = '214' WHERE code_iso = "DOM"; -UPDATE llx_c_country SET numeric_code = '638' WHERE code_iso = "REU"; -UPDATE llx_c_country SET numeric_code = '646' WHERE code_iso = "RWA"; -UPDATE llx_c_country SET numeric_code = '642' WHERE code_iso = "ROU"; -UPDATE llx_c_country SET numeric_code = '643' WHERE code_iso = "RUS"; -UPDATE llx_c_country SET numeric_code = '882' WHERE code_iso = "WSM"; -UPDATE llx_c_country SET numeric_code = '016' WHERE code_iso = "ASM"; -UPDATE llx_c_country SET numeric_code = '652' WHERE code_iso = "BLM"; -UPDATE llx_c_country SET numeric_code = '659' WHERE code_iso = "KNA"; -UPDATE llx_c_country SET numeric_code = '674' WHERE code_iso = "SMR"; -UPDATE llx_c_country SET numeric_code = '663' WHERE code_iso = "MAF"; -UPDATE llx_c_country SET numeric_code = '666' WHERE code_iso = "SPM"; -UPDATE llx_c_country SET numeric_code = '670' WHERE code_iso = "VCT"; -UPDATE llx_c_country SET numeric_code = '654' WHERE code_iso = "SHN"; -UPDATE llx_c_country SET numeric_code = '662' WHERE code_iso = "LCA"; -UPDATE llx_c_country SET numeric_code = '678' WHERE code_iso = "STP"; -UPDATE llx_c_country SET numeric_code = '686' WHERE code_iso = "SEN"; -UPDATE llx_c_country SET numeric_code = '688' WHERE code_iso = "SRB"; -UPDATE llx_c_country SET numeric_code = '690' WHERE code_iso = "SYC"; -UPDATE llx_c_country SET numeric_code = '694' WHERE code_iso = "SLE"; -UPDATE llx_c_country SET numeric_code = '702' WHERE code_iso = "SGP"; -UPDATE llx_c_country SET numeric_code = '534' WHERE code_iso = "SXM"; -UPDATE llx_c_country SET numeric_code = '760' WHERE code_iso = "SYR"; -UPDATE llx_c_country SET numeric_code = '706' WHERE code_iso = "SOM"; -UPDATE llx_c_country SET numeric_code = '144' WHERE code_iso = "LKA"; -UPDATE llx_c_country SET numeric_code = '748' WHERE code_iso = "SWZ"; -UPDATE llx_c_country SET numeric_code = '710' WHERE code_iso = "ZAF"; -UPDATE llx_c_country SET numeric_code = '729' WHERE code_iso = "SDN"; -UPDATE llx_c_country SET numeric_code = '728' WHERE code_iso = "SSD"; -UPDATE llx_c_country SET numeric_code = '752' WHERE code_iso = "SWE"; -UPDATE llx_c_country SET numeric_code = '756' WHERE code_iso = "CHE"; -UPDATE llx_c_country SET numeric_code = '740' WHERE code_iso = "SUR"; -UPDATE llx_c_country SET numeric_code = '744' WHERE code_iso = "SJM"; -UPDATE llx_c_country SET numeric_code = '764' WHERE code_iso = "THA"; -UPDATE llx_c_country SET numeric_code = '158' WHERE code_iso = "TWN"; -UPDATE llx_c_country SET numeric_code = '834' WHERE code_iso = "TZA"; -UPDATE llx_c_country SET numeric_code = '762' WHERE code_iso = "TJK"; -UPDATE llx_c_country SET numeric_code = '086' WHERE code_iso = "IOT"; -UPDATE llx_c_country SET numeric_code = '260' WHERE code_iso = "ATF"; -UPDATE llx_c_country SET numeric_code = '626' WHERE code_iso = "TLS"; -UPDATE llx_c_country SET numeric_code = '768' WHERE code_iso = "TGO"; -UPDATE llx_c_country SET numeric_code = '772' WHERE code_iso = "TKL"; -UPDATE llx_c_country SET numeric_code = '776' WHERE code_iso = "TON"; -UPDATE llx_c_country SET numeric_code = '780' WHERE code_iso = "TTO"; -UPDATE llx_c_country SET numeric_code = '788' WHERE code_iso = "TUN"; -UPDATE llx_c_country SET numeric_code = '795' WHERE code_iso = "TKM"; -UPDATE llx_c_country SET numeric_code = '792' WHERE code_iso = "TUR"; -UPDATE llx_c_country SET numeric_code = '798' WHERE code_iso = "TUV"; -UPDATE llx_c_country SET numeric_code = '804' WHERE code_iso = "UKR"; -UPDATE llx_c_country SET numeric_code = '800' WHERE code_iso = "UGA"; -UPDATE llx_c_country SET numeric_code = '858' WHERE code_iso = "URY"; -UPDATE llx_c_country SET numeric_code = '860' WHERE code_iso = "UZB"; -UPDATE llx_c_country SET numeric_code = '548' WHERE code_iso = "VUT"; -UPDATE llx_c_country SET numeric_code = '336' WHERE code_iso = "VAT"; -UPDATE llx_c_country SET numeric_code = '862' WHERE code_iso = "VEN"; -UPDATE llx_c_country SET numeric_code = '704' WHERE code_iso = "VNM"; -UPDATE llx_c_country SET numeric_code = '876' WHERE code_iso = "WLF"; -UPDATE llx_c_country SET numeric_code = '887' WHERE code_iso = "YEM"; -UPDATE llx_c_country SET numeric_code = '262' WHERE code_iso = "DJI"; -UPDATE llx_c_country SET numeric_code = '894' WHERE code_iso = "ZMB"; -UPDATE llx_c_country SET numeric_code = '716' WHERE code_iso = "ZWE"; +UPDATE llx_c_country SET numeric_code = '004' WHERE code_iso = 'AFG'; +UPDATE llx_c_country SET numeric_code = '248' WHERE code_iso = 'ALA'; +UPDATE llx_c_country SET numeric_code = '008' WHERE code_iso = 'ALB'; +UPDATE llx_c_country SET numeric_code = '276' WHERE code_iso = 'DEU'; +UPDATE llx_c_country SET numeric_code = '020' WHERE code_iso = 'AND'; +UPDATE llx_c_country SET numeric_code = '024' WHERE code_iso = 'AGO'; +UPDATE llx_c_country SET numeric_code = '660' WHERE code_iso = 'AIA'; +UPDATE llx_c_country SET numeric_code = '010' WHERE code_iso = 'ATA'; +UPDATE llx_c_country SET numeric_code = '028' WHERE code_iso = 'ATG'; +UPDATE llx_c_country SET numeric_code = '682' WHERE code_iso = 'SAU'; +UPDATE llx_c_country SET numeric_code = '012' WHERE code_iso = 'DZA'; +UPDATE llx_c_country SET numeric_code = '032' WHERE code_iso = 'ARG'; +UPDATE llx_c_country SET numeric_code = '051' WHERE code_iso = 'ARM'; +UPDATE llx_c_country SET numeric_code = '533' WHERE code_iso = 'ABW'; +UPDATE llx_c_country SET numeric_code = '036' WHERE code_iso = 'AUS'; +UPDATE llx_c_country SET numeric_code = '040' WHERE code_iso = 'AUT'; +UPDATE llx_c_country SET numeric_code = '031' WHERE code_iso = 'AZE'; +UPDATE llx_c_country SET numeric_code = '044' WHERE code_iso = 'BHS'; +UPDATE llx_c_country SET numeric_code = '050' WHERE code_iso = 'BGD'; +UPDATE llx_c_country SET numeric_code = '052' WHERE code_iso = 'BRB'; +UPDATE llx_c_country SET numeric_code = '048' WHERE code_iso = 'BHR'; +UPDATE llx_c_country SET numeric_code = '056' WHERE code_iso = 'BEL'; +UPDATE llx_c_country SET numeric_code = '084' WHERE code_iso = 'BLZ'; +UPDATE llx_c_country SET numeric_code = '204' WHERE code_iso = 'BEN'; +UPDATE llx_c_country SET numeric_code = '060' WHERE code_iso = 'BMU'; +UPDATE llx_c_country SET numeric_code = '112' WHERE code_iso = 'BLR'; +UPDATE llx_c_country SET numeric_code = '068' WHERE code_iso = 'BOL'; +UPDATE llx_c_country SET numeric_code = '535' WHERE code_iso = 'BES'; +UPDATE llx_c_country SET numeric_code = '070' WHERE code_iso = 'BIH'; +UPDATE llx_c_country SET numeric_code = '072' WHERE code_iso = 'BWA'; +UPDATE llx_c_country SET numeric_code = '076' WHERE code_iso = 'BRA'; +UPDATE llx_c_country SET numeric_code = '096' WHERE code_iso = 'BRN'; +UPDATE llx_c_country SET numeric_code = '100' WHERE code_iso = 'BGR'; +UPDATE llx_c_country SET numeric_code = '854' WHERE code_iso = 'BFA'; +UPDATE llx_c_country SET numeric_code = '108' WHERE code_iso = 'BDI'; +UPDATE llx_c_country SET numeric_code = '064' WHERE code_iso = 'BTN'; +UPDATE llx_c_country SET numeric_code = '132' WHERE code_iso = 'CPV'; +UPDATE llx_c_country SET numeric_code = '116' WHERE code_iso = 'KHM'; +UPDATE llx_c_country SET numeric_code = '120' WHERE code_iso = 'CMR'; +UPDATE llx_c_country SET numeric_code = '124' WHERE code_iso = 'CAN'; +UPDATE llx_c_country SET numeric_code = '634' WHERE code_iso = 'QAT'; +UPDATE llx_c_country SET numeric_code = '148' WHERE code_iso = 'TCD'; +UPDATE llx_c_country SET numeric_code = '152' WHERE code_iso = 'CHL'; +UPDATE llx_c_country SET numeric_code = '156' WHERE code_iso = 'CHN'; +UPDATE llx_c_country SET numeric_code = '196' WHERE code_iso = 'CYP'; +UPDATE llx_c_country SET numeric_code = '170' WHERE code_iso = 'COL'; +UPDATE llx_c_country SET numeric_code = '174' WHERE code_iso = 'COM'; +UPDATE llx_c_country SET numeric_code = '408' WHERE code_iso = 'PRK'; +UPDATE llx_c_country SET numeric_code = '410' WHERE code_iso = 'KOR'; +UPDATE llx_c_country SET numeric_code = '384' WHERE code_iso = 'CIV'; +UPDATE llx_c_country SET numeric_code = '188' WHERE code_iso = 'CRI'; +UPDATE llx_c_country SET numeric_code = '191' WHERE code_iso = 'HRV'; +UPDATE llx_c_country SET numeric_code = '192' WHERE code_iso = 'CUB'; +UPDATE llx_c_country SET numeric_code = '531' WHERE code_iso = 'CUW'; +UPDATE llx_c_country SET numeric_code = '208' WHERE code_iso = 'DNK'; +UPDATE llx_c_country SET numeric_code = '212' WHERE code_iso = 'DMA'; +UPDATE llx_c_country SET numeric_code = '218' WHERE code_iso = 'ECU'; +UPDATE llx_c_country SET numeric_code = '818' WHERE code_iso = 'EGY'; +UPDATE llx_c_country SET numeric_code = '222' WHERE code_iso = 'SLV'; +UPDATE llx_c_country SET numeric_code = '784' WHERE code_iso = 'ARE'; +UPDATE llx_c_country SET numeric_code = '232' WHERE code_iso = 'ERI'; +UPDATE llx_c_country SET numeric_code = '703' WHERE code_iso = 'SVK'; +UPDATE llx_c_country SET numeric_code = '705' WHERE code_iso = 'SVN'; +UPDATE llx_c_country SET numeric_code = '724' WHERE code_iso = 'ESP'; +UPDATE llx_c_country SET numeric_code = '840' WHERE code_iso = 'USA'; +UPDATE llx_c_country SET numeric_code = '233' WHERE code_iso = 'EST'; +UPDATE llx_c_country SET numeric_code = '231' WHERE code_iso = 'ETH'; +UPDATE llx_c_country SET numeric_code = '608' WHERE code_iso = 'PHL'; +UPDATE llx_c_country SET numeric_code = '246' WHERE code_iso = 'FIN'; +UPDATE llx_c_country SET numeric_code = '242' WHERE code_iso = 'FJI'; +UPDATE llx_c_country SET numeric_code = '250' WHERE code_iso = 'FRA'; +UPDATE llx_c_country SET numeric_code = '266' WHERE code_iso = 'GAB'; +UPDATE llx_c_country SET numeric_code = '270' WHERE code_iso = 'GMB'; +UPDATE llx_c_country SET numeric_code = '268' WHERE code_iso = 'GEO'; +UPDATE llx_c_country SET numeric_code = '288' WHERE code_iso = 'GHA'; +UPDATE llx_c_country SET numeric_code = '292' WHERE code_iso = 'GIB'; +UPDATE llx_c_country SET numeric_code = '308' WHERE code_iso = 'GRD'; +UPDATE llx_c_country SET numeric_code = '300' WHERE code_iso = 'GRC'; +UPDATE llx_c_country SET numeric_code = '304' WHERE code_iso = 'GRL'; +UPDATE llx_c_country SET numeric_code = '312' WHERE code_iso = 'GLP'; +UPDATE llx_c_country SET numeric_code = '316' WHERE code_iso = 'GUM'; +UPDATE llx_c_country SET numeric_code = '320' WHERE code_iso = 'GTM'; +UPDATE llx_c_country SET numeric_code = '254' WHERE code_iso = 'GUF'; +UPDATE llx_c_country SET numeric_code = '831' WHERE code_iso = 'GGY'; +UPDATE llx_c_country SET numeric_code = '324' WHERE code_iso = 'GIN'; +UPDATE llx_c_country SET numeric_code = '624' WHERE code_iso = 'GNB'; +UPDATE llx_c_country SET numeric_code = '226' WHERE code_iso = 'GNQ'; +UPDATE llx_c_country SET numeric_code = '328' WHERE code_iso = 'GUY'; +UPDATE llx_c_country SET numeric_code = '332' WHERE code_iso = 'HTI'; +UPDATE llx_c_country SET numeric_code = '340' WHERE code_iso = 'HND'; +UPDATE llx_c_country SET numeric_code = '344' WHERE code_iso = 'HKG'; +UPDATE llx_c_country SET numeric_code = '348' WHERE code_iso = 'HUN'; +UPDATE llx_c_country SET numeric_code = '356' WHERE code_iso = 'IND'; +UPDATE llx_c_country SET numeric_code = '360' WHERE code_iso = 'IDN'; +UPDATE llx_c_country SET numeric_code = '368' WHERE code_iso = 'IRQ'; +UPDATE llx_c_country SET numeric_code = '364' WHERE code_iso = 'IRN'; +UPDATE llx_c_country SET numeric_code = '372' WHERE code_iso = 'IRL'; +UPDATE llx_c_country SET numeric_code = '074' WHERE code_iso = 'BVT'; +UPDATE llx_c_country SET numeric_code = '833' WHERE code_iso = 'IMN'; +UPDATE llx_c_country SET numeric_code = '162' WHERE code_iso = 'CXR'; +UPDATE llx_c_country SET numeric_code = '352' WHERE code_iso = 'ISL'; +UPDATE llx_c_country SET numeric_code = '136' WHERE code_iso = 'CYM'; +UPDATE llx_c_country SET numeric_code = '166' WHERE code_iso = 'CCK'; +UPDATE llx_c_country SET numeric_code = '184' WHERE code_iso = 'COK'; +UPDATE llx_c_country SET numeric_code = '234' WHERE code_iso = 'FRO'; +UPDATE llx_c_country SET numeric_code = '239' WHERE code_iso = 'SGS'; +UPDATE llx_c_country SET numeric_code = '334' WHERE code_iso = 'HMD'; +UPDATE llx_c_country SET numeric_code = '238' WHERE code_iso = 'FLK'; +UPDATE llx_c_country SET numeric_code = '580' WHERE code_iso = 'MNP'; +UPDATE llx_c_country SET numeric_code = '584' WHERE code_iso = 'MHL'; +UPDATE llx_c_country SET numeric_code = '612' WHERE code_iso = 'PCN'; +UPDATE llx_c_country SET numeric_code = '090' WHERE code_iso = 'SLB'; +UPDATE llx_c_country SET numeric_code = '796' WHERE code_iso = 'TCA'; +UPDATE llx_c_country SET numeric_code = '581' WHERE code_iso = 'UMI'; +UPDATE llx_c_country SET numeric_code = '092' WHERE code_iso = 'VGB'; +UPDATE llx_c_country SET numeric_code = '850' WHERE code_iso = 'VIR'; +UPDATE llx_c_country SET numeric_code = '376' WHERE code_iso = 'ISR'; +UPDATE llx_c_country SET numeric_code = '380' WHERE code_iso = 'ITA'; +UPDATE llx_c_country SET numeric_code = '388' WHERE code_iso = 'JAM'; +UPDATE llx_c_country SET numeric_code = '392' WHERE code_iso = 'JPN'; +UPDATE llx_c_country SET numeric_code = '832' WHERE code_iso = 'JEY'; +UPDATE llx_c_country SET numeric_code = '400' WHERE code_iso = 'JOR'; +UPDATE llx_c_country SET numeric_code = '398' WHERE code_iso = 'KAZ'; +UPDATE llx_c_country SET numeric_code = '404' WHERE code_iso = 'KEN'; +UPDATE llx_c_country SET numeric_code = '417' WHERE code_iso = 'KGZ'; +UPDATE llx_c_country SET numeric_code = '296' WHERE code_iso = 'KIR'; +UPDATE llx_c_country SET numeric_code = '414' WHERE code_iso = 'KWT'; +UPDATE llx_c_country SET numeric_code = '418' WHERE code_iso = 'LAO'; +UPDATE llx_c_country SET numeric_code = '426' WHERE code_iso = 'LSO'; +UPDATE llx_c_country SET numeric_code = '428' WHERE code_iso = 'LVA'; +UPDATE llx_c_country SET numeric_code = '422' WHERE code_iso = 'LBN'; +UPDATE llx_c_country SET numeric_code = '430' WHERE code_iso = 'LBR'; +UPDATE llx_c_country SET numeric_code = '434' WHERE code_iso = 'LBY'; +UPDATE llx_c_country SET numeric_code = '438' WHERE code_iso = 'LIE'; +UPDATE llx_c_country SET numeric_code = '440' WHERE code_iso = 'LTU'; +UPDATE llx_c_country SET numeric_code = '442' WHERE code_iso = 'LUX'; +UPDATE llx_c_country SET numeric_code = '446' WHERE code_iso = 'MAC'; +UPDATE llx_c_country SET numeric_code = '807' WHERE code_iso = 'MKD'; +UPDATE llx_c_country SET numeric_code = '450' WHERE code_iso = 'MDG'; +UPDATE llx_c_country SET numeric_code = '458' WHERE code_iso = 'MYS'; +UPDATE llx_c_country SET numeric_code = '454' WHERE code_iso = 'MWI'; +UPDATE llx_c_country SET numeric_code = '462' WHERE code_iso = 'MDV'; +UPDATE llx_c_country SET numeric_code = '466' WHERE code_iso = 'MLI'; +UPDATE llx_c_country SET numeric_code = '470' WHERE code_iso = 'MLT'; +UPDATE llx_c_country SET numeric_code = '504' WHERE code_iso = 'MAR'; +UPDATE llx_c_country SET numeric_code = '474' WHERE code_iso = 'MTQ'; +UPDATE llx_c_country SET numeric_code = '480' WHERE code_iso = 'MUS'; +UPDATE llx_c_country SET numeric_code = '478' WHERE code_iso = 'MRT'; +UPDATE llx_c_country SET numeric_code = '175' WHERE code_iso = 'MYT'; +UPDATE llx_c_country SET numeric_code = '484' WHERE code_iso = 'MEX'; +UPDATE llx_c_country SET numeric_code = '583' WHERE code_iso = 'FSM'; +UPDATE llx_c_country SET numeric_code = '498' WHERE code_iso = 'MDA'; +UPDATE llx_c_country SET numeric_code = '492' WHERE code_iso = 'MCO'; +UPDATE llx_c_country SET numeric_code = '496' WHERE code_iso = 'MNG'; +UPDATE llx_c_country SET numeric_code = '499' WHERE code_iso = 'MNE'; +UPDATE llx_c_country SET numeric_code = '500' WHERE code_iso = 'MSR'; +UPDATE llx_c_country SET numeric_code = '508' WHERE code_iso = 'MOZ'; +UPDATE llx_c_country SET numeric_code = '104' WHERE code_iso = 'MMR'; +UPDATE llx_c_country SET numeric_code = '516' WHERE code_iso = 'NAM'; +UPDATE llx_c_country SET numeric_code = '520' WHERE code_iso = 'NRU'; +UPDATE llx_c_country SET numeric_code = '524' WHERE code_iso = 'NPL'; +UPDATE llx_c_country SET numeric_code = '558' WHERE code_iso = 'NIC'; +UPDATE llx_c_country SET numeric_code = '562' WHERE code_iso = 'NER'; +UPDATE llx_c_country SET numeric_code = '566' WHERE code_iso = 'NGA'; +UPDATE llx_c_country SET numeric_code = '570' WHERE code_iso = 'NIU'; +UPDATE llx_c_country SET numeric_code = '574' WHERE code_iso = 'NFK'; +UPDATE llx_c_country SET numeric_code = '578' WHERE code_iso = 'NOR'; +UPDATE llx_c_country SET numeric_code = '540' WHERE code_iso = 'NCL'; +UPDATE llx_c_country SET numeric_code = '554' WHERE code_iso = 'NZL'; +UPDATE llx_c_country SET numeric_code = '512' WHERE code_iso = 'OMN'; +UPDATE llx_c_country SET numeric_code = '528' WHERE code_iso = 'NLD'; +UPDATE llx_c_country SET numeric_code = '586' WHERE code_iso = 'PAK'; +UPDATE llx_c_country SET numeric_code = '585' WHERE code_iso = 'PLW'; +UPDATE llx_c_country SET numeric_code = '275' WHERE code_iso = 'PSE'; +UPDATE llx_c_country SET numeric_code = '591' WHERE code_iso = 'PAN'; +UPDATE llx_c_country SET numeric_code = '598' WHERE code_iso = 'PNG'; +UPDATE llx_c_country SET numeric_code = '600' WHERE code_iso = 'PRY'; +UPDATE llx_c_country SET numeric_code = '604' WHERE code_iso = 'PER'; +UPDATE llx_c_country SET numeric_code = '258' WHERE code_iso = 'PYF'; +UPDATE llx_c_country SET numeric_code = '616' WHERE code_iso = 'POL'; +UPDATE llx_c_country SET numeric_code = '620' WHERE code_iso = 'PRT'; +UPDATE llx_c_country SET numeric_code = '630' WHERE code_iso = 'PRI'; +UPDATE llx_c_country SET numeric_code = '826' WHERE code_iso = 'GBR'; +UPDATE llx_c_country SET numeric_code = '732' WHERE code_iso = 'ESH'; +UPDATE llx_c_country SET numeric_code = '140' WHERE code_iso = 'CAF'; +UPDATE llx_c_country SET numeric_code = '203' WHERE code_iso = 'CZE'; +UPDATE llx_c_country SET numeric_code = '178' WHERE code_iso = 'COG'; +UPDATE llx_c_country SET numeric_code = '180' WHERE code_iso = 'COD'; +UPDATE llx_c_country SET numeric_code = '214' WHERE code_iso = 'DOM'; +UPDATE llx_c_country SET numeric_code = '638' WHERE code_iso = 'REU'; +UPDATE llx_c_country SET numeric_code = '646' WHERE code_iso = 'RWA'; +UPDATE llx_c_country SET numeric_code = '642' WHERE code_iso = 'ROU'; +UPDATE llx_c_country SET numeric_code = '643' WHERE code_iso = 'RUS'; +UPDATE llx_c_country SET numeric_code = '882' WHERE code_iso = 'WSM'; +UPDATE llx_c_country SET numeric_code = '016' WHERE code_iso = 'ASM'; +UPDATE llx_c_country SET numeric_code = '652' WHERE code_iso = 'BLM'; +UPDATE llx_c_country SET numeric_code = '659' WHERE code_iso = 'KNA'; +UPDATE llx_c_country SET numeric_code = '674' WHERE code_iso = 'SMR'; +UPDATE llx_c_country SET numeric_code = '663' WHERE code_iso = 'MAF'; +UPDATE llx_c_country SET numeric_code = '666' WHERE code_iso = 'SPM'; +UPDATE llx_c_country SET numeric_code = '670' WHERE code_iso = 'VCT'; +UPDATE llx_c_country SET numeric_code = '654' WHERE code_iso = 'SHN'; +UPDATE llx_c_country SET numeric_code = '662' WHERE code_iso = 'LCA'; +UPDATE llx_c_country SET numeric_code = '678' WHERE code_iso = 'STP'; +UPDATE llx_c_country SET numeric_code = '686' WHERE code_iso = 'SEN'; +UPDATE llx_c_country SET numeric_code = '688' WHERE code_iso = 'SRB'; +UPDATE llx_c_country SET numeric_code = '690' WHERE code_iso = 'SYC'; +UPDATE llx_c_country SET numeric_code = '694' WHERE code_iso = 'SLE'; +UPDATE llx_c_country SET numeric_code = '702' WHERE code_iso = 'SGP'; +UPDATE llx_c_country SET numeric_code = '534' WHERE code_iso = 'SXM'; +UPDATE llx_c_country SET numeric_code = '760' WHERE code_iso = 'SYR'; +UPDATE llx_c_country SET numeric_code = '706' WHERE code_iso = 'SOM'; +UPDATE llx_c_country SET numeric_code = '144' WHERE code_iso = 'LKA'; +UPDATE llx_c_country SET numeric_code = '748' WHERE code_iso = 'SWZ'; +UPDATE llx_c_country SET numeric_code = '710' WHERE code_iso = 'ZAF'; +UPDATE llx_c_country SET numeric_code = '729' WHERE code_iso = 'SDN'; +UPDATE llx_c_country SET numeric_code = '728' WHERE code_iso = 'SSD'; +UPDATE llx_c_country SET numeric_code = '752' WHERE code_iso = 'SWE'; +UPDATE llx_c_country SET numeric_code = '756' WHERE code_iso = 'CHE'; +UPDATE llx_c_country SET numeric_code = '740' WHERE code_iso = 'SUR'; +UPDATE llx_c_country SET numeric_code = '744' WHERE code_iso = 'SJM'; +UPDATE llx_c_country SET numeric_code = '764' WHERE code_iso = 'THA'; +UPDATE llx_c_country SET numeric_code = '158' WHERE code_iso = 'TWN'; +UPDATE llx_c_country SET numeric_code = '834' WHERE code_iso = 'TZA'; +UPDATE llx_c_country SET numeric_code = '762' WHERE code_iso = 'TJK'; +UPDATE llx_c_country SET numeric_code = '086' WHERE code_iso = 'IOT'; +UPDATE llx_c_country SET numeric_code = '260' WHERE code_iso = 'ATF'; +UPDATE llx_c_country SET numeric_code = '626' WHERE code_iso = 'TLS'; +UPDATE llx_c_country SET numeric_code = '768' WHERE code_iso = 'TGO'; +UPDATE llx_c_country SET numeric_code = '772' WHERE code_iso = 'TKL'; +UPDATE llx_c_country SET numeric_code = '776' WHERE code_iso = 'TON'; +UPDATE llx_c_country SET numeric_code = '780' WHERE code_iso = 'TTO'; +UPDATE llx_c_country SET numeric_code = '788' WHERE code_iso = 'TUN'; +UPDATE llx_c_country SET numeric_code = '795' WHERE code_iso = 'TKM'; +UPDATE llx_c_country SET numeric_code = '792' WHERE code_iso = 'TUR'; +UPDATE llx_c_country SET numeric_code = '798' WHERE code_iso = 'TUV'; +UPDATE llx_c_country SET numeric_code = '804' WHERE code_iso = 'UKR'; +UPDATE llx_c_country SET numeric_code = '800' WHERE code_iso = 'UGA'; +UPDATE llx_c_country SET numeric_code = '858' WHERE code_iso = 'URY'; +UPDATE llx_c_country SET numeric_code = '860' WHERE code_iso = 'UZB'; +UPDATE llx_c_country SET numeric_code = '548' WHERE code_iso = 'VUT'; +UPDATE llx_c_country SET numeric_code = '336' WHERE code_iso = 'VAT'; +UPDATE llx_c_country SET numeric_code = '862' WHERE code_iso = 'VEN'; +UPDATE llx_c_country SET numeric_code = '704' WHERE code_iso = 'VNM'; +UPDATE llx_c_country SET numeric_code = '876' WHERE code_iso = 'WLF'; +UPDATE llx_c_country SET numeric_code = '887' WHERE code_iso = 'YEM'; +UPDATE llx_c_country SET numeric_code = '262' WHERE code_iso = 'DJI'; +UPDATE llx_c_country SET numeric_code = '894' WHERE code_iso = 'ZMB'; +UPDATE llx_c_country SET numeric_code = '716' WHERE code_iso = 'ZWE';